tensor-0.1.0
|
Data Structures | |
struct | tensor::CTensor |
Complex Tensor with elements of type "cdouble". More... | |
struct | tensor::RTensor |
Real Tensor with elements of type "double". More... | |
class | tensor::Sparse< elt > |
A sparse matrix. More... | |
class | tensor::Tensor< elt > |
An N-dimensional array of numbers. More... | |
Functions | |
elt_t & | tensor::Tensor< elt >::at (index i) |
Return a mutable reference to an element of a 1D Tensor. More... | |
elt_t & | tensor::Tensor< elt >::at (index row, index col) |
Return a mutable reference to an element of a 2D Tensor. More... | |
elt_t & | tensor::Tensor< elt >::at (index d1, index d2, index d3) |
Return a mutable reference to an element of a 3D Tensor. More... | |
elt_t & | tensor::Tensor< elt >::at (index d1, index d2, index d3, index d4) |
Return a mutable reference to an element of a 4D Tensor. More... | |
elt_t & | tensor::Tensor< elt >::at (index d1, index d2, index d3, index d4, index d5) |
Return a mutable reference to an element of a 5D Tensor. More... | |
elt_t & | tensor::Tensor< elt >::at (index d1, index d2, index d3, index d4, index d5, index d6) |
Return a mutable reference to an element of 6D Tensor. More... | |
mutable_view | tensor::Tensor< elt >::at (PRange r) |
Mutable slice from a 1D Tensor. More... | |
mutable_view | tensor::Tensor< elt >::at (PRange r1, PRange r2) |
Mutable slice from a 2D Tensor. More... | |
mutable_view | tensor::Tensor< elt >::at (PRange r1, PRange r2, PRange r3) |
Mutable slice from a 3D Tensor. More... | |
mutable_view | tensor::Tensor< elt >::at (PRange r1, PRange r2, PRange r3, PRange r4) |
Mutable slice from a 4D Tensor. More... | |
mutable_view | tensor::Tensor< elt >::at (PRange r1, PRange r2, PRange r3, PRange r4, PRange r5) |
Mutable slice from a 5D Tensor. More... | |
mutable_view | tensor::Tensor< elt >::at (PRange r1, PRange r2, PRange r3, PRange r4, PRange r5, PRange r6) |
Mutable slice from a 6D Tensor. More... | |
elt_t & | tensor::Tensor< elt >::at_seq (index i) |
Return a mutable reference to the i-th element of a Tensor, in column major order. More... | |
iterator | tensor::Tensor< elt >::begin () |
Iterator at the beginning. More... | |
const_iterator | tensor::Tensor< elt >::begin () const |
Iterator at the beginning. More... | |
const_iterator | tensor::Tensor< elt >::begin_const () const |
Iterator at the beginning for const objects. More... | |
index | tensor::Tensor< elt >::columns () const |
Query the size of 2nd index. More... | |
const RTensor | tensor::conj (const RTensor &r) |
Complex conjugate of a real tensor. More... | |
const Tensor< elt_t > | tensor::Tensor< elt >::diag (int which=0, int ndx1=0, int ndx2=-1) |
Take a diagonal from a tensor. More... | |
index | tensor::Tensor< elt >::dimension (int which) const |
Length of a given Tensor index. More... | |
const Indices & | tensor::Tensor< elt >::dimensions () const |
Return Tensor dimensions. More... | |
const_iterator | tensor::Tensor< elt >::end () const |
Iterator at the end for const objects. More... | |
iterator | tensor::Tensor< elt >::end () |
Iterator at the end. More... | |
const_iterator | tensor::Tensor< elt >::end_const () const |
Iterator at the end for const objects. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::eye (index rows) |
Identity matrix. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::eye (index rows, index cols) |
Rectangular identity matrix. More... | |
void | tensor::Tensor< elt >::fill_with (const elt_t &e) |
Fill with an element. More... | |
void | tensor::Tensor< elt >::fill_with_zeros () |
Fill with zeros. More... | |
const Tensor< double > | tensor::fold (const Tensor< double > &a, int ndx1, const Tensor< double > &b, int ndx2) |
Contraction of two tensors. More... | |
const Tensor< cdouble > | tensor::fold (const Tensor< cdouble > &a, int ndx1, const Tensor< cdouble > &b, int ndx2) |
Contraction of two tensors. More... | |
const Tensor< double > | tensor::foldc (const Tensor< double > &a, int ndx1, const Tensor< double > &b, int ndx2) |
Contraction of two tensors. More... | |
const Tensor< cdouble > | tensor::foldc (const Tensor< cdouble > &a, int ndx1, const Tensor< cdouble > &b, int ndx2) |
Contraction of two tensors. More... | |
const Tensor< double > | tensor::foldin (const Tensor< double > &a, int _ndx1, const Tensor< double > &b, int _ndx2) |
Contraction of two tensors with complex conjugation. More... | |
const Tensor< cdouble > | tensor::foldin (const Tensor< cdouble > &a, int _ndx1, const Tensor< cdouble > &b, int _ndx2) |
Contraction of two tensors with complex conjugation. More... | |
void | tensor::foldin_into (Tensor< double > &output, const Tensor< double > &a, int _ndx1, const Tensor< double > &b, int _ndx2) |
Similar to foldin(), but the output has been preallocated. | |
void | tensor::foldin_into (Tensor< cdouble > &output, const Tensor< cdouble > &a, int _ndx1, const Tensor< cdouble > &b, int _ndx2) |
Similar to foldin(), but the output has been preallocated. | |
void | tensor::Tensor< elt >::get_dimensions (index *length) const |
Query dimensions of 1D Tensor. More... | |
void | tensor::Tensor< elt >::get_dimensions (index *rows, index *cols) const |
Query dimensions of 2D Tensor. More... | |
void | tensor::Tensor< elt >::get_dimensions (index *d0, index *d1, index *d2) const |
Query dimensions of 3D Tensor. More... | |
void | tensor::Tensor< elt >::get_dimensions (index *d0, index *d1, index *d2, index *d3) const |
Query dimensions of 4D Tensor. More... | |
void | tensor::Tensor< elt >::get_dimensions (index *d0, index *d1, index *d2, index *d3, index *d4) const |
Query dimensions of 5D Tensor. More... | |
void | tensor::Tensor< elt >::get_dimensions (index *d0, index *d1, index *d2, index *d3, index *d4, index *d5) const |
Query dimensions of 6D Tensor. More... | |
bool | tensor::Tensor< elt >::is_empty () const |
Does the tensor have elements? | |
const RTensor | tensor::linspace (double min, double max, index n) |
Vector of 'n' equally spaced numbers in the interval [min, max]. More... | |
const RTensor | tensor::linspace (const RTensor &min, const RTensor &max, index n) |
Tensor of 'n' equally spaced vectors in the interval [min, max]. More... | |
const CTensor | tensor::linspace (cdouble min, cdouble max, index n) |
Vector of 'n' equally spaced numbers in the interval [min, max]. More... | |
const CTensor | tensor::linspace (const CTensor &min, const CTensor &max, index n) |
Tensor of 'n' equally spaced vectors in the interval [min, max]. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::ones (index rows) |
Matrix of ones. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::ones (index rows, index cols) |
Matrix of ones. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::ones (const Indices &dimensions) |
Tensor of ones. More... | |
const elt_t & | tensor::Tensor< elt >::operator() (index i) const |
Return an element of a 1D Tensor. More... | |
const elt_t & | tensor::Tensor< elt >::operator() (index row, index col) const |
Return an element of a 2D Tensor. More... | |
const elt_t & | tensor::Tensor< elt >::operator() (index d0, index d1, index d2) const |
Return an element of a 3D Tensor. More... | |
const elt_t & | tensor::Tensor< elt >::operator() (index d0, index d1, index d2, index d3) const |
Return an element of a 4D Tensor. More... | |
const elt_t & | tensor::Tensor< elt >::operator() (index d0, index d1, index d2, index d3, index d4) const |
Return an element of a 5D Tensor. More... | |
const elt_t & | tensor::Tensor< elt >::operator() (index d0, index d1, index d2, index d3, index d4, index d5w) const |
Return an element of a 6D Tensor. More... | |
const view | tensor::Tensor< elt >::operator() (PRange r) const |
Extracts a slice from a 1D Tensor. More... | |
const view | tensor::Tensor< elt >::operator() (PRange r1, PRange r2) const |
Extracts a slice from a 2D Tensor. More... | |
const view | tensor::Tensor< elt >::operator() (PRange r1, PRange r2, PRange r3) const |
Extracts a slice from a 3D Tensor. More... | |
const view | tensor::Tensor< elt >::operator() (PRange r1, PRange r2, PRange r3, PRange r4) const |
Extracts a slice from a 4D Tensor. More... | |
const view | tensor::Tensor< elt >::operator() (PRange r1, PRange r2, PRange r3, PRange r4, PRange r5) const |
Extracts a slice from a 5D Tensor. More... | |
const view | tensor::Tensor< elt >::operator() (PRange r1, PRange r2, PRange r3, PRange r4, PRange r5, PRange r6) const |
Extracts a slice from a 6D Tensor. More... | |
const Tensor & | tensor::Tensor< elt >::operator= (const Tensor< elt_t > &other) |
Assignment operator. More... | |
const elt_t & | tensor::Tensor< elt >::operator[] (index i) const |
Return the i-th element, accessed in column major order. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::random (index length) |
Build a random 1D Tensor. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::random (index rows, index cols) |
Build a random 2D Tensor. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::random (index d1, index d2, index d3) |
Build a random 3D Tensor. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::random (index d1, index d2, index d3, index d4) |
Build a random 4D Tensor. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::random (index d1, index d2, index d3, index d4, index d5) |
Build a random 5D Tensor. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::random (index d1, index d2, index d3, index d4, index d5, index d6) |
Build a random 6D Tensor. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::random (const Indices &dimensions) |
Build a random Tensor with arbitrary dimensions. More... | |
void | tensor::Tensor< elt >::randomize () |
Fills with random numbers. More... | |
int | tensor::Tensor< elt >::rank () const |
Number of Tensor indices. More... | |
void | tensor::Tensor< elt >::reshape (const Indices &new_dims) |
Change the dimensions, while keeping the data. More... | |
const RTensor | tensor::reshape (const RTensor &t, const Indices &new_dims) |
Return a RTensor with same data and given dimensions. More... | |
const RTensor | tensor::reshape (const RTensor &t, index length) |
Return a RTensor with same data and given dimensions. More... | |
const RTensor | tensor::reshape (const RTensor &t, index rows, index cols) |
Return a RTensor with same data and given dimensions. More... | |
const RTensor | tensor::reshape (const RTensor &t, index d1, index d2, index d3) |
Return a RTensor with same data and given dimensions. More... | |
const RTensor | tensor::reshape (const RTensor &t, index d1, index d2, index d3, index d4) |
Return a RTensor with same data and given dimensions. More... | |
const RTensor | tensor::reshape (const RTensor &t, index d1, index d2, index d3, index d4, index d5) |
Return a RTensor with same data and given dimensions. More... | |
const RTensor | tensor::reshape (const RTensor &t, index d1, index d2, index d3, index d4, index d5, index d6) |
Return a RTensor with same data and given dimensions. More... | |
const CTensor | tensor::reshape (const CTensor &t, const Indices &new_dims) |
Return a CTensor with same data and given dimensions. More... | |
const CTensor | tensor::reshape (const CTensor &t, index length) |
Return a CTensor with same data and given dimensions. More... | |
const CTensor | tensor::reshape (const CTensor &t, index rows, index cols) |
Return a CTensor with same data and given dimensions. More... | |
const CTensor | tensor::reshape (const CTensor &t, index d1, index d2, index d3) |
Return a CTensor with same data and given dimensions. More... | |
const CTensor | tensor::reshape (const CTensor &t, index d1, index d2, index d3, index d4) |
Return a CTensor with same data and given dimensions. More... | |
const CTensor | tensor::reshape (const CTensor &t, index d1, index d2, index d3, index d4, index d5) |
Return a CTensor with same data and given dimensions. More... | |
const CTensor | tensor::reshape (const CTensor &t, index d1, index d2, index d3, index d4, index d5, index d6) |
Return a CTensor with same data and given dimensions. More... | |
index | tensor::Tensor< elt >::rows () const |
Query then size of 1st index. More... | |
const Tensor< double > | tensor::scale (const Tensor< double > &t, int ndx, const Tensor< double > &v) |
Hadamard product of a tensor times a vector. More... | |
const Tensor< cdouble > | tensor::scale (const Tensor< cdouble > &t, int ndx, const Tensor< cdouble > &v) |
Hadamard product of a tensor times a vector. More... | |
index | tensor::Tensor< elt >::size () const |
Returns total number of elements in Tensor. More... | |
const RTensor | tensor::squeeze (const RTensor &t) |
Eliminate all singleton dimensions from a tensor, preserving the data. More... | |
const CTensor | tensor::squeeze (const CTensor &t) |
Eliminate all singleton dimensions from a tensor, preserving the data. More... | |
const RTensor | tensor::take_diag (const RTensor &a, int which, int ndx1, int ndx2) |
Extract a diagonal from a matrix or tensor. More... | |
const CTensor | tensor::take_diag (const CTensor &a, int which, int ndx1, int ndx2) |
Extract a diagonal from a matrix or tensor. More... | |
tensor::Tensor< elt >::Tensor () | |
Constructs an empty Tensor. More... | |
tensor::Tensor< elt >::Tensor (const Indices &new_dims) | |
Constructs an unitialized N-D Tensor given the dimensions. More... | |
tensor::Tensor< elt >::Tensor (const Indices &new_dims, const Tensor< elt_t > &data) | |
Consturcts an N-D Tensor with given initial data. More... | |
tensor::Tensor< elt >::Tensor (const Vector< elt_t > &data) | |
Constructs a 1-D Tensor from a vector. More... | |
tensor::Tensor< elt >::Tensor (const std::vector< elt_t > &data) | |
Constructs a 1-D Tensor from a vector. More... | |
tensor::Tensor< elt >::Tensor (const Tensor &other) | |
Optimized copy constructor (See Optimal copy). More... | |
template<typename e2 > | |
tensor::Tensor< elt >::Tensor (const Tensor< e2 > &other) | |
Implicit coercion. More... | |
template<size_t n> | |
tensor::Tensor< elt >::Tensor (const StaticVector< elt_t, n > &t) | |
Create a one-dimensional tensor from data created with "gen" expressions. More... | |
template<size_t n> | |
tensor::Tensor< elt >::Tensor (const StaticVector< elt_t, n > &t, const Indices &d) | |
Create a general tensor from data created with "gen" expressions. More... | |
tensor::Tensor< elt >::Tensor (index length) | |
Build a 1D Tensor or vector. More... | |
tensor::Tensor< elt >::Tensor (index rows, index cols) | |
Build a 2D Tensor or matrix. More... | |
tensor::Tensor< elt >::Tensor (index d1, index d2, index d3) | |
Build a 3D Tensor. More... | |
tensor::Tensor< elt >::Tensor (index d1, index d2, index d3, index d4) | |
Build a 4D Tensor. More... | |
tensor::Tensor< elt >::Tensor (index d1, index d2, index d3, index d4, index d5) | |
Build a 5D Tensor. More... | |
tensor::Tensor< elt >::Tensor (index d1, index d2, index d3, index d4, index d5, index d6) | |
Build a 6D Tensor. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::zeros (index rows) |
Matrix of zeros. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::zeros (index rows, index cols) |
Matrix of zeros. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::zeros (index d1, index d2, index d3) |
4D Tensor of zeros. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::zeros (index d1, index d2, index d3, index d4) |
4D Tensor of zeros. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::zeros (index d1, index d2, index d3, index d4, index d5) |
5D Tensor of zeros. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::zeros (index d1, index d2, index d3, index d4, index d5, index d6) |
6D Tensor of zeros. More... | |
static const Tensor< elt_t > | tensor::Tensor< elt >::zeros (const Indices &dimensions) |
Tensor of zeros. More... | |
elt_t& tensor::Tensor< elt >::at | ( | index | i | ) |
Return a mutable reference to an element of a 1D Tensor.
elt_t& tensor::Tensor< elt >::at | ( | index | row, |
index | col | ||
) |
Return a mutable reference to an element of a 2D Tensor.
elt_t& tensor::Tensor< elt >::at | ( | index | d1, |
index | d2, | ||
index | d3 | ||
) |
Return a mutable reference to an element of a 3D Tensor.
elt_t& tensor::Tensor< elt >::at | ( | index | d1, |
index | d2, | ||
index | d3, | ||
index | d4 | ||
) |
Return a mutable reference to an element of a 4D Tensor.
elt_t& tensor::Tensor< elt >::at | ( | index | d1, |
index | d2, | ||
index | d3, | ||
index | d4, | ||
index | d5 | ||
) |
Return a mutable reference to an element of a 5D Tensor.
elt_t& tensor::Tensor< elt >::at | ( | index | d1, |
index | d2, | ||
index | d3, | ||
index | d4, | ||
index | d5, | ||
index | d6 | ||
) |
Return a mutable reference to an element of 6D Tensor.
mutable_view tensor::Tensor< elt >::at | ( | PRange | r | ) |
Mutable slice from a 1D Tensor.
mutable_view tensor::Tensor< elt >::at | ( | PRange | r1, |
PRange | r2 | ||
) |
Mutable slice from a 2D Tensor.
mutable_view tensor::Tensor< elt >::at | ( | PRange | r1, |
PRange | r2, | ||
PRange | r3 | ||
) |
Mutable slice from a 3D Tensor.
mutable_view tensor::Tensor< elt >::at | ( | PRange | r1, |
PRange | r2, | ||
PRange | r3, | ||
PRange | r4 | ||
) |
Mutable slice from a 4D Tensor.
mutable_view tensor::Tensor< elt >::at | ( | PRange | r1, |
PRange | r2, | ||
PRange | r3, | ||
PRange | r4, | ||
PRange | r5 | ||
) |
Mutable slice from a 5D Tensor.
mutable_view tensor::Tensor< elt >::at | ( | PRange | r1, |
PRange | r2, | ||
PRange | r3, | ||
PRange | r4, | ||
PRange | r5, | ||
PRange | r6 | ||
) |
Mutable slice from a 6D Tensor.
elt_t& tensor::Tensor< elt >::at_seq | ( | index | i | ) |
Return a mutable reference to the i-th element of a Tensor, in column major order.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
index tensor::Tensor< elt >::dimension | ( | int | which | ) | const |
Length of a given Tensor index.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
static |
Rectangular identity matrix.
void tensor::Tensor< elt >::fill_with | ( | const elt_t & | e | ) |
Fill with an element.
|
inline |
const Tensor<double> tensor::fold | ( | const Tensor< double > & | a, |
int | ndx1, | ||
const Tensor< double > & | b, | ||
int | ndx2 | ||
) |
Contraction of two tensors.
A contraction is a generalization of the matrix product that we all know. The code C=fold(A,1,B,0)
contracts tensors A and B, according to the second and first index as given by the formula
There exist variants for these functions for contracting real with real, complex with complex, and real with complex tensors. Depending on the choice of indices, NDX1 and NDX2, the multiplication will be faster or slower. For instance, at least fast products are achieved via the ATLAS library when NDX=0 or 1.
Definition at line 39 of file tensor_fold_d.cc.
const Tensor<cdouble> tensor::fold | ( | const Tensor< cdouble > & | a, |
int | ndx1, | ||
const Tensor< cdouble > & | b, | ||
int | ndx2 | ||
) |
Contraction of two tensors.
A contraction is a generalization of the matrix product that we all know. The code C=fold(A,1,B,0)
contracts tensors A and B, according to the second and first index as given by the formula
There exist variants for these functions for contracting real with real, complex with complex, and real with complex tensors. Depending on the choice of indices, NDX1 and NDX2, the multiplication will be faster or slower. For instance, at least fast products are achieved via the ATLAS library when NDX=0 or 1.
Definition at line 39 of file tensor_fold_z.cc.
const Tensor<double> tensor::foldc | ( | const Tensor< double > & | a, |
int | ndx1, | ||
const Tensor< double > & | b, | ||
int | ndx2 | ||
) |
Contraction of two tensors.
The code C=foldc(A,n,B,m)
acting on real tensors does the same as fold(A,n,B,m)
.
Definition at line 52 of file tensor_fold_d.cc.
const Tensor<cdouble> tensor::foldc | ( | const Tensor< cdouble > & | a, |
int | ndx1, | ||
const Tensor< cdouble > & | b, | ||
int | ndx2 | ||
) |
Contraction of two tensors.
A contraction is a generalization of the matrix product that we all know. The code C=foldc(A,1,B,0)
contracts tensors A and B, according to the second and first index as given by the formula
There exist variants for these functions for contracting real with real, complex with complex, and real with complex tensors. Depending on the choice of indices, NDX1 and NDX2, the multiplication will be faster or slower. For instance, at least fast products are achieved via the ATLAS library when NDX=0 or 1.
Definition at line 62 of file tensor_fold_z.cc.
const Tensor<double> tensor::foldin | ( | const Tensor< double > & | a, |
int | _ndx1, | ||
const Tensor< double > & | b, | ||
int | _ndx2 | ||
) |
Contraction of two tensors with complex conjugation.
Similar to the fold() routine, but the indices of the first tensor are inserted in the output. In other words the code C=foldc(A,1,B,0)
performs
Definition at line 35 of file tensor_foldin_d.cc.
const Tensor<cdouble> tensor::foldin | ( | const Tensor< cdouble > & | a, |
int | _ndx1, | ||
const Tensor< cdouble > & | b, | ||
int | _ndx2 | ||
) |
Contraction of two tensors with complex conjugation.
Similar to the fold() routine, but the indices of the first tensor are inserted in the output. In other words the code C=foldc(A,1,B,0)
performs
Definition at line 35 of file tensor_foldin_z.cc.
void tensor::Tensor< elt >::get_dimensions | ( | index * | length | ) | const |
Query dimensions of 1D Tensor.
void tensor::Tensor< elt >::get_dimensions | ( | index * | rows, |
index * | cols | ||
) | const |
Query dimensions of 2D Tensor.
void tensor::Tensor< elt >::get_dimensions | ( | index * | d0, |
index * | d1, | ||
index * | d2 | ||
) | const |
Query dimensions of 3D Tensor.
void tensor::Tensor< elt >::get_dimensions | ( | index * | d0, |
index * | d1, | ||
index * | d2, | ||
index * | d3 | ||
) | const |
Query dimensions of 4D Tensor.
void tensor::Tensor< elt >::get_dimensions | ( | index * | d0, |
index * | d1, | ||
index * | d2, | ||
index * | d3, | ||
index * | d4 | ||
) | const |
Query dimensions of 5D Tensor.
void tensor::Tensor< elt >::get_dimensions | ( | index * | d0, |
index * | d1, | ||
index * | d2, | ||
index * | d3, | ||
index * | d4, | ||
index * | d5 | ||
) | const |
Query dimensions of 6D Tensor.
const RTensor tensor::linspace | ( | double | min, |
double | max, | ||
index | n | ||
) |
Vector of 'n' equally spaced numbers in the interval [min, max].
Definition at line 27 of file linspace_d.cc.
const RTensor tensor::linspace | ( | const RTensor & | min, |
const RTensor & | max, | ||
index | n | ||
) |
Tensor of 'n' equally spaced vectors in the interval [min, max].
Definition at line 36 of file linspace_d.cc.
const CTensor tensor::linspace | ( | cdouble | min, |
cdouble | max, | ||
index | n | ||
) |
Vector of 'n' equally spaced numbers in the interval [min, max].
Definition at line 27 of file linspace_z.cc.
const CTensor tensor::linspace | ( | const CTensor & | min, |
const CTensor & | max, | ||
index | n | ||
) |
Tensor of 'n' equally spaced vectors in the interval [min, max].
Definition at line 36 of file linspace_z.cc.
|
inlinestatic |
|
static |
Matrix of ones.
|
static |
Tensor of ones.
const elt_t& tensor::Tensor< elt >::operator() | ( | index | i | ) | const |
Return an element of a 1D Tensor.
const elt_t& tensor::Tensor< elt >::operator() | ( | index | row, |
index | col | ||
) | const |
Return an element of a 2D Tensor.
const elt_t& tensor::Tensor< elt >::operator() | ( | index | d0, |
index | d1, | ||
index | d2 | ||
) | const |
Return an element of a 3D Tensor.
const elt_t& tensor::Tensor< elt >::operator() | ( | index | d0, |
index | d1, | ||
index | d2, | ||
index | d3 | ||
) | const |
Return an element of a 4D Tensor.
const elt_t& tensor::Tensor< elt >::operator() | ( | index | d0, |
index | d1, | ||
index | d2, | ||
index | d3, | ||
index | d4 | ||
) | const |
Return an element of a 5D Tensor.
const elt_t& tensor::Tensor< elt >::operator() | ( | index | d0, |
index | d1, | ||
index | d2, | ||
index | d3, | ||
index | d4, | ||
index | d5w | ||
) | const |
Return an element of a 6D Tensor.
const view tensor::Tensor< elt >::operator() | ( | PRange | r | ) | const |
Extracts a slice from a 1D Tensor.
const view tensor::Tensor< elt >::operator() | ( | PRange | r1, |
PRange | r2 | ||
) | const |
Extracts a slice from a 2D Tensor.
const view tensor::Tensor< elt >::operator() | ( | PRange | r1, |
PRange | r2, | ||
PRange | r3 | ||
) | const |
Extracts a slice from a 3D Tensor.
const view tensor::Tensor< elt >::operator() | ( | PRange | r1, |
PRange | r2, | ||
PRange | r3, | ||
PRange | r4 | ||
) | const |
Extracts a slice from a 4D Tensor.
const view tensor::Tensor< elt >::operator() | ( | PRange | r1, |
PRange | r2, | ||
PRange | r3, | ||
PRange | r4, | ||
PRange | r5 | ||
) | const |
Extracts a slice from a 5D Tensor.
const view tensor::Tensor< elt >::operator() | ( | PRange | r1, |
PRange | r2, | ||
PRange | r3, | ||
PRange | r4, | ||
PRange | r5, | ||
PRange | r6 | ||
) | const |
Extracts a slice from a 6D Tensor.
const Tensor& tensor::Tensor< elt >::operator= | ( | const Tensor< elt_t > & | other | ) |
Assignment operator.
const elt_t& tensor::Tensor< elt >::operator[] | ( | index | i | ) | const |
Return the i-th element, accessed in column major order.
|
static |
Build a random 1D Tensor.
|
static |
Build a random 2D Tensor.
|
static |
Build a random 3D Tensor.
|
static |
Build a random 4D Tensor.
|
static |
Build a random 5D Tensor.
|
static |
Build a random 6D Tensor.
|
static |
Build a random Tensor with arbitrary dimensions.
void tensor::Tensor< elt >::randomize | ( | ) |
Fills with random numbers.
|
inline |
void tensor::Tensor< elt >::reshape | ( | const Indices & | new_dims | ) |
Change the dimensions, while keeping the data.
const RTensor tensor::reshape | ( | const RTensor & | t, |
const Indices & | new_dims | ||
) |
Return a RTensor with same data and given dimensions.
Definition at line 25 of file tensor_reshape_d.cc.
const RTensor tensor::reshape | ( | const RTensor & | t, |
index | length | ||
) |
Return a RTensor with same data and given dimensions.
Definition at line 31 of file tensor_reshape_d.cc.
const RTensor tensor::reshape | ( | const RTensor & | t, |
index | rows, | ||
index | cols | ||
) |
Return a RTensor with same data and given dimensions.
Definition at line 39 of file tensor_reshape_d.cc.
const RTensor tensor::reshape | ( | const RTensor & | t, |
index | d1, | ||
index | d2, | ||
index | d3 | ||
) |
Return a RTensor with same data and given dimensions.
Definition at line 48 of file tensor_reshape_d.cc.
const RTensor tensor::reshape | ( | const RTensor & | t, |
index | d1, | ||
index | d2, | ||
index | d3, | ||
index | d4 | ||
) |
Return a RTensor with same data and given dimensions.
Definition at line 58 of file tensor_reshape_d.cc.
const RTensor tensor::reshape | ( | const RTensor & | t, |
index | d1, | ||
index | d2, | ||
index | d3, | ||
index | d4, | ||
index | d5 | ||
) |
Return a RTensor with same data and given dimensions.
Definition at line 70 of file tensor_reshape_d.cc.
const RTensor tensor::reshape | ( | const RTensor & | t, |
index | d1, | ||
index | d2, | ||
index | d3, | ||
index | d4, | ||
index | d5, | ||
index | d6 | ||
) |
Return a RTensor with same data and given dimensions.
Definition at line 83 of file tensor_reshape_d.cc.
const CTensor tensor::reshape | ( | const CTensor & | t, |
const Indices & | new_dims | ||
) |
Return a CTensor with same data and given dimensions.
Definition at line 25 of file tensor_reshape_z.cc.
const CTensor tensor::reshape | ( | const CTensor & | t, |
index | length | ||
) |
Return a CTensor with same data and given dimensions.
Definition at line 31 of file tensor_reshape_z.cc.
const CTensor tensor::reshape | ( | const CTensor & | t, |
index | rows, | ||
index | cols | ||
) |
Return a CTensor with same data and given dimensions.
Definition at line 39 of file tensor_reshape_z.cc.
const CTensor tensor::reshape | ( | const CTensor & | t, |
index | d1, | ||
index | d2, | ||
index | d3 | ||
) |
Return a CTensor with same data and given dimensions.
Definition at line 48 of file tensor_reshape_z.cc.
const CTensor tensor::reshape | ( | const CTensor & | t, |
index | d1, | ||
index | d2, | ||
index | d3, | ||
index | d4 | ||
) |
Return a CTensor with same data and given dimensions.
Definition at line 58 of file tensor_reshape_z.cc.
const CTensor tensor::reshape | ( | const CTensor & | t, |
index | d1, | ||
index | d2, | ||
index | d3, | ||
index | d4, | ||
index | d5 | ||
) |
Return a CTensor with same data and given dimensions.
Definition at line 70 of file tensor_reshape_z.cc.
const CTensor tensor::reshape | ( | const CTensor & | t, |
index | d1, | ||
index | d2, | ||
index | d3, | ||
index | d4, | ||
index | d5, | ||
index | d6 | ||
) |
Return a CTensor with same data and given dimensions.
Definition at line 83 of file tensor_reshape_z.cc.
|
inline |
const Tensor<double> tensor::scale | ( | const Tensor< double > & | t, |
int | ndx, | ||
const Tensor< double > & | v | ||
) |
Hadamard product of a tensor times a vector.
A Hadamard product consists on multiplying the element that have equal indices. For instance, if the tensor T has three indices, the call {scale(t, 1, v)}
would be equivalent to .
Definition at line 31 of file tensor_scale_d.cc.
const Tensor<cdouble> tensor::scale | ( | const Tensor< cdouble > & | t, |
int | ndx, | ||
const Tensor< cdouble > & | v | ||
) |
Hadamard product of a tensor times a vector.
A Hadamard product consists on multiplying the element that have equal indices. For instance, if the tensor T has three indices, the call {scale(t, 1, v)}
would be equivalent to .
Definition at line 31 of file tensor_scale_z.cc.
|
inline |
const RTensor tensor::squeeze | ( | const RTensor & | t | ) |
Eliminate all singleton dimensions from a tensor, preserving the data.
Definition at line 27 of file tensor_squeeze_d.cc.
const CTensor tensor::squeeze | ( | const CTensor & | t | ) |
Eliminate all singleton dimensions from a tensor, preserving the data.
Definition at line 27 of file tensor_squeeze_z.cc.
const RTensor tensor::take_diag | ( | const RTensor & | a, |
int | which, | ||
int | ndx1, | ||
int | ndx2 | ||
) |
Extract a diagonal from a matrix or tensor.
For a matrix, it extracts a vector of matrix elements that follow the formula $A(i,i+which)$. For a tensor, we do a similar operation but acting on the indices 'ndx1' and 'ndx2'.
Definition at line 30 of file tensor_take_diag_d.cc.
const CTensor tensor::take_diag | ( | const CTensor & | a, |
int | which, | ||
int | ndx1, | ||
int | ndx2 | ||
) |
Extract a diagonal from a matrix or tensor.
For a matrix, it extracts a vector of matrix elements that follow the formula $A(i,i+which)$. For a tensor, we do a similar operation but acting on the indices 'ndx1' and 'ndx2'.
Definition at line 30 of file tensor_take_diag_z.cc.
tensor::Tensor< elt >::Tensor | ( | ) |
Constructs an empty Tensor.
|
explicit |
Constructs an unitialized N-D Tensor given the dimensions.
tensor::Tensor< elt >::Tensor | ( | const Indices & | new_dims, |
const Tensor< elt_t > & | data | ||
) |
Consturcts an N-D Tensor with given initial data.
tensor::Tensor< elt >::Tensor | ( | const Vector< elt_t > & | data | ) |
Constructs a 1-D Tensor from a vector.
|
inline |
tensor::Tensor< elt >::Tensor | ( | const Tensor< elt > & | other | ) |
Optimized copy constructor (See Optimal copy).
|
inline |
|
inline |
|
inline |
|
explicit |
Build a 1D Tensor or vector.
tensor::Tensor< elt >::Tensor | ( | index | rows, |
index | cols | ||
) |
Build a 2D Tensor or matrix.
tensor::Tensor< elt >::Tensor | ( | index | d1, |
index | d2, | ||
index | d3 | ||
) |
Build a 3D Tensor.
tensor::Tensor< elt >::Tensor | ( | index | d1, |
index | d2, | ||
index | d3, | ||
index | d4 | ||
) |
Build a 4D Tensor.
tensor::Tensor< elt >::Tensor | ( | index | d1, |
index | d2, | ||
index | d3, | ||
index | d4, | ||
index | d5 | ||
) |
Build a 5D Tensor.
tensor::Tensor< elt >::Tensor | ( | index | d1, |
index | d2, | ||
index | d3, | ||
index | d4, | ||
index | d5, | ||
index | d6 | ||
) |
Build a 6D Tensor.
|
inlinestatic |
|
static |
Matrix of zeros.
|
static |
4D Tensor of zeros.
|
static |
4D Tensor of zeros.
|
static |
5D Tensor of zeros.
|
static |
6D Tensor of zeros.
|
static |
Tensor of zeros.