Comments (12)
You are correct, there is no good tensor example, so I will work on it and get back to you as soon as I can. In the mean time, you may find src/base/tensor_ts.cpp helpful. However, I should warn you, O2scl includes only a very basic scheme for grid-based interpolation in higher dimensions in the tensor_grid class, but I don't recommend it's use for anything other than linear interpolation. (The classes interpm_neigh and interpm_idw work best on data which is not specified on a grid.) What rank tensor do you have?
Oh and I forgot: extrapolation is essentially always supported in O2scl for all of the interpolation methods.
from o2scl.
Thank you for your reply! I have 6 D interpolation with around 1000000 sample points on a regular grid. There is a more sophisticated Bspline library called "splinter", BUT it takes enormous time even for linear BSpline. That's why I need a good FAST implementation of linear interpolation or some inverse square interpolation. Hope that your library will be helpful, but an example would be very helpful.
Best wishes,
Sergey
from o2scl.
Thank you for referring to tensor_ts.cpp! I will try to write my example myself and will hopefully share it here.
from o2scl.
Ok. Check out https://github.com/awsteiner/o2scl/blob/master/examples/ex_tensor.cpp . I try to make my classes agnostic with regard to the base vector type, so tensor_grid::interp_linear() always works. However, tensor_grid::interpolate() only works if the base vector types are from ublas.
from o2scl.
That is a helpful example! Are there any save/load methods in tensor_grid class? I have read from the manual that you use HDF library for that. Is it hard to make a simple example that would save/load the tensor_grid with http://web.utk.edu/~asteine1/o2scl/html/classo2scl__hdf_1_1hdf__file.html functions?
from o2scl.
The file ex_tensor.cpp now demonstrates this as well (the I/O functions are at the bottom of hdf_io.h). Note however that HDF5 I/O only works if the tensor is built upon std::vector types, since ublas vectors are not (so far as I know) guaranteed to be contiguous in memory.
from o2scl.
Thank you! This is really helpful!
The file ex_tensor.cpp now demonstrates this as well (the I/O
functions are at the bottom of hdf_io.h). Note however that HDF5 I/O
only works if the tensor is built upon std::vector types, since ublas
vectors are not (so far as I know) guaranteed to be contiguous in memory.—
Reply to this email directly or view it on GitHub
#2 (comment).
from o2scl.
Dear Andrew, a useful improvement for the future could be the functions to integrate and differentiate on the (possibly non-equally spaced) tensor grid. This is not easy in general, but, at least the linear interpolation can be easily integrated.
from o2scl.
Dear Andrew,
I have attempted to use tensor_grid template class with complex
field and this resulted in an error.
Is it hard to make it work for complex? At least, the linear
interpolation should be straightforward.
Best wishes,
Sergey
On 09/12/15 15:20, Andrew W. Steiner wrote:
You are correct, there is no good tensor example, so I will work on it
and get back to you as soon as I can. In the mean time, you may find
src/base/tensor_ts.cpp helpful. However, I should warn you, O_2 scl
includes only a very basic scheme for grid-based interpolation in
higher dimensions in the tensor_grid class, but I don't recommend it's
use for anything other than linear interpolation. (The classes
interpm_neigh and interpm_idw work best on data which is not specified
on a grid.) What rank tensor do you have?—
Reply to this email directly or view it on GitHub
#2 (comment).
from o2scl.
I'm not sure....let me try this later this week.
from o2scl.
Dear Andrew,
I am facing the problem of calculating the proton fraction of a neutron star where Gravitation is irrelevant (zero pressure).
Can your work be applied to that scenario?
https://arxiv.org/pdf/1303.4662.pdf
By the way, I also had trouble in the make all for o2scl on ubuntu 18.04
Marco
from o2scl.
Marco,
1) I'd prefer you create a new issue rather than commenting on an unrelated issue. No need to repeat this comment, but I just note this for next time.
2) It's not clear exactly what you mean by "Gravitation is irrelevant". The proton fraction can be computed at any density and that calculation does not include any effect of gravity (using e.g. the calc_eos() function in the nstar_cold class). However, the phrase "proton fraction of a neutron star" implies you're thinking about a neutron star where ignoring gravity is a poor approximation. In any case, check out https://neutronstars.utk.edu/code/o2scl/eos/html/cnstar.html and see if that helps.
Take care,
Andrew
from o2scl.
Related Issues (19)
- Compilation problem HOT 6
- eos_quark_cfl6_ts: Test fails with version 0.924 (probably due to float accuracy) HOT 1
- Make all failing in html directory HOT 2
- Use of o2scl on a hyperspherical shell neutron star HOT 5
- error in compiling o2scl program files HOT 16
- hdf5.h no such file or directory HOT 5
- compile error HOT 2
- exc_overflow_error in eos_nse_full_ts test HOT 3
- Build fails against GCC 11 HOT 2
- eos_quark_cfl6: Test fails due to tolerance issues on 64-bit (but not on 32-bit) HOT 1
- Compilation fails when using plain hdf5 headers and -DO2SCL_PLAIN_HDF5_HEADER does not help HOT 12
- about dependences and tests HOT 2
- shunting yard: fabs instead of abs HOT 1
- Is there any suggestion about numerical calculation of diquark gaps in CFL phase
- Error in o2scl/vector.h in compilation HOT 2
- i586: Failure of fit_fix test HOT 1
- glob test fails HOT 1
- LU decomposition test fails on 64-bit HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from o2scl.