<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
ul_mult.hpp
Go to the documentation of this file.
1
3//
4// Copyright (c) 2021-2023, University of Colorado Denver. All rights reserved.
5//
6// This file is part of <T>LAPACK.
7// <T>LAPACK is free software: you can redistribute it and/or modify it under
8// the terms of the BSD 3-Clause license. See the accompanying LICENSE file.
9
10#ifndef TLAPACK_ul_mult_HH
11#define TLAPACK_ul_mult_HH
12
14#include "tlapack/blas/gemm.hpp"
15#include "tlapack/blas/trmm.hpp"
16
17namespace tlapack {
18
33template <TLAPACK_SMATRIX matrix_t>
35{
36 using idx_t = size_type<matrix_t>;
37 using T = type_t<matrix_t>;
39
40 // check arguments
41 tlapack_check(nrows(A) == ncols(A));
42
43 // constant
44 const idx_t n = ncols(A);
45
46 // if L and U are 1-by-1, then L is 1 and we simply UL=A(0,0)
47 if (n == 1) return 0;
48
49 // if n>1
50 idx_t n0 = n / 2;
51
52 // break A into four parts
53 auto A00 = tlapack::slice(A, range(0, n0), range(0, n0));
54 auto A10 = tlapack::slice(A, range(n0, n), range(0, n0));
55 auto A01 = tlapack::slice(A, range(0, n0), range(n0, n));
56 auto A11 = tlapack::slice(A, range(n0, n), range(n0, n));
57
58 // calculate top left corner
59 ul_mult(A00);
60 tlapack::gemm(NO_TRANS, NO_TRANS, T(1), A01, A10, T(1), A00);
61
62 // calculate bottom left corner
64 A10);
65
66 // calculate top right
68 A01);
69
70 // calculate bottom right
71 ul_mult(A11);
72
73 return 0;
74
75} // ul_mult
76
77} // namespace tlapack
78
79#endif // TLAPACK_ul_mult_HH
constexpr internal::LowerTriangle LOWER_TRIANGLE
Lower Triangle access.
Definition types.hpp:183
constexpr internal::UpperTriangle UPPER_TRIANGLE
Upper Triangle access.
Definition types.hpp:181
constexpr internal::RightSide RIGHT_SIDE
right side
Definition types.hpp:291
constexpr internal::UnitDiagonal UNIT_DIAG
The main diagonal is assumed to consist of 1's.
Definition types.hpp:217
constexpr internal::NonUnitDiagonal NON_UNIT_DIAG
The main diagonal is not assumed to consist of 1's.
Definition types.hpp:215
constexpr internal::NoTranspose NO_TRANS
no transpose
Definition types.hpp:255
constexpr internal::LeftSide LEFT_SIDE
left side
Definition types.hpp:289
int ul_mult(matrix_t &A)
ul_mult computes the matrix product of an upper triangular matrix U and a lower triangular unital mat...
Definition ul_mult.hpp:34
void trmm(Side side, Uplo uplo, Op trans, Diag diag, const alpha_t &alpha, const matrixA_t &A, matrixB_t &B)
Triangular matrix-matrix multiply:
Definition trmm.hpp:72
void gemm(Op transA, Op transB, const alpha_t &alpha, const matrixA_t &A, const matrixB_t &B, const beta_t &beta, matrixC_t &C)
General matrix-matrix multiply:
Definition gemm.hpp:61
#define tlapack_check(cond)
Throw an error if cond is false.
Definition exceptionHandling.hpp:98
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