mptensor
v0.3.0
Parallel Library for Tensor Network Methods
|
template<template< typename > class Matrix, typename C > | |
int | mptensor::rsvd (const Tensor< Matrix, C > &a, const Axes &axes_row, const Axes &axes_col, Tensor< Matrix, C > &u, std::vector< double > &s, Tensor< Matrix, C > &vt, const size_t target_rank, const size_t oversamp) |
Singular value decomposition by randomized algorithm. More... | |
template<template< typename > class Matrix, typename C > | |
int | mptensor::rsvd (const Tensor< Matrix, C > &a, const Axes &axes_row, const Axes &axes_col, Tensor< Matrix, C > &u, std::vector< double > &s, Tensor< Matrix, C > &vt, const size_t target_rank) |
RSVD with oversamp = target_rank . More... | |
template<template< typename > class Matrix, typename C , typename Func1 , typename Func2 > | |
int | mptensor::rsvd (Func1 &multiply_row, Func2 &multiply_col, const Shape &shape_row, const Shape &shape_col, Tensor< Matrix, C > &u, std::vector< double > &s, Tensor< Matrix, C > &vt, const size_t target_rank, const size_t oversamp) |
Singular value decomposition by randomized algorithm. More... | |
template<template< typename > class Matrix, typename C , typename Func1 , typename Func2 > | |
int | mptensor::rsvd (Func1 &multiply_row, Func2 &multiply_col, const Shape &shape_row, const Shape &shape_col, Tensor< Matrix, C > &u, std::vector< double > &s, Tensor< Matrix, C > &vt, const size_t target_rank) |
RSVD with oversamp = target_rank . More... | |
void | mptensor::set_seed (unsigned int seed) |
Set seed for random number generator. More... | |
Function to decompose a tensor by randomized algorithms.
int mptensor::rsvd | ( | const Tensor< Matrix, C > & | a, |
const Axes & | axes_row, | ||
const Axes & | axes_col, | ||
Tensor< Matrix, C > & | u, | ||
std::vector< double > & | s, | ||
Tensor< Matrix, C > & | vt, | ||
const size_t | target_rank | ||
) |
RSVD with oversamp
= target_rank
.
int mptensor::rsvd | ( | const Tensor< Matrix, C > & | a, |
const Axes & | axes_row, | ||
const Axes & | axes_col, | ||
Tensor< Matrix, C > & | u, | ||
std::vector< double > & | s, | ||
Tensor< Matrix, C > & | vt, | ||
const size_t | target_rank, | ||
const size_t | oversamp | ||
) |
Singular value decomposition by randomized algorithm.
For example,
calculates the following decomposition.
\[ A_{abcd} \simeq \sum_{i=0}^{k-1} U_{adi} S_i (V^\dagger)_{ibc}, \]
where \( k \) is the target rank.
[in] | a | A tensor to be decomposed. |
[in] | axes_row | Axes for left singular vectors. |
[in] | axes_col | Axes for right singular vectors. |
[out] | u | Tensor \( U \) corresponds to left signular vectors. |
[out] | s | Singluar values. |
[out] | vt | Tensor \( V^\dagger \) corresponds to right singular vectors. |
[in] | target_rank | The number of singular values to be calculated |
[in] | oversamp | Oversampling parameter for randomized algorithm |
int mptensor::rsvd | ( | Func1 & | multiply_row, |
Func2 & | multiply_col, | ||
const Shape & | shape_row, | ||
const Shape & | shape_col, | ||
Tensor< Matrix, C > & | u, | ||
std::vector< double > & | s, | ||
Tensor< Matrix, C > & | vt, | ||
const size_t | target_rank | ||
) |
RSVD with oversamp
= target_rank
.
int mptensor::rsvd | ( | Func1 & | multiply_row, |
Func2 & | multiply_col, | ||
const Shape & | shape_row, | ||
const Shape & | shape_col, | ||
Tensor< Matrix, C > & | u, | ||
std::vector< double > & | s, | ||
Tensor< Matrix, C > & | vt, | ||
const size_t | target_rank, | ||
const size_t | oversamp | ||
) |
Singular value decomposition by randomized algorithm.
[in] | multiply_row | A function object which takes a Tensor with Shape(shape_col+[target_rank+oversamp]) and returns a Tensor with Shape(shape_row+[target_rank+oversamp]) . |
[in] | multiply_col | A function object which takes a Tensor with Shape([target_rank+oversamp]+shape_row) and returns a Tensor with Shape([target_rank+oversamp]+shape_col) . |
[in] | shape_row | Shape of row indices. |
[in] | shape_col | Shape of column indices. |
[out] | u | Tensor \( U \) corresponds to left singular vectors. Its shape is Shape(shape_row+[target_rank]) . |
[out] | s | Singular values. |
[out] | vt | Tensor \( V^\dagger \) corresponds to right singular vectors. Its shape is Shape([target_rank]+shape_col) . |
[in] | target_rank | The number of singular values to be calculated |
[in] | oversamp | Oversampling parameter for randomized algorithm |
|
inline |
Set seed for random number generator.
[in] | seed | Value of seed. |