<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
laset.hpp
Go to the documentation of this file.
1
5//
6// Copyright (c) 2021-2023, University of Colorado Denver. All rights reserved.
7//
8// This file is part of <T>LAPACK.
9// <T>LAPACK is free software: you can redistribute it and/or modify it under
10// the terms of the BSD 3-Clause license. See the accompanying LICENSE file.
11
12#ifndef TLAPACK_LEGACY_LASET_HH
13#define TLAPACK_LEGACY_LASET_HH
14
16
17namespace tlapack {
18namespace legacy {
19
38 template <class uplo_t, typename TA>
39 void laset(
40 uplo_t uplo, idx_t m, idx_t n, TA alpha, TA beta, TA* A, idx_t lda)
41 {
42 using internal::create_matrix;
43
44 // check arguments
45 tlapack_check_false(uplo != Uplo::Lower && uplo != Uplo::Upper &&
46 uplo != Uplo::General);
47
48 // quick return
49 if (m <= 0 || n <= 0) return;
50
51 // Matrix views
52 auto A_ = create_matrix<TA>(A, m, n, lda);
53
54 return laset(uplo, alpha, beta, A_);
55 }
56
76 template <typename TA>
77 void laset(MatrixType matrixtype,
78 idx_t m,
79 idx_t n,
80 TA alpha,
81 TA beta,
82 TA* A,
83 idx_t lda)
84 {
85 if (matrixtype == MatrixType::Upper) {
87 }
88 else if (matrixtype == MatrixType::Lower) {
90 }
91 else {
92 laset(GENERAL, m, n, alpha, beta, A, lda);
93 }
94 }
95
96} // namespace legacy
97} // namespace tlapack
98
99#endif // TLAPACK_LEGACY_LASET_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::GeneralAccess GENERAL
General access.
Definition types.hpp:175
void laset(uplo_t uplo, const type_t< matrix_t > &alpha, const type_t< matrix_t > &beta, matrix_t &A)
Initializes a matrix to diagonal and off-diagonal values.
Definition laset.hpp:38
#define tlapack_check_false(cond)
Throw an error if cond is true.
Definition exceptionHandling.hpp:113
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