mptensor
v0.3.0
Parallel Library for Tensor Network Methods
|
template<template< typename > class Matrix, typename C > | |
int | mptensor::solve (const Tensor< Matrix, C > &a, const std::vector< C > &b, std::vector< C > &x) |
Solve linear equation \( A\vec{x}=\vec{b}\). More... | |
template<template< typename > class Matrix, typename C > | |
int | mptensor::solve (const Tensor< Matrix, C > &a, const Tensor< Matrix, C > &b, Tensor< Matrix, C > &x) |
Solve linear equation \( AX=B\). More... | |
template<template< typename > class Matrix, typename C > | |
int | mptensor::solve (const Tensor< Matrix, C > &a, const Tensor< Matrix, C > &b, Tensor< Matrix, C > &x, const Axes &axes_row_a, const Axes &axes_col_a, const Axes &axes_row_b, const Axes &axes_col_b) |
Solve linear equation \( AX=B\). More... | |
Functions to solve a linear equation.
int mptensor::solve | ( | const Tensor< Matrix, C > & | a, |
const std::vector< C > & | b, | ||
std::vector< C > & | x | ||
) |
Solve linear equation \( A\vec{x}=\vec{b}\).
[in] | a | The coefficient square matrix A. |
[in] | b | (global) The right hand side vector \( \vec{b}\). |
[out] | x | (global) The solution \( \vec{x}\). |
int mptensor::solve | ( | const Tensor< Matrix, C > & | a, |
const Tensor< Matrix, C > & | b, | ||
Tensor< Matrix, C > & | x, | ||
const Axes & | axes_row_a, | ||
const Axes & | axes_col_a, | ||
const Axes & | axes_row_b, | ||
const Axes & | axes_col_b | ||
) |
Solve linear equation \( AX=B\).
[in] | a | The coefficient tensor A, which is a square matrix after matricization. |
[in] | b | The right hand side tensor B. |
[out] | x | The solution X. |
[in] | axes_row_a | Axes in A to reorder to the left. |
[in] | axes_col_a | Axes in A to reorder to the right. |
[in] | axes_row_b | Axes in B to reorder to the left. |
[in] | axes_col_b | Axes in B to reorder to the right. |
The last four arguments define the way of matricization of tensors, A and B. The order of axes in solution X is deterimined by axes_col_a
and axes_col_b
.
An equation \( \sum_{ik} A_{ijkl}X_{ikm} = B_{mlj} \) can be solved by
where the equation after reordering is written as \(\sum_{ik} A'_{(jl),(ik)}X_{(ik),(m)} = B'_{(jl),(m)} \).
The length of axes_col_b
may be zero. For example,
solves \( \sum_{kl} A_{ijkl} X_{kl} = B_{ij} \).