Rank 4 tensor with a grid. More...
#include <tensor_grid.h>
Definition at line 2436 of file tensor_grid.h.
Public Member Functions | |
tensor_grid4 () | |
Create an empty tensor. | |
tensor_grid4 (size_t sz, size_t sz2, size_t sz3, size_t sz4) | |
Create a rank 4 tensor of size (sz,sz2,sz3,sz4) | |
double & | get (size_t ix1, size_t ix2, size_t ix3, size_t ix4) |
Get the element indexed by (ix1,ix2,ix3,ix4) | |
const double & | get (size_t ix1, size_t ix2, size_t ix3, size_t ix4) const |
Get the element indexed by (ix1,ix2,ix3,ix4) | |
void | set (size_t ix1, size_t ix2, size_t ix3, size_t ix4, double val) |
Set the element indexed by (ix1,ix2,ix3,ix4) to value val . | |
template<class range_t = ub_range, class data_range_t = ubvector_range, class index_range_t = ubvector_size_t_range> | |
double | interp (double x, double y, double z, double a) |
Interpolate (x,y,z,a) and return the results. | |
double | interp_linear (double x, double y, double z, double a) |
Interpolate (x,y,z,a) and return the results. | |
![]() | |
tensor_grid () | |
Create an empty tensor with zero rank. | |
tensor_grid (size_t rank, const size_vec_t &dim) | |
Create a tensor of rank rank with sizes given in dim . More... | |
tensor_grid (std::vector< uniform_grid< double > > &ugs) | |
Create a tensor with a grid defined by a set of o2scl::uniform_grid objects. | |
virtual | ~tensor_grid () |
Destructor. | |
tensor_grid (const tensor_grid< std::vector< double >, std::vector< size_t > > &t) | |
Copy using operator() | |
tensor_grid< std::vector< double >, std::vector< size_t > > & | operator= (const tensor_grid< std::vector< double >, std::vector< size_t > > &t) |
Copy using operator=() | |
void | is_valid () const |
Check that the o2scl::tensor_grid object is valid. | |
void | set_val (const vec2_t &grdp, double val) |
Set the element closest to grid point grdp to value val . | |
void | set_val (const vec2_t &grdp, double val, vec3_t &closest) |
Set the element closest to grid point grdp to value val . More... | |
double | get_val (const vec2_t &gridp) |
Get the element closest to grid point gridp . | |
double | get_val (const vec2_t &gridp, vec3_t &closest) |
Get the element closest to grid point gridp , store grid values in closest and return value. More... | |
const std::vector< double > & | get_grid () const |
Get grid. | |
double | get_grid (size_t i, size_t j) const |
Lookup jth value on the ith grid. | |
bool | is_grid_set () const |
Return true if the grid has been set. | |
void | set_grid_packed (const vec2_t &grid_vec) |
Set the grid. More... | |
void | set_grid (const vec_vec_t &grid_vecs) |
Set grid from a vector of vectors of grid points. | |
void | set_grid (std::vector< uniform_grid< double > > &ugs) |
Set grid from a vector of uniform grid objects. More... | |
void | set_grid (size_t i, size_t j, double val) |
Set the jth value on the ith grid. | |
void | default_grid () |
Use a default grid which just uses the index. | |
void | set_grid_i_vec (size_t ix, const vec2_t &grid_vec) |
Set grid for one index from a vector. | |
void | set_grid_i_func (size_t ix, std::string func) |
Set grid for one index from a function. | |
void | copy_grid (size_t i, rvec_t &v) const |
Copy grid for index i to vector v . More... | |
size_t | lookup_grid_val (size_t i, const double &val, double &val2) const |
Lookup index for grid closest to val , returning the grid point. More... | |
size_t | lookup_grid (size_t i, double val) const |
Lookup index for grid closest to val . | |
void | lookup_grid_vec (const vec2_t &vals, size_vec2_t &indices) const |
Lookup indices for grid closest point to vals . More... | |
size_t | lookup_grid_packed_val (size_t i, double val, double &val2) const |
Lookup internal packed grid index for point closest to val and store closest value in val2 . More... | |
size_t | lookup_grid_packed (size_t i, double val) const |
Lookup internal packed grid index for point closest to val . | |
void | resize (size_t rank, const size_vec2_t &dim) |
Resize the tensor to rank rank with sizes given in dim . More... | |
tensor_grid | copy_slice_interp (size_vec2_t &ifix, vec2_t &vals) const |
Copy an abitrary slice by fixing 1 or more indices and use interpolation to return a new tensor_grid object. | |
void | convert_table3d_sum (size_t ix_x, size_t ix_y, table3d &tab, std::string x_name="x", std::string y_name="y", std::string slice_name="z") const |
Convert to a o2scl::table3d object by summing over all but two indices. | |
void | copy_table3d_align (size_t ix_x, size_t ix_y, size_vec2_t &index, table3d &tab, std::string slice_name="z") const |
Create a slice in a o2scl::table3d object with an aligned grid. More... | |
void | copy_table3d_align_setxy (size_t ix_x, size_t ix_y, size_vec2_t &index, table3d &tab, std::string x_name="x", std::string y_name="y", std::string slice_name="z") const |
Create a slice in a table3d object with a new aligned grid. | |
void | copy_table3d_interp (size_t ix_x, size_t ix_y, size_vec2_t &index, table3d &tab, std::string slice_name="z") const |
Copy to a slice in a table3d object using interpolation. More... | |
void | copy_table3d_interp_values (size_t ix_x, size_t ix_y, vec2_t &values, table3d &tab, std::string slice_name="z", int verbose=0) const |
Copy to a slice in a table3d object using interpolation. | |
void | copy_table3d_interp_values_setxy (size_t ix_x, size_t ix_y, vec2_t &values, table3d &tab, std::string x_name="x", std::string y_name="y", std::string slice_name="z") const |
Copy to a slice in a table3d object using interpolation creating a new table3d grid. | |
void | clear () |
Clear the tensor of all data and free allocated memory. | |
void | set_interp_type (size_t interp_type) |
Set interpolation type for interpolate() | |
double | interpolate (double *vals) |
Interpolate values vals into the tensor, returning the result. More... | |
double | interp_linear_partial (const vec2_size_t &ix_to_interp, vec3_size_t &ix, const vec2_t &val) const |
Obtain a value by looking up some indices and interpolating the others. More... | |
double | interp_linear (vec2_t &v) const |
Perform a linear interpolation of v into the function implied by the tensor and grid. More... | |
double | interp_linear_power_two (vec2_t &v) const |
Perform linear interpolation assuming that all indices can take only two values. More... | |
void | interp_linear_vec0 (vec2_t &v, vec3_t &res) const |
Perform a linear interpolation of v[1] to v[n-1] resulting in a vector. More... | |
void | interp_linear_power_two_vec0 (vec2_t &v, vec3_t &res) const |
Perform linear interpolation assuming that the last n-1 indices can take only two values. More... | |
void | interp_linear_vec (vec2_t &v, size_t ifree, vec3_t &res) const |
Perform a linear interpolation of v into the tensor leaving one index free resulting in a vector. More... | |
tensor_grid | rearrange_and_copy (std::vector< index_spec > spec, int verbose=0, bool err_on_fail=true) const |
Rearrange, sum and copy current tensor to a new tensor. More... | |
Additional Inherited Members | |
![]() | |
std::vector< double > | grid |
A rank-sized set of arrays for the grid points. | |
bool | grid_set |
If true, the grid has been set by the user. | |
size_t | itype |
Interpolation type. | |
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).