Class tensor1 (o2scl)

O2scl : Class List

template<class data_t = double, class vec_t = std::vector<data_t>, class vec_size_t = std::vector<size_t>>
class o2scl::tensor1 : public o2scl::tensor<double, std::vector<double>, std::vector<size_t>>

Rank 1 tensor.

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.

(We have to explicitly provide this version since the set() function is overloaded in this child of tensor.)

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)

Public Functions

tensor1()

Create an empty tensor.

tensor1(size_t sz)

Create a rank 1 tensory of size sz.