template<template< typename > class Matrix, typename C > |
Tensor< Matrix, C > | mptensor::transpose (Tensor< Matrix, C > T, const Axes &axes) |
| Transposition of tensor with lazy evaluation. More...
|
|
template<template< typename > class Matrix, typename C > |
Tensor< Matrix, C > | mptensor::transpose (const Tensor< Matrix, C > &T, const Axes &axes, size_t urank_new) |
| Transposition of tensor without lazy evaluation. More...
|
|
template<template< typename > class Matrix, typename C > |
Tensor< Matrix, C > | mptensor::reshape (const Tensor< Matrix, C > &T, const Shape &shape_new) |
| Change the shape of tensor. More...
|
|
template<template< typename > class Matrix, typename C > |
Tensor< Matrix, C > | mptensor::slice (const Tensor< Matrix, C > &T, size_t n_axes, size_t i_begin, size_t i_end) |
| Slice a tensor. More...
|
|
template<template< typename > class Matrix, typename C > |
Tensor< Matrix, C > | mptensor::slice (const Tensor< Matrix, C > &T, const Index &index_begin, const Index &index_end) |
| Slice a tensor. More...
|
|
template<template< typename > class Matrix, typename C > |
Tensor< Matrix, C > | mptensor::extend (const Tensor< Matrix, C > &T, const Shape &shape_new) |
| Extend the size of a tensor. More...
|
|
Operations in order to change the shape of a tensor
◆ extend()
template<template< typename > class Matrix, typename C >
Tensor< Matrix, C > mptensor::extend |
( |
const Tensor< Matrix, C > & |
T, |
|
|
const Shape & |
shape_new |
|
) |
| |
Extend the size of a tensor.
- Parameters
-
[in] | T | Tensor to be extended. |
[in] | shape_new | New shape. |
- Returns
- Extended tensor.
- Note
- New shape should be larger than the original shape.
◆ reshape()
template<template< typename > class Matrix, typename C >
Tensor< Matrix, C > mptensor::reshape |
( |
const Tensor< Matrix, C > & |
T, |
|
|
const Shape & |
shape_new |
|
) |
| |
Change the shape of tensor.
- Parameters
-
[in] | T | Tensor to be reshaped. |
[in] | shape_new | New shape. |
- Returns
- Reshaped tensor.
- Note
- The new shape should be compatible with the original shape. The total size of tensor does not change.
- Warning
- mptensor uses the column major, unlike NumPy.
◆ slice() [1/2]
template<template< typename > class Matrix, typename C >
Tensor< Matrix, C > mptensor::slice |
( |
const Tensor< Matrix, C > & |
T, |
|
|
const Index & |
index_begin, |
|
|
const Index & |
index_end |
|
) |
| |
Slice a tensor.
This function mimics slicing in python such as
[start:end]. If index_begin[r]==index_end[r]
, this rank is not sliced. For example,
Tensor< Matrix, C > slice(const Tensor< Matrix, C > &a, size_t n_axes, size_t i_begin, size_t i_end)
Slice a tensor.
Definition: tensor_impl.hpp:1215
Index(size_t j0)
Definition: index_constructor.hpp:11
will return T[1:4, :, 3:6].
- Parameters
-
[in] | T | Tensor to be sliced. |
[in] | index_begin | Start of indices. |
[in] | index_end | End of indices. |
- Returns
- Sliced tensor.
◆ slice() [2/2]
template<template< typename > class Matrix, typename C >
Tensor< Matrix, C > mptensor::slice |
( |
const Tensor< Matrix, C > & |
T, |
|
|
size_t |
n_axes, |
|
|
size_t |
i_begin, |
|
|
size_t |
i_end |
|
) |
| |
Slice a tensor.
This function mimics slicing in python such as
[start:end].
- Parameters
-
[in] | T | Tensor to be sliced. |
[in] | n_axes | Axes to be sliced. |
[in] | i_begin | Start of index. |
[in] | i_end | End of index. |
- Returns
- Sliced tensor.
◆ transpose() [1/2]
template<template< typename > class Matrix, typename C >
Tensor< Matrix, C > mptensor::transpose |
( |
const Tensor< Matrix, C > & |
T, |
|
|
const Axes & |
axes, |
|
|
size_t |
urank_new |
|
) |
| |
Transposition of tensor without lazy evaluation.
When axes=
[1,2,0], \( T_{ijk} \) is transformed into \( T_{jki} \).
- Parameters
-
[in] | T | Tensor to be transposed. |
[in] | axes | Order of axes. |
[in] | urank_new | Upper rank of new tensor. |
- Returns
- Transposed tensor
- Note
- This function may cause communications.
◆ transpose() [2/2]
template<template< typename > class Matrix, typename C >
Tensor< Matrix, C > mptensor::transpose |
( |
Tensor< Matrix, C > |
T, |
|
|
const Axes & |
axes |
|
) |
| |
|
inline |
Transposition of tensor with lazy evaluation.
When axes=
[1,2,0], \( T_{ijk} \) is transformed into \( T_{jki} \).
- Parameters
-
[in] | T | Tensor to be transposed. |
[in] | axes | Order of axes |
- Returns
- Transposed tensor