mptensor
v0.3.0
Parallel Library for Tensor Network Methods
|
Modules | |
Decompositions | |
Linear equation | |
template<template< typename > class Matrix, typename C > | |
C | mptensor::trace (const Tensor< Matrix, C > &M) |
Trace of matrix (rank-2 tensor) More... | |
template<template< typename > class Matrix, typename C > | |
C | mptensor::trace (const Tensor< Matrix, C > &T, const Axes &axes_1, const Axes &axes_2) |
Full trace of tensor. More... | |
template<template< typename > class Matrix, typename C > | |
C | mptensor::trace (const Tensor< Matrix, C > &A, const Tensor< Matrix, C > &B, const Axes &axes_a, const Axes &axes_b) |
Full contraction of two tensors. More... | |
template<template< typename > class Matrix, typename C > | |
Tensor< Matrix, C > | mptensor::contract (const Tensor< Matrix, C > &T, const Axes &axes_1, const Axes &axes_2) |
Partial trace of tensor. More... | |
template<template< typename > class Matrix, typename C > | |
Tensor< Matrix, C > | mptensor::tensordot (const Tensor< Matrix, C > &a, const Tensor< Matrix, C > &b, const Axes &axes_a, const Axes &axes_b) |
Compute tensor dot product. More... | |
template<template< typename > class Matrix, typename C > | |
Tensor< Matrix, C > | mptensor::kron (const Tensor< Matrix, C > &a, const Tensor< Matrix, C > &b) |
Compute the Kronecker product. More... | |
Operations for linear algebra.
Tensor< Matrix, C > mptensor::contract | ( | const Tensor< Matrix, C > & | T, |
const Axes & | axes_1, | ||
const Axes & | axes_2 | ||
) |
Partial trace of tensor.
axes_1
[k] and axes_2
[k] are contracted. For example.
returns \( B_{ab} = \sum_{ij} A_{iajbji} \).
T | Tensor to partially trace. |
axes_1 | Axes to trace. |
axes_2 | Axes to trace. |
Tensor< Matrix, C > mptensor::kron | ( | const Tensor< Matrix, C > & | a, |
const Tensor< Matrix, C > & | b | ||
) |
Compute the Kronecker product.
If A.shape() = A[r0,...,rN] and B.shape() = B[s0,...,sN], the Kronecker product has shape [r0*s0,..., rN*sN]. Each element is given as
where
a
and b
should be the same.Tensor< Matrix, C > mptensor::tensordot | ( | const Tensor< Matrix, C > & | a, |
const Tensor< Matrix, C > & | b, | ||
const Axes & | axes_a, | ||
const Axes & | axes_b | ||
) |
Compute tensor dot product.
For example, \( T_{abcd} = \sum_{ij} A_{iajb} B_{cjdi} \) is
a | Tensor. |
b | Tensor. |
axes_a | Axes of tensor a to contract. |
axes_b | Axes of tensor b to contract. |
C mptensor::trace | ( | const Tensor< Matrix, C > & | A, |
const Tensor< Matrix, C > & | B, | ||
const Axes & | axes_a, | ||
const Axes & | axes_b | ||
) |
Full contraction of two tensors.
axes_a
[k] and axes_b
[k] are contracted. For example,
returns \( \sum_{ijk} A_{ijk} B_{kij} \).
A | Tensor to contract. |
B | Tensor to contract. |
axes_a | Axes order of tensor A . |
axes_b | Axes order of tensor B . |
C mptensor::trace | ( | const Tensor< Matrix, C > & | M | ) |
Trace of matrix (rank-2 tensor)
M | Rank-2 tensor |