Skip to content

Commit cd7d45a

Browse files
committed
Move solve and svd into nda::linalg namespace
1 parent af08a10 commit cd7d45a

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

c++/nda/linalg/matmul.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ namespace nda {
5757
static constexpr bool is_valid_gemm_triple = []() {
5858
using blas::has_F_layout;
5959
if constexpr (has_F_layout<C>) {
60-
return !(conj_A and has_F_layout<A>)and!(conj_B and has_F_layout<B>);
60+
return !(conj_A and has_F_layout<A>) and !(conj_B and has_F_layout<B>);
6161
} else {
62-
return !(conj_B and !has_F_layout<B>)and!(conj_A and !has_F_layout<A>);
62+
return !(conj_B and !has_F_layout<B>) and !(conj_A and !has_F_layout<A>);
6363
}
6464
}();
6565

c++/nda/linalg/solve.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
#include <type_traits>
3838

39-
namespace nda {
39+
namespace nda::linalg {
4040

4141
/**
4242
* @addtogroup linalg_tools
@@ -107,4 +107,4 @@ namespace nda {
107107

108108
/** @} */
109109

110-
} // namespace nda
110+
} // namespace nda::linalg

c++/nda/linalg/svd.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <tuple>
3737
#include <type_traits>
3838

39-
namespace nda {
39+
namespace nda::linalg {
4040

4141
/**
4242
* @addtogroup linalg_tools
@@ -49,7 +49,7 @@ namespace nda {
4949
template <MemoryMatrix A>
5050
requires(is_blas_lapack_v<get_value_t<A>>)
5151
auto svd_in_place(A &&a) { // NOLINT (temporary views are allowed here)
52-
using layout_policy = detail::layout_to_policy<typename std::remove_cvref_t<A>::layout_t>::type;
52+
using layout_policy = nda::detail::layout_to_policy<typename std::remove_cvref_t<A>::layout_t>::type;
5353
constexpr auto addr_space = mem::get_addr_space<A>;
5454

5555
// vector s and matrices U and V^H
@@ -95,4 +95,4 @@ namespace nda {
9595

9696
/** @} */
9797

98-
} // namespace nda
98+
} // namespace nda::linalg

test/c++/nda_linear_algebra.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,12 +407,12 @@ void test_solve() {
407407
EXPECT_ARRAY_NEAR(matrix_t{A * X}, B);
408408

409409
// solve A * X = B using solve
410-
auto X2 = nda::solve(A, B);
410+
auto X2 = nda::linalg::solve(A, B);
411411
EXPECT_ARRAY_NEAR(matrix_t{A * X2}, B);
412412
EXPECT_ARRAY_NEAR(X, X2);
413413

414414
// solve A * x = b using solve
415-
auto x = nda::solve(A, B(nda::range::all, 0));
415+
auto x = nda::linalg::solve(A, B(nda::range::all, 0));
416416
EXPECT_ARRAY_NEAR(A * x, B(nda::range::all, 0));
417417
EXPECT_ARRAY_NEAR(X(nda::range::all, 0), x);
418418
}
@@ -433,7 +433,7 @@ void test_svd() {
433433
auto s = nda::vector<double>{12, 3};
434434

435435
// compute the SVD of A
436-
auto [U_1, s_1, VH_1] = nda::svd(A);
436+
auto [U_1, s_1, VH_1] = nda::linalg::svd(A);
437437
auto S_1 = matrix_t::zeros(A.shape());
438438
diagonal(S_1) = s_1;
439439
EXPECT_ARRAY_NEAR(s_1, s, 1e-14);

0 commit comments

Comments
 (0)