lu.h
Go to the documentation of this file.
1 /*
2  * This file is a part of TiledArray.
3  * Copyright (C) 2020 Virginia Tech
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Eduard Valeyev
19  *
20  * lu.h
21  * Created: 16 October, 2020
22  *
23  */
24 #ifndef TILEDARRAY_MATH_LINALG_LU_H__INCLUDED
25 #define TILEDARRAY_MATH_LINALG_LU_H__INCLUDED
26 
27 #include <TiledArray/config.h>
28 #if TILEDARRAY_HAS_SCALAPACK
30 #endif
32 
33 namespace TiledArray::math::linalg {
34 
35 template <typename ArrayA, typename ArrayB>
36 auto lu_solve(const ArrayA& A, const ArrayB& B,
37  TiledRange x_trange = TiledRange()) {
38 #if TILEDARRAY_HAS_SCALAPACK
39  if (A.world().size() > 1 && A.range().volume() > 10000000) {
40  return scalapack::lu_solve(A, B, x_trange);
41  }
42 #endif
43  return non_distributed::lu_solve(A, B, x_trange);
44 }
45 
46 template <typename Array>
47 auto lu_inv(const Array& A, TiledRange ainv_trange = TiledRange()) {
48 #if TILEDARRAY_HAS_SCALAPACK
49  if (A.world().size() > 1 && A.range().volume() > 10000000) {
50  return scalapack::lu_inv(A, ainv_trange);
51  }
52 #endif
53  return non_distributed::lu_inv(A, ainv_trange);
54 }
55 
56 } // namespace TiledArray::math::linalg
57 
58 namespace TiledArray {
61 }
62 
63 #endif // TILEDARRAY_MATH_LINALG_LU_H__INCLUDED
auto lu_solve(const ArrayA &A, const ArrayB &B, TiledRange x_trange=TiledRange(), size_t NB=default_block_size(), size_t MB=default_block_size())
Solve a linear system via LU factorization.
Definition: lu.h:43
auto lu_solve(const ArrayA &A, const ArrayB &B, TiledRange x_trange=TiledRange())
Solve a linear system via LU factorization.
Definition: lu.h:40
auto lu_inv(const Array &A, TiledRange ainv_trange=TiledRange(), size_t NB=default_block_size(), size_t MB=default_block_size())
Invert a matrix via LU.
Definition: lu.h:90
Range data of a tiled array.
Definition: tiled_range.h:32
auto lu_inv(const Array &A, TiledRange ainv_trange=TiledRange())
Definition: lu.h:47
auto lu_solve(const ArrayA &A, const ArrayB &B, TiledRange x_trange=TiledRange())
Definition: lu.h:36
const range_type & range() const
Tile range accessor.
Definition: dist_array.h:932
Forward declarations.
Definition: dist_array.h:57
World & world() const
World accessor.
Definition: dist_array.h:1007
auto lu_inv(const Array &A, TiledRange ainv_trange=TiledRange())
Invert a matrix via LU.
Definition: lu.h:58