fml
0.1-0
Fused Matrix Library
lu.hh
1
// This file is part of fml which is released under the Boost Software
2
// License, Version 1.0. See accompanying file LICENSE or copy at
3
// https://www.boost.org/LICENSE_1_0.txt
4
5
#ifndef FML_MPI_LINALG_LU_H
6
#define FML_MPI_LINALG_LU_H
7
#pragma once
8
9
10
#include "../../_internals/linalgutils.hh"
11
#include "../../cpu/cpuvec.hh"
12
13
#include "../mpimat.hh"
14
15
#include "internals/scalapack.hh"
16
17
18
namespace
fml
19
{
20
namespace
linalg
21
{
45
template
<
typename
REAL>
46
void
lu
(
mpimat<REAL>
&x,
cpuvec<int>
&p,
int
&info)
47
{
48
info = 0;
49
const
len_t m = x.
nrows
();
50
const
len_t lipiv = std::min(m, x.
ncols
());
51
52
p.
resize
(lipiv);
53
54
fml::scalapack::getrf(m, x.
ncols
(), x.
data_ptr
(), x.desc_ptr(), p.
data_ptr
(), &info);
55
}
56
58
template
<
typename
REAL>
59
void
lu
(
mpimat<REAL>
&x)
60
{
61
cpuvec<int>
p;
62
int
info;
63
64
lu
(x, p, info);
65
66
fml::linalgutils::check_info(info,
"getrf"
);
67
}
68
}
69
}
70
71
72
#endif
fml::mpimat
Matrix class for data distributed over MPI in the 2-d block cyclic format.
Definition:
mpimat.hh:40
fml::univec::data_ptr
T * data_ptr()
Pointer to the internal array.
Definition:
univec.hh:28
fml::unimat::nrows
len_t nrows() const
Number of rows.
Definition:
unimat.hh:36
fml::cpuvec::resize
void resize(len_t size)
Resize the internal object storage.
Definition:
cpuvec.hh:210
fml::linalg::lu
void lu(cpumat< REAL > &x, cpuvec< int > &p, int &info)
Computes the PLU factorization with partial pivoting.
Definition:
lu.hh:48
fml::cpuvec
Vector class for data held on a single CPU.
Definition:
cpuvec.hh:31
fml::unimat::ncols
len_t ncols() const
Number of columns.
Definition:
unimat.hh:38
fml::unimat::data_ptr
REAL * data_ptr()
Pointer to the internal array.
Definition:
unimat.hh:40
fml
Core namespace.
Definition:
dimops.hh:10
fml
src
fml
mpi
linalg
lu.hh
Generated by
1.8.17