 |
Cadabra
Computer algebra system for field theory problems
|
Go to the documentation of this file.
20 NTensor(
const std::vector<double>& vals);
41 double at(
const std::vector<size_t>& indices)
const;
44 double&
at(
const std::vector<size_t>& indices);
std::vector< size_t > shape
Definition: NTensor.hh:75
static NTensor linspace(double from, double to, size_t steps)
Create equally spaced values in a range.
Definition: NTensor.cc:36
NTensor broadcast(std::vector< size_t > new_shape, size_t pos) const
Expand the shape of the tensor to the specified shape by broadcasting to the other dimensions.
Definition: NTensor.cc:184
friend std::ostream & operator<<(std::ostream &, const NTensor &)
Definition: NTensor.cc:96
NTensor & apply(double(*fun)(double))
Apply a scalar function fun to all elements, return a reference to itself.
Definition: NTensor.cc:130
double at(const std::vector< size_t > &indices) const
Get the value of the tensor at the indicated component.
Definition: NTensor.cc:54
std::ostream & operator<<(std::ostream &, const NTensor &)
Definition: NTensor.cc:96
NTensor & operator+=(const NTensor &)
Addition operator. This requires the shapes to match.
Definition: NTensor.cc:138
static NTensor outer_product(const NTensor &a, const NTensor &b)
Outer product of two NTensors.
Definition: NTensor.cc:162
NTensor & operator=(const NTensor &)
Assignment operator.
Definition: NTensor.cc:47
NTensor(const std::vector< size_t > &shape, double val)
Initialise by giving the dimension for each index.
Definition: NTensor.cc:6
void fun(int *&p)
Definition: passing.cc:6
Class to hold numerical values structured in tensor form, that is, a multi-dimensional array.
Definition: NTensor.hh:10
NTensor & operator*=(const NTensor &)
Element-wise multiplication operator. This requires the shapes to match.
Definition: NTensor.cc:150
std::vector< double > values
Definition: NTensor.hh:76