Namespace that contains all classes, functions and constants needed for Tensor.
More...
|
class | Tensor |
| Provides a lightweight and fast class for accessing 1D arrays as multi-dimensional tensors (up to 4D). More...
|
|
|
template<class TT > |
std::ostream & | operator<< (std::ostream &os, const Tensor< TT > &t) |
| Prints the values of the Tensor object together with the respective index. More...
|
|
template<class TT > |
void | swap (Tensor< TT > &a, Tensor< TT > &b) |
| Non-member swap exchanges the contents of two Tensors. More...
|
|
◆ operator<<()
template<class TT >
std::ostream & maia::tensor::operator<< |
( |
std::ostream & |
os, |
|
|
const Tensor< TT > & |
t |
|
) |
| |
- Author
- Michael Schlottke (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
- Date
- 2012-11-09
- Template Parameters
-
TT | Scalar data type of the tensor elements. |
- Parameters
-
[in] | os | Output stream that should be written to. |
[in] | indexer | The indexer object. |
- Returns
- The output stream for further concatenation.
Definition at line 722 of file tensor.h.
722 {
723 for(
MInt i = 0; i < t.
dim0(); i++) {
724 for(
MInt j = 0; j < t.
dim1(); j++) {
725 for(
MInt k = 0; k < t.
dim2(); k++) {
726 for(
MInt l = 0; l < t.
dim3(); l++) {
727 os << "(" << i << "," << j << "," << k << "," << l << ") = ";
728 os << t(i, j, k, l) << std::endl;
729 }
730 }
731 }
732 }
733
734 os <<
"Dimensions (i,j,k,l) = (" << t.
dim0() <<
"," << t.
dim1() <<
"," << t.
dim2() <<
"," << t.
dim3() <<
")"
735 << std::endl;
736
737 return os;
738}
size_type dim0() const
Return the size of dimension 0.
size_type dim1() const
Return the size of dimension 1.
size_type dim2() const
Return the size of dimension 2.
size_type dim3() const
Return the size of dimension 3.
◆ swap()
template<class TT >
void maia::tensor::swap |
( |
Tensor< TT > & |
a, |
|
|
Tensor< TT > & |
b |
|
) |
| |
|
inline |