22 explicit NTensor(
const std::vector<size_t>&
shape, std::complex<double>
val);
25 explicit NTensor(
const std::vector<std::complex<double>>&
vals);
30 NTensor(std::initializer_list<std::complex<double>>
vals);
34 explicit NTensor(std::complex<double>);
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);
103 NTensor&
apply(std::complex<double> (*
fun)(
const std::complex<double>&));
115 std::vector<std::complex<double>>
values;
bool is_real() const
Test if all values of the tensor are real.
Definition NTensor.cc:362
std::vector< size_t > shape
Definition NTensor.hh:114
static NTensor linspace(std::complex< double > from, std::complex< double > to, size_t steps)
Create equally spaced values in a range.
Definition NTensor.cc:104
bool is_scalar() const
Test if the shape is a single element equal to 1 (so the tensor is actually a scalar).
Definition NTensor.cc:370
std::complex< double > at() const
Get the value of a scalar NTensor.
Definition NTensor.cc:123
NTensor & operator+=(const NTensor &)
Addition operator. This requires the shapes to match.
Definition NTensor.cc:234
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:375
NTensor & operator=(const NTensor &)
Assignment operator.
Definition NTensor.cc:116
NTensor & operator*=(const NTensor &)
Element-wise multiplication operator. This requires the shapes to match.
Definition NTensor.cc:265
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:219
NTensor & pow(const NTensor &)
Element-wise pow operator (self**b, or pow(self,b)). Requires the shapes to match.
Definition NTensor.cc:312
std::vector< std::complex< double > > values
Definition NTensor.hh:115
static NTensor outer_product(const NTensor &a, const NTensor &b)
Outer product of two NTensors.
Definition NTensor.cc:338
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 set(rset_t::iterator &num, multiplier_t fac)
Definition Storage.cc:1179
void fun(int *&p)
Definition passing.cc:6