Rank 4 tensor with a grid. More...
#include <tensor_grid.h>
Definition at line 1772 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. | |
template<class size_vec_t > | |
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. | |
void | is_valid () const |
Check that the o2scl::tensor_grid object is valid. | |
tensor_grid (const tensor_grid< vec_t, vec_size_t > &t) | |
Copy using operator() | |
tensor_grid< vec_t, vec_size_t > & | operator= (const tensor_grid< vec_t, vec_size_t > &t) |
Copy using operator=() | |
template<class vec2_t > | |
void | set_val (const vec2_t &grdp, double val) |
Set the element closest to grid point grdp to value val . | |
template<class vec2_t , class vec3_t > | |
void | set_val (const vec2_t &grdp, double val, vec3_t &closest) |
Set the element closest to grid point grdp to value val . More... | |
template<class vec2_t > | |
double | get_val (const vec2_t &gridp) |
Get the element closest to grid point gridp . | |
template<class vec2_t , class vec3_t > | |
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... | |
vec_t & | get_data () |
Return a reference to the data (for HDF I/O) | |
template<class size_vec2_t > | |
void | resize (size_t rank, const size_vec2_t &dim) |
Resize the tensor to rank rank with sizes given in dim . More... | |
bool | is_grid_set () const |
Return true if the grid has been set. | |
template<class vec2_t > | |
void | set_grid_packed (const vec2_t &grid_vec) |
Set the grid. More... | |
template<class vec_vec_t > | |
void | set_grid (const vec_vec_t &grid_vecs) |
Set grid from a vector of vectors of grid points. | |
void | default_grid () |
Use a default grid which just uses the index. | |
template<class vec2_t > | |
void | set_grid_i_vec (size_t ix, const vec2_t &grid_vec) |
Set grid for one index from a vector. | |
template<class vec2_t > | |
void | set_grid_i_func (size_t ix, std::string func) |
Set grid for one index from a function. | |
void | set_grid (std::vector< uniform_grid< double > > &ugs) |
Set grid from a vector of uniform grid objects. More... | |
template<class rvec_t > | |
void | copy_grid (size_t i, rvec_t &v) |
Copy grid for index i to vector v . More... | |
double | get_grid (size_t i, size_t j) const |
Lookup jth value on the ith grid. | |
void | set_grid (size_t i, size_t j, double val) |
Set the jth value on the ith grid. | |
size_t | lookup_grid_val (size_t i, const double &val, double &val2) |
Lookup index for grid closest to val , returning the grid point. More... | |
size_t | lookup_grid (size_t i, double val) |
Lookup index for grid closest to val . | |
template<class vec2_t , class size_vec2_t > | |
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) |
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) |
Lookup internal packed grid index for point closest to val . | |
template<class size_vec2_t , class vec2_t > | |
tensor_grid | copy_slice_interp (size_vec2_t &ifix, vec2_t &vals) |
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") |
Convert to a o2scl::table3d object by summing over all but two indices. | |
template<class size_vec2_t > | |
void | copy_table3d_align (size_t ix_x, size_t ix_y, size_vec2_t &index, table3d &tab, std::string slice_name="z") |
Create a slice in a o2scl::table3d object with an aligned grid. More... | |
template<class size_vec2_t > | |
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") |
Create a slice in a table3d object with a new aligned grid. | |
template<class size_vec2_t > | |
void | copy_table3d_interp (size_t ix_x, size_t ix_y, size_vec2_t &index, table3d &tab, std::string slice_name="z") |
Copy to a slice in a table3d object using interpolation. More... | |
template<class vec2_t > | |
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) |
Copy to a slice in a table3d object using interpolation. | |
template<class vec2_t > | |
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") |
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() | |
template<class range_t = ub_range, class data_range_t = ubvector_range, class index_range_t = ubvector_size_t_range> | |
double | interpolate (double *vals) |
Interpolate values vals into the tensor, returning the result. More... | |
template<class vec2_size_t > | |
double | interp_linear (vec2_size_t &v) |
Perform a linear interpolation of v into the function implied by the tensor and grid. More... | |
template<class vec2_size_t > | |
double | interp_linear_power_two (vec2_size_t &v) |
Perform linear interpolation assuming that all indices can take only two values. More... | |
template<class vec2_size_t , class vec2_t > | |
void | interp_linear_vec0 (vec2_size_t &v, vec2_t &res) |
Perform a linear interpolation of v[1] to v[n-1] resulting in a vector. More... | |
template<class vec2_size_t , class vec2_t > | |
void | interp_linear_power_two_vec0 (vec2_size_t &v, vec2_t &res) |
Perform linear interpolation assuming that the last n-1 indices can take only two values. More... | |
template<class vec2_size_t , class vec2_t > | |
void | interp_linear_vec (vec2_size_t &v, size_t ifree, vec2_t &res) |
Perform a linear interpolation of v into the tensor leaving one index free resulting in a vector. More... | |
![]() | |
tensor () | |
Create an empty tensor with zero rank. | |
tensor (size_t rank, const size_vec_t &dim) | |
Create a tensor of rank rank with sizes given in dim . More... | |
tensor (const tensor< double, vec_t, vec_size_t > &t) | |
Copy using operator() | |
tensor< double, vec_t, vec_size_t > & | operator= (const tensor< double, vec_t, vec_size_t > &t) |
Copy using operator=() | |
void | is_valid () const |
Check that the o2scl::tensor object is valid. | |
void | clear () |
Clear the tensor of all data and free allocated memory. | |
void | set (const size_vec_t &index, double val) |
Set the element indexed by index to value val . | |
void | set_all (double x) |
Set all elements in a tensor to some fixed value. | |
void | swap_data (vec_t &dat) |
Swap the data vector. | |
double & | get (const size_vec_t &index) |
Get the element indexed by index . | |
double const & | get (const size_vec_t &index) const |
Get a const reference to the element indexed by index . | |
ubvector_slice | vector_slice (size_t ix, const size_vec_t &index) |
Fix all but one index to create a vector. More... | |
void | resize (size_t rank, const size_vec_t &dim) |
Resize the tensor to rank rank with sizes given in dim . More... | |
size_t | get_rank () const |
Return the rank of the tensor. | |
size_t | get_size (size_t i) const |
Returns the size of the ith index. | |
const vec_size_t & | get_size_arr () const |
Return the full vector of sizes. | |
const vec_t & | get_data () const |
Return the full data vector. | |
size_t | total_size () const |
Returns the size of the tensor (the product of the sizes over every index) | |
size_t | pack_indices (const size_vec_t &index) |
Pack the indices into a single vector index. | |
void | unpack_index (size_t ix, size_vec_t &index) |
Unpack the single vector index into indices. | |
double | min_value () |
Compute the minimum value in the tensor. | |
void | min_index (vec_size_t &index) |
Compute the index of the minimum value in the tensor. | |
void | min (vec_size_t &index, double &val) |
Compute the index of the minimum value in the tensor and return the minimum. | |
double | max_value () |
Compute the maximum value in the tensor. | |
void | max_index (vec_size_t &index) |
Compute the index of the maximum value in the tensor. | |
void | max (vec_size_t &index, double &val) |
Compute the index and value of the maximum value in the tensor and return the maximum. | |
void | minmax_value (double &min, double &max) |
Compute the minimum and maximum values in the tensor. | |
void | minmax_index (vec_size_t &index_min, vec_size_t &index_max) |
Compute the indices of the minimum and maximum values in the tensor. | |
void | minmax (vec_size_t &index, size_t &index_min, double &min, size_t &index_max, double &max) |
Compute the indices and values of the maximum and minimum in the tensor. | |
double | total_sum () const |
Return the sum over every element in the tensor. | |
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") |
Convert to a o2scl::table3d object by summing over all but two indices. | |
Additional Inherited Members | |
![]() | |
typedef boost::numeric::ublas::vector_slice< boost::numeric::ublas::vector< double > > | ubvector_slice |
typedef boost::numeric::ublas::slice | slice |
![]() | |
vec_t | 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. | |
![]() | |
vec_t | data |
The data. | |
vec_size_t | size |
A rank-sized vector of the sizes of each dimension. | |
size_t | rk |
Rank. | |
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).