22 explicit NTensor(
const std::vector<size_t>&
shape, std::complex<double> val);
25 explicit NTensor(
const std::vector<std::complex<double>>& vals);
27 explicit NTensor(
const std::vector<double>& vals);
30 NTensor(std::initializer_list<std::complex<double>> vals);
31 NTensor(std::initializer_list<double> vals);
34 explicit NTensor(std::complex<double>);
44 static NTensor linspace(std::complex<double> from, std::complex<double> to,
size_t steps);
67 std::complex<double>
at()
const;
70 std::complex<double>
at(
const std::vector<size_t>& indices)
const;
73 std::complex<double>&
at(
const std::vector<size_t>& indices);
100 NTensor&
apply(std::complex<double> (*
fun)(
const std::complex<double>&));
108 std::vector<std::complex<double>>
values;
bool is_real() const
Test if all values of the tensor are real.
Definition NTensor.cc:346
std::vector< size_t > shape
Definition NTensor.hh:107
static NTensor linspace(std::complex< double > from, std::complex< double > to, size_t steps)
Create equally spaced values in a range.
Definition NTensor.cc:99
std::complex< double > at() const
Get the value of a scalar NTensor.
Definition NTensor.cc:117
NTensor & operator+=(const NTensor &)
Addition operator. This requires the shapes to match.
Definition NTensor.cc:220
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:354
NTensor & operator=(const NTensor &)
Assignment operator.
Definition NTensor.cc:110
NTensor & operator*=(const NTensor &)
Element-wise multiplication operator. This requires the shapes to match.
Definition NTensor.cc:251
friend std::ostream & operator<<(std::ostream &, const NTensor &)
NTensor & apply(std::complex< double >(*fun)(const std::complex< double > &))
Apply a scalar function fun to all elements, return a reference to itself.
Definition NTensor.cc:212
NTensor & pow(const NTensor &)
Element-wise pow operator (self**b, or pow(self,b)). Requires the shapes to match.
Definition NTensor.cc:298
NTensor(const std::vector< size_t > &shape, std::complex< double > val)
Initialise by giving the dimension for each index.
Definition NTensor.cc:20
std::vector< std::complex< double > > values
Definition NTensor.hh:108
static NTensor outer_product(const NTensor &a, const NTensor &b)
Outer product of two NTensors.
Definition NTensor.cc:324
Functions to handle the exchange properties of two or more symbols in a product.
Definition Adjform.cc:83
std::ostream & operator<<(std::ostream &os, const Multiplier &m)
Definition Multiplier.cc:208
void fun(int *&p)
Definition passing.cc:6