Rank 1 tensor. More...
#include <tensor.h>
Public Member Functions | |
tensor1 () | |
Create an empty tensor. | |
tensor1 (size_t sz) | |
Create a rank 1 tensory of size sz . | |
Method to check for valid object | |
void | is_valid () const |
Check that the o2scl::tensor1 object is valid. | |
Specialized get and set functions | |
data_t & | get (size_t ix) |
Get the element indexed by ix . | |
const data_t & | get (size_t ix) const |
Get the element indexed by ix . | |
void | set (size_t index, data_t val) |
Set the element indexed by index to value val . | |
template<class size_vec_t > | |
void | set (const size_vec_t &index, data_t val) |
Set the element indexed by index to value val . More... | |
Specialized operator functions | |
data_t & | operator[] (size_t ix) |
Get an element using array-like indexing. | |
const data_t & | operator[] (size_t ix) const |
Get an element using array-like indexing (const version) | |
data_t & | operator() (size_t ix) |
Get an element using operator() | |
const data_t & | operator() (size_t ix) const |
Get an element using operator() (const version) | |
![]() | |
tensor () | |
Create an empty tensor with zero rank. | |
template<class size_vec_t > | |
tensor (size_t rank, const size_vec_t &dim) | |
Create a tensor of rank rank with sizes given in dim . More... | |
void | is_valid () const |
Check that the o2scl::tensor object is valid. | |
tensor (const tensor< data_t, vec_t, vec_size_t > &t) | |
Copy using operator() | |
tensor< data_t, vec_t, vec_size_t > & | operator= (const tensor< data_t, vec_t, vec_size_t > &t) |
Copy using operator=() | |
void | clear () |
Clear the tensor of all data and free allocated memory. | |
template<class size_vec_t > | |
void | set (const size_vec_t &index, data_t val) |
Set the element indexed by index to value val . | |
void | set_all (data_t x) |
Set all elements in a tensor to some fixed value. | |
void | swap_data (vec_t &dat) |
Swap the data vector. | |
template<class size_vec_t > | |
data_t & | get (const size_vec_t &index) |
Get the element indexed by index . | |
template<class size_vec_t > | |
data_t const & | get (const size_vec_t &index) const |
Get a const reference to the element indexed by index . | |
template<class size_vec_t > | |
ubvector_slice | vector_slice (size_t ix, const size_vec_t &index) |
Fix all but one index to create a vector. More... | |
template<class size_vec_t > | |
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) | |
template<class size_vec_t > | |
size_t | pack_indices (const size_vec_t &index) |
Pack the indices into a single vector index. | |
template<class size_vec_t > | |
void | unpack_index (size_t ix, size_vec_t &index) |
Unpack the single vector index into indices. | |
data_t | 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, data_t &val) |
Compute the index of the minimum value in the tensor and return the minimum. | |
data_t | 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, data_t &val) |
Compute the index and value of the maximum value in the tensor and return the maximum. | |
void | minmax_value (data_t &min, data_t &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, data_t &min, size_t &index_max, data_t &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< data_t > > | ubvector_slice |
typedef boost::numeric::ublas::slice | slice |
![]() | |
vec_t | data |
The data. | |
vec_size_t | size |
A rank-sized vector of the sizes of each dimension. | |
size_t | rk |
Rank. | |
|
inline |
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).