mptensor  v0.3.0
Parallel Library for Tensor Network Methods
rsvd.hpp
Go to the documentation of this file.
1 /*
2  mptensor - Parallel Library for Tensor Network Methods
3 
4  Copyright 2016 Satoshi Morita
5 
6  mptensor is free software: you can redistribute it and/or modify it
7  under the terms of the GNU Lesser General Public License as
8  published by the Free Software Foundation, either version 3 of the
9  License, or (at your option) any later version.
10 
11  mptensor is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with mptensor. If not, see
18  <https://www.gnu.org/licenses/>.
19 */
20 
29 #ifndef _TENSOR_RSVD_HPP_
30 #define _TENSOR_RSVD_HPP_
31 
32 #include "tensor.hpp"
33 
34 namespace mptensor {
35 
38 template <template <typename> class Matrix, typename C>
39 int rsvd(const Tensor<Matrix, C> &a, const Axes &axes_row, const Axes &axes_col,
40  Tensor<Matrix, C> &u, std::vector<double> &s, Tensor<Matrix, C> &vt,
41  const size_t target_rank, const size_t oversamp);
42 
43 template <template <typename> class Matrix, typename C>
44 int rsvd(const Tensor<Matrix, C> &a, const Axes &axes_row, const Axes &axes_col,
45  Tensor<Matrix, C> &u, std::vector<double> &s, Tensor<Matrix, C> &vt,
46  const size_t target_rank);
47 
48 template <template <typename> class Matrix, typename C, typename Func1,
49  typename Func2>
50 int rsvd(Func1 &multiply_row, Func2 &multiply_col, const Shape &shape_row,
51  const Shape &shape_col, Tensor<Matrix, C> &u, std::vector<double> &s,
52  Tensor<Matrix, C> &vt, const size_t target_rank,
53  const size_t oversamp);
54 
55 template <template <typename> class Matrix, typename C, typename Func1,
56  typename Func2>
57 int rsvd(Func1 &multiply_row, Func2 &multiply_col, const Shape &shape_row,
58  const Shape &shape_col, Tensor<Matrix, C> &u, std::vector<double> &s,
59  Tensor<Matrix, C> &vt, const size_t target_rank);
60 
61 inline void set_seed(unsigned int seed);
63 
64 } // namespace mptensor
65 
66 #include "rsvd_impl.hpp"
67 #endif // _TENSOR_RSVD_HPP_
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
Definition: complex.hpp:34
Index Shape
Definition: tensor.hpp:46
Index Axes
Definition: tensor.hpp:45
Implementation of RSVD.
Tensor class.