10#ifndef TLAPACK_STARPU_HH
11#define TLAPACK_STARPU_HH
37constexpr T
conj(
const starpu::MatrixEntry<T>&
x)
noexcept
63constexpr auto nrows(
const starpu::Matrix<T>&
A)
noexcept
69constexpr auto ncols(
const starpu::Matrix<T>&
A)
noexcept
75constexpr auto size(
const starpu::Matrix<T>&
A)
noexcept
77 return A.nrows() *
A.ncols();
83#define isSlice(SliceSpec) \
84 std::is_convertible<SliceSpec, \
85 std::tuple<starpu::idx_t, starpu::idx_t>>::value
93constexpr auto slice(
const starpu::Matrix<T>&
A,
99 const idx_t row0 = std::get<0>(rows);
100 const idx_t col0 = std::get<0>(cols);
101 const idx_t
row1 = std::get<1>(rows);
102 const idx_t
col1 = std::get<1>(cols);
104 return A.map_to_const_tiles(row0,
row1, col0,
col1);
112constexpr auto slice(starpu::Matrix<T>&
A,
118 const idx_t row0 = std::get<0>(rows);
119 const idx_t col0 = std::get<0>(cols);
120 const idx_t
row1 = std::get<1>(rows);
121 const idx_t
col1 = std::get<1>(cols);
123 return A.map_to_tiles(row0,
row1, col0,
col1);
128template <
class T,
class SliceSpec>
129constexpr auto slice(
const starpu::Matrix<T>&
v,
131 starpu::idx_t
colIdx)
noexcept
133 return slice(
v, std::forward<SliceSpec>(
range),
136template <
class T,
class SliceSpec>
137constexpr auto slice(starpu::Matrix<T>&
v,
139 starpu::idx_t
colIdx)
noexcept
141 return slice(
v, std::forward<SliceSpec>(
range),
145template <
class T,
class SliceSpec>
146constexpr auto slice(
const starpu::Matrix<T>&
v,
151 std::forward<SliceSpec>(
range));
153template <
class T,
class SliceSpec>
154constexpr auto slice(starpu::Matrix<T>&
v,
159 std::forward<SliceSpec>(
range));
162template <
class T,
class SliceSpec>
163constexpr auto slice(
const starpu::Matrix<T>&
v,
SliceSpec&&
range)
noexcept
165 assert((
v.nrows() <= 1 ||
v.ncols() <= 1) &&
"Matrix is not a vector");
168 return slice(
v, std::forward<SliceSpec>(
range), std::make_tuple(0, 1));
170 return slice(
v, std::make_tuple(0, 1), std::forward<SliceSpec>(
range));
172template <
class T,
class SliceSpec>
175 assert((
v.nrows() <= 1 ||
v.ncols() <= 1) &&
"Matrix is not a vector");
178 return slice(
v, std::forward<SliceSpec>(
range), std::make_tuple(0, 1));
180 return slice(
v, std::make_tuple(0, 1), std::forward<SliceSpec>(
range));
184constexpr auto col(
const starpu::Matrix<T>&
A, starpu::idx_t
colIdx)
noexcept
186 return slice(
A, std::make_tuple(0,
A.nrows()),
190constexpr auto col(starpu::Matrix<T>&
A, starpu::idx_t
colIdx)
noexcept
192 return slice(
A, std::make_tuple(0,
A.nrows()),
196template <
class T,
class SliceSpec>
197constexpr auto cols(
const starpu::Matrix<T>&
A,
SliceSpec&& cols)
noexcept
199 return slice(
A, std::make_tuple(0,
A.nrows()),
200 std::forward<SliceSpec>(cols));
202template <
class T,
class SliceSpec>
203constexpr auto cols(starpu::Matrix<T>&
A,
SliceSpec&& cols)
noexcept
205 return slice(
A, std::make_tuple(0,
A.nrows()),
206 std::forward<SliceSpec>(cols));
210constexpr auto row(
const starpu::Matrix<T>&
A, starpu::idx_t
rowIdx)
noexcept
213 std::make_tuple(0,
A.ncols()));
216constexpr auto row(starpu::Matrix<T>&
A, starpu::idx_t
rowIdx)
noexcept
219 std::make_tuple(0,
A.ncols()));
222template <
class T,
class SliceSpec>
223constexpr auto rows(
const starpu::Matrix<T>&
A,
SliceSpec&& rows)
noexcept
225 return slice(
A, std::forward<SliceSpec>(rows),
226 std::make_tuple(0,
A.ncols()));
228template <
class T,
class SliceSpec>
229constexpr auto rows(starpu::Matrix<T>&
A,
SliceSpec&& rows)
noexcept
231 return slice(
A, std::forward<SliceSpec>(rows),
232 std::make_tuple(0,
A.ncols()));
236constexpr auto diag(
const starpu::Matrix<T>&
A,
int diagIdx = 0)
238 throw std::runtime_error(
"Not implemented");
242constexpr auto diag(starpu::Matrix<T>&
A,
int diagIdx = 0)
244 throw std::runtime_error(
"Not implemented");
250 template <
class TA,
class TB>
256 template <
class TA,
class TB>
268 starpu::idx_t n = 1)
const
278 template <
class U,
int m,
int n>
280 static_assert(m >= 0 && n >= -1);
285 constexpr int Cols_ = (n == -1) ? 1 : n;
Class for representing a matrix in StarPU that is split into tiles.
Definition Matrix.hpp:134
Sort the numbers in D in increasing order (if ID = 'I') or in decreasing order (if ID = 'D' ).
Definition arrayTraits.hpp:15
typename traits::real_type_traits< Types..., int >::type real_type
The common real type of the list of types.
Definition scalar_type_traits.hpp:113
constexpr real_type< T > real(const T &x) noexcept
Extends std::real() to real datatypes.
Definition utils.hpp:71
constexpr T conj(const T &x) noexcept
Extends std::conj() to real datatypes.
Definition utils.hpp:100
constexpr auto diag(T &A, int diagIdx=0) noexcept
Get the Diagonal of an Eigen Matrix.
Definition eigen.hpp:576
constexpr real_type< T > imag(const T &x) noexcept
Extends std::imag() to real datatypes.
Definition utils.hpp:86
Functor for data creation.
Definition arrayTraits.hpp:89
constexpr auto operator()(std::vector< T > &v, idx_t m, idx_t n=1) const
Creates a m-by-n matrix with entries of type T.
Definition arrayTraits.hpp:105
Functor for data creation with static size.
Definition arrayTraits.hpp:141
constexpr auto operator()(T *v) const
Creates a m-by-n matrix or, if n == -1, a vector of size m.
Definition arrayTraits.hpp:157
Complex type traits for the list of types Types.
Definition scalar_type_traits.hpp:145
Matrix type deduction.
Definition arrayTraits.hpp:176
Real type traits for the list of types Types.
Definition scalar_type_traits.hpp:71
Vector type deduction.
Definition arrayTraits.hpp:203