fml
0.1-0
Fused Matrix Library
xpose.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_XPOSE_H
6
#define FML_MPI_LINALG_XPOSE_H
7
#pragma once
8
9
10
#include <stdexcept>
11
12
#include "../../_internals/linalgutils.hh"
13
14
#include "../mpimat.hh"
15
16
#include "internals/err.hh"
17
#include "internals/pblas.hh"
18
19
20
namespace
fml
21
{
22
namespace
linalg
23
{
42
template
<
typename
REAL>
43
void
xpose
(
const
mpimat<REAL>
&x,
mpimat<REAL>
&tx)
44
{
45
err::check_grid(x, tx);
46
47
const
len_t m = x.
nrows
();
48
const
len_t n = x.
ncols
();
49
50
if
(m != tx.
ncols
() || n != tx.
nrows
())
51
tx.
resize
(n, m);
52
53
fml::pblas::tran(n, m, 1.f, x.
data_ptr
(), x.desc_ptr(), 0.f, tx.
data_ptr
(), tx.desc_ptr());
54
}
55
56
57
59
template
<
typename
REAL>
60
mpimat<REAL>
xpose
(
const
mpimat<REAL>
&x)
61
{
62
const
len_t m = x.
nrows
();
63
const
len_t n = x.
ncols
();
64
const
grid
g = x.get_grid();
65
66
mpimat<REAL>
tx(g, n, m, x.bf_rows(), x.bf_cols());
67
xpose
(x, tx);
68
return
tx;
69
}
70
}
71
}
72
73
74
#endif
fml::mpimat::resize
void resize(len_t nrows, len_t ncols)
Resize the internal object storage.
Definition:
mpimat.hh:326
fml::grid
2-dimensional MPI process grid.
Definition:
grid.hh:70
fml::mpimat
Matrix class for data distributed over MPI in the 2-d block cyclic format.
Definition:
mpimat.hh:40
fml::linalg::xpose
void xpose(const cpumat< REAL > &x, cpumat< REAL > &tx)
Computes the transpose out-of-place (i.e. in a copy).
Definition:
xpose.hh:37
fml::unimat::nrows
len_t nrows() const
Number of rows.
Definition:
unimat.hh:36
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
xpose.hh
Generated by
1.8.17