<T>LAPACK 0.1.2
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
trmm.hpp
Go to the documentation of this file.
1
3//
4// Copyright (c) 2017-2021, University of Tennessee. All rights reserved.
5// Copyright (c) 2025, University of Colorado Denver. All rights reserved.
6//
7// This file is part of <T>LAPACK.
8// <T>LAPACK is free software: you can redistribute it and/or modify it under
9// the terms of the BSD 3-Clause license. See the accompanying LICENSE file.
10
11#ifndef TLAPACK_LEGACY_TRMM_HH
12#define TLAPACK_LEGACY_TRMM_HH
13
14#include "tlapack/blas/trmm.hpp"
17
18namespace tlapack {
19namespace legacy {
20
97 template <typename TA, typename TB>
99 Side side,
100 Uplo uplo,
101 Op trans,
102 Diag diag,
103 idx_t m,
104 idx_t n,
106 TA const* A,
107 idx_t lda,
108 TB* B,
109 idx_t ldb)
110 {
111 using internal::create_matrix;
113
114 // check arguments
122 tlapack_check_false(m < 0);
123 tlapack_check_false(n < 0);
124 tlapack_check_false(lda < ((side == Side::Left) ? m : n));
126
127 // quick return
128 if (m == 0 || n == 0) return;
129
130 // adapt if row major
131 if (layout == Layout::RowMajor) {
133 if (uplo == Uplo::Lower)
135 else if (uplo == Uplo::Upper)
137 std::swap(m, n);
138 }
139
140 // Matrix views
141 const auto A_ = (side == Side::Left)
142 ? create_matrix<TA>((TA*)A, m, m, lda)
143 : create_matrix<TA>((TA*)A, n, n, lda);
144 auto B_ = create_matrix<TB>(B, m, n, ldb);
145
146 if (alpha == scalar_t(0))
147 for (idx_t j = 0; j < n; ++j)
148 for (idx_t i = 0; i < m; ++i)
149 B_(i, j) = TB(0);
150 else
151 trmm(side, uplo, trans, diag, alpha, A_, B_);
152 }
153
154} // namespace legacy
155} // namespace tlapack
156
157#endif // #ifndef TLAPACK_LEGACY_TRMM_HH
#define tlapack_check_false(cond)
Throw an error if cond is true.
Definition exceptionHandling.hpp:113
void trmm(Layout layout, Side side, Uplo uplo, Op trans, Diag diag, idx_t m, idx_t n, scalar_type< TA, TB > alpha, TA const *A, idx_t lda, TB *B, idx_t ldb)
Triangular matrix-matrix multiply:
Definition trmm.hpp:98
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
Diag
Definition types.hpp:197
@ Unit
The main diagonal is assumed to consist of 1's.
@ NonUnit
The main diagonal is not assumed to consist of 1's.
Side
Definition types.hpp:271
@ Right
right side
@ Left
left side
constexpr auto diag(T &A, int diagIdx=0) noexcept
Get the Diagonal of an Eigen Matrix.
Definition eigen.hpp:576
Op
Definition types.hpp:227
@ Trans
transpose
@ NoTrans
no transpose
@ ConjTrans
conjugate transpose
Uplo
Definition types.hpp:50
@ Upper
0 <= i <= j, 0 <= j <= n.
@ Lower
0 <= i <= m, 0 <= j <= i.
constexpr Layout layout
Layout of a matrix or vector.
Definition arrayTraits.hpp:232
Layout
Definition types.hpp:29
@ ColMajor
Column-major layout.
@ RowMajor
Row-major layout.