29#ifndef _TENSOR_RSVD_IMPL_HPP_
30#define _TENSOR_RSVD_IMPL_HPP_
43namespace random_tensor {
49template <
typename tensor_t>
51 const size_t n = t.local_size();
52 for (
size_t i = 0;
i <
n; ++
i) {
81template <
template <
typename>
class Matrix,
typename C>
89 const size_t rank = a.
rank();
124template <
template <
typename>
class Matrix,
typename C>
150template <
template <
typename>
class Matrix,
typename C,
typename Func1,
183template <
template <
typename>
class Matrix,
typename C,
typename Func1,
void resize(size_t n)
Definition index.hpp:81
size_t rank() const
Rank of tensor.
Definition tensor_impl.hpp:164
const comm_type & get_comm() const
Communicator.
Definition tensor_impl.hpp:216
Define the type of a complex number.
std::complex< double > complex
Definition complex.hpp:38
int svd(const Tensor< Matrix, C > &a, std::vector< double > &s)
Singular value decomposition for rank-2 tensor (matrix)
Definition tensor_impl.hpp:1722
int qr(const Tensor< Matrix, C > &a, Tensor< Matrix, C > &q, Tensor< Matrix, C > &r)
QR decomposition of matrix (rank-2 tensor)
Definition tensor_impl.hpp:1974
Tensor< Matrix, C > tensordot(const Tensor< Matrix, C > &a, const Tensor< Matrix, C > &b, const Axes &axes_a, const Axes &axes_b)
Compute tensor dot product.
Definition tensor_impl.hpp:1648
Tensor< Matrix, C > conj(Tensor< Matrix, C > t)
Take conjugate of each element.
int 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.
Definition rsvd_impl.hpp:82
void set_seed(unsigned int seed)
Set seed for random number generator.
Definition rsvd_impl.hpp:197
Tensor< Matrix, C > transpose(Tensor< Matrix, C > a, const Axes &axes)
Transposition of tensor with lazy evaluation.
Definition tensor_impl.hpp:1041
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
header file of Index class
List of header files for matrix classes.
mptensor::complex complex
Definition matrix_lapack.cc:36
bool check_svd_axes(const Axes &axes_row, const Axes &axes_col, size_t rank)
Definition tensor.cc:76
void set_seed(unsigned int seed)
void fill(tensor_t &t)
Definition rsvd_impl.hpp:50
Definition complex.hpp:34
Index range(const size_t start, const size_t stop)
Create an increasing sequence. it is similar to range() in python.
Definition index.cc:91
Index Axes
Definition tensor.hpp:45
Randomized algorithm for singular value decomposition.