<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
lacpy.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_LACPY_HH
13#define TLAPACK_LEGACY_LACPY_HH
14
16
17namespace tlapack {
18namespace legacy {
19
38 template <class uplo_t, typename TA, typename TB>
39 void lacpy(
40 uplo_t uplo, idx_t m, idx_t n, const TA* A, idx_t lda, TB* B, idx_t ldb)
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 // Matrix views
49 const auto A_ = create_matrix<TA>((TA*)A, m, n, lda);
50 auto B_ = create_matrix<TB>(B, m, n, ldb);
51
52 lacpy(uplo, A_, B_);
53 }
54
76 template <typename TA, typename TB>
77 void lacpy(MatrixType matrixtype,
78 idx_t m,
79 idx_t n,
80 const TA* A,
81 idx_t lda,
82 TB* B,
83 idx_t ldb)
84 {
85 if (matrixtype == MatrixType::Upper) {
86 lacpy(UPPER_TRIANGLE, m, n, A, lda, B, ldb);
87 }
88 else if (matrixtype == MatrixType::Lower) {
89 lacpy(LOWER_TRIANGLE, m, n, A, lda, B, ldb);
90 }
91 else {
92 lacpy(GENERAL, m, n, A, lda, B, ldb);
93 }
94 }
95
96} // namespace legacy
97} // namespace tlapack
98
99#endif // TLAPACK_LEGACY_LACPY_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 lacpy(uplo_t uplo, const matrixA_t &A, matrixB_t &B)
Copies a matrix from A to B.
Definition lacpy.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