Giter Site home page Giter Site logo

Comments (12)

awsteiner avatar awsteiner commented on August 23, 2024

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.

slizovskiy avatar slizovskiy commented on August 23, 2024

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.

slizovskiy avatar slizovskiy commented on August 23, 2024

Thank you for referring to tensor_ts.cpp! I will try to write my example myself and will hopefully share it here.

from o2scl.

awsteiner avatar awsteiner commented on August 23, 2024

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.

slizovskiy avatar slizovskiy commented on August 23, 2024

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.

awsteiner avatar awsteiner commented on August 23, 2024

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.

slizovskiy avatar slizovskiy commented on August 23, 2024

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.

slizovskiy avatar slizovskiy commented on August 23, 2024

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.

slizovskiy avatar slizovskiy commented on August 23, 2024

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.

awsteiner avatar awsteiner commented on August 23, 2024

I'm not sure....let me try this later this week.

from o2scl.

ny2292000 avatar ny2292000 commented on August 23, 2024

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.

awsteiner avatar awsteiner commented on August 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.