From e9a86718bee26e83a569516c2765408d76f345cd Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 8 Jun 2025 10:02:08 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BD=9C=E6=88=90=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python_numpy/python_numpy_linalg_solver.hpp | 200 +++++++++++++++++--- 1 file changed, 169 insertions(+), 31 deletions(-) diff --git a/python_numpy/python_numpy_linalg_solver.hpp b/python_numpy/python_numpy_linalg_solver.hpp index 7c8b964..ef845f4 100644 --- a/python_numpy/python_numpy_linalg_solver.hpp +++ b/python_numpy/python_numpy_linalg_solver.hpp @@ -164,8 +164,9 @@ class LinalgSolver { division_min(std::move(other.division_min)), rho(std::move(other.rho)), rep_num(std::move(other.rep_num)) {} - LinalgSolver &operator=( - LinalgSolver &&other) { + LinalgSolver & + operator=(LinalgSolver + &&other) noexcept { if (this != &other) { this->X_1 = std::move(other.X_1); this->decay_rate = std::move(other.decay_rate); @@ -626,7 +627,7 @@ class LinalgPartitionSolver { public: /* Constructor */ LinalgPartitionSolver() - : decay_rate(static_cast(0)), + : X_1(), decay_rate(static_cast(0)), division_min( static_cast(DEFAULT_DIVISION_MIN_LINALG_SOLVER)), rho({}), rep_num({}) {} @@ -634,13 +635,15 @@ class LinalgPartitionSolver { /* Copy Constructor */ LinalgPartitionSolver(const LinalgPartitionSolver &other) - : decay_rate(other.decay_rate), division_min(other.division_min), - rho(other.rho), rep_num(other.rep_num) {} + : X_1(other.X_1), decay_rate(other.decay_rate), + division_min(other.division_min), rho(other.rho), + rep_num(other.rep_num) {} LinalgPartitionSolver & operator=(const LinalgPartitionSolver &other) { if (this != &other) { + this->X_1 = other.X_1; this->decay_rate = other.decay_rate; this->division_min = other.division_min; this->rho = other.rho; @@ -653,7 +656,7 @@ class LinalgPartitionSolver { LinalgPartitionSolver( LinalgPartitionSolver &&other) noexcept - : decay_rate(std::move(other.decay_rate)), + : X_1(std::move(other.X_1)), decay_rate(std::move(other.decay_rate)), division_min(std::move(other.division_min)), rho(std::move(other.rho)), rep_num(std::move(other.rep_num)) {} @@ -661,6 +664,7 @@ class LinalgPartitionSolver { operator=(LinalgPartitionSolver &&other) noexcept { if (this != &other) { + this->X_1 = std::move(other.X_1); this->decay_rate = std::move(other.decay_rate); this->division_min = std::move(other.division_min); this->rho = std::move(other.rho); @@ -674,41 +678,89 @@ class LinalgPartitionSolver { const Matrix &B, std::size_t matrix_size) -> Matrix { - Base::Matrix::Matrix X_1; + if (matrix_size > M) { + matrix_size = M; + } + + Base::Matrix::gmres_k_partition_matrix( + A.matrix, B.matrix, this->X_1, this->decay_rate, this->division_min, + this->rho, this->rep_num, matrix_size); + + return Matrix(this->X_1); + } + + inline auto cold_solve(const Matrix &A, + const Matrix &B, + std::size_t matrix_size) -> Matrix { + + Base::Matrix::Matrix X_1_temporary; if (matrix_size > M) { matrix_size = M; } Base::Matrix::gmres_k_partition_matrix( - A.matrix, B.matrix, X_1, this->decay_rate, this->division_min, + A.matrix, B.matrix, X_1_temporary, this->decay_rate, this->division_min, this->rho, this->rep_num, matrix_size); - return Matrix(X_1); + return Matrix(X_1_temporary); } inline auto solve(const Matrix &A, const Matrix &B, std::size_t matrix_size) -> Matrix { - Base::Matrix::Matrix X_1; + if (matrix_size > M) { + matrix_size = M; + } + + Base::Matrix::gmres_k_partition_matrix( + A.matrix, B.matrix, this->X_1, this->decay_rate, this->division_min, + this->rho, this->rep_num, matrix_size); + + return Matrix(this->X_1); + } + + inline auto cold_solve(const Matrix &A, + const Matrix &B, + std::size_t matrix_size) -> Matrix { + + Base::Matrix::Matrix X_1_temporary; if (matrix_size > M) { matrix_size = M; } Base::Matrix::gmres_k_partition_matrix( - A.matrix, B.matrix, X_1, this->decay_rate, this->division_min, + A.matrix, B.matrix, X_1_temporary, this->decay_rate, this->division_min, this->rho, this->rep_num, matrix_size); - return Matrix(X_1); + return Matrix(X_1_temporary); } inline auto solve(const Matrix &A, const Matrix &B, std::size_t matrix_size) -> Matrix { - Base::Matrix::Matrix X_1; + if (matrix_size > M) { + matrix_size = M; + } + + Base::Matrix::Matrix B_dense_matrix = + Base::Matrix::output_dense_matrix(B.matrix); + + Base::Matrix::gmres_k_partition_matrix( + A.matrix, B_dense_matrix, this->X_1, this->decay_rate, + this->division_min, this->rho, this->rep_num, matrix_size); + + return Matrix(this->X_1); + } + + inline auto cold_solve(const Matrix &A, + const Matrix &B, + std::size_t matrix_size) -> Matrix { + + Base::Matrix::Matrix X_1_temporary; if (matrix_size > M) { matrix_size = M; @@ -718,10 +770,10 @@ class LinalgPartitionSolver { Base::Matrix::output_dense_matrix(B.matrix); Base::Matrix::gmres_k_partition_matrix( - A.matrix, B_dense_matrix, X_1, this->decay_rate, this->division_min, - this->rho, this->rep_num, matrix_size); + A.matrix, B_dense_matrix, X_1_temporary, this->decay_rate, + this->division_min, this->rho, this->rep_num, matrix_size); - return Matrix(X_1); + return Matrix(X_1_temporary); } inline auto solve(const Matrix &A, @@ -732,11 +784,25 @@ class LinalgPartitionSolver { matrix_size = M; } - Base::Matrix::Matrix X_1 = + this->X_1 = Base::Matrix::diag_inv_multiply_dense_partition( + A.matrix, B.matrix, this->division_min, matrix_size); + + return Matrix(this->X_1); + } + + inline auto cold_solve(const Matrix &A, + const Matrix &B, + std::size_t matrix_size) -> Matrix { + + if (matrix_size > M) { + matrix_size = M; + } + + Base::Matrix::Matrix X_1_temporary = Base::Matrix::diag_inv_multiply_dense_partition( A.matrix, B.matrix, this->division_min, matrix_size); - return Matrix(X_1); + return Matrix(X_1_temporary); } inline auto solve(const Matrix &A, @@ -765,35 +831,87 @@ class LinalgPartitionSolver { matrix_size = M; } + this->X_1 = Base::Matrix::output_dense_matrix( + Base::Matrix::diag_inv_multiply_sparse_partition( + A.matrix, B.matrix, this->division_min, matrix_size)); + + return Matrix(this->X_1); + } + + inline auto cold_solve(const Matrix &A, + const Matrix &B, + std::size_t matrix_size) -> Matrix { + + using RowIndices_B = RowIndicesFromSparseAvailable; + using RowPointers_B = RowPointersFromSparseAvailable; + + if (matrix_size > M) { + matrix_size = M; + } + Base::Matrix::CompiledSparseMatrix - X_1 = Base::Matrix::diag_inv_multiply_sparse_partition( + X_1_temporary = Base::Matrix::diag_inv_multiply_sparse_partition( A.matrix, B.matrix, this->division_min, matrix_size); - return Matrix(Base::Matrix::output_dense_matrix(X_1)); + return Matrix( + Base::Matrix::output_dense_matrix(X_1_temporary)); } inline auto solve(const Matrix &A, const Matrix &B, std::size_t matrix_size) -> Matrix { - Base::Matrix::Matrix X_1; + if (matrix_size > M) { + matrix_size = M; + } + + Base::Matrix::sparse_gmres_k_partition_matrix( + A.matrix, B.matrix, this->X_1, this->decay_rate, this->division_min, + this->rho, this->rep_num, matrix_size); + + return Matrix(this->X_1); + } + + inline auto cold_solve(const Matrix &A, + const Matrix &B, + std::size_t matrix_size) -> Matrix { + + Base::Matrix::Matrix X_1_temporary; if (matrix_size > M) { matrix_size = M; } Base::Matrix::sparse_gmres_k_partition_matrix( - A.matrix, B.matrix, X_1, this->decay_rate, this->division_min, + A.matrix, B.matrix, X_1_temporary, this->decay_rate, this->division_min, this->rho, this->rep_num, matrix_size); - return Matrix(X_1); + return Matrix(X_1_temporary); } inline auto solve(const Matrix &A, const Matrix &B, std::size_t matrix_size) -> Matrix { - Base::Matrix::Matrix X_1; + if (matrix_size > M) { + matrix_size = M; + } + + Base::Matrix::Matrix B_dense_matrix = + output_dense_matrix(B.matrix); + + Base::Matrix::sparse_gmres_k_partition_matrix( + A.matrix, B_dense_matrix, this->X_1, this->decay_rate, + this->division_min, this->rho, this->rep_num, matrix_size); + + return Matrix(this->X_1); + } + + inline auto cold_solve(const Matrix &A, + const Matrix &B, + std::size_t matrix_size) -> Matrix { + + Base::Matrix::Matrix X_1_temporary; if (matrix_size > M) { matrix_size = M; @@ -803,17 +921,35 @@ class LinalgPartitionSolver { output_dense_matrix(B.matrix); Base::Matrix::sparse_gmres_k_partition_matrix( - A.matrix, B_dense_matrix, X_1, this->decay_rate, this->division_min, - this->rho, this->rep_num, matrix_size); + A.matrix, B_dense_matrix, X_1_temporary, this->decay_rate, + this->division_min, this->rho, this->rep_num, matrix_size); - return Matrix(X_1); + return Matrix(X_1_temporary); } inline auto solve(const Matrix &A, const Matrix &B, std::size_t matrix_size) -> Matrix { - Base::Matrix::Matrix X_1; + if (matrix_size > M) { + matrix_size = M; + } + + Base::Matrix::Matrix B_dense_matrix = + Base::Matrix::output_dense_matrix(B.matrix); + + Base::Matrix::sparse_gmres_k_partition_matrix( + A.matrix, B_dense_matrix, this->X_1, this->decay_rate, + this->division_min, this->rho, this->rep_num, matrix_size); + + return Matrix(this->X_1); + } + + inline auto cold_solve(const Matrix &A, + const Matrix &B, + std::size_t matrix_size) -> Matrix { + + Base::Matrix::Matrix X_1_temporary; if (matrix_size > M) { matrix_size = M; @@ -823,10 +959,10 @@ class LinalgPartitionSolver { Base::Matrix::output_dense_matrix(B.matrix); Base::Matrix::sparse_gmres_k_partition_matrix( - A.matrix, B_dense_matrix, X_1, this->decay_rate, this->division_min, - this->rho, this->rep_num, matrix_size); + A.matrix, B_dense_matrix, X_1_temporary, this->decay_rate, + this->division_min, this->rho, this->rep_num, matrix_size); - return Matrix(X_1); + return Matrix(X_1_temporary); } inline auto get_answer(void) -> Matrix { @@ -850,6 +986,8 @@ class LinalgPartitionSolver { public: /* Variable */ + Base::Matrix::Matrix X_1; + Value_Type decay_rate; Value_Type division_min; std::array rho; From ff5c38bf3ade824df1096172cb23b8eebc9b74f3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 8 Jun 2025 10:03:50 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BD=9C=E6=88=90=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test_vs/check_python_numpy.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test_vs/check_python_numpy.hpp b/test_vs/check_python_numpy.hpp index 9eb65d7..9605435 100644 --- a/test_vs/check_python_numpy.hpp +++ b/test_vs/check_python_numpy.hpp @@ -1205,7 +1205,7 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { = std::move(A_A_P_linalg_solver_copy); A_A_P_linalg_solver = A_A_P_linalg_solver_move; - auto A_A_P_x = A_A_P_linalg_solver.solve(A_P, A_P, 3); + auto A_A_P_x = A_A_P_linalg_solver.cold_solve(A_P, A_P, 3); Matrix A_A_P_x_answer({ { 1.0F, 0.0F, 0.0F, 0.0F }, @@ -1219,7 +1219,7 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { static auto A_B_P_linalg_solver = make_LinalgPartitionSolver(); - auto A_B_P_x = A_B_P_linalg_solver.solve(A_P, B_P, 3); + auto A_B_P_x = A_B_P_linalg_solver.cold_solve(A_P, B_P, 3); Matrix A_B_P_x_answer({ {-6.66666667e-01F, 6.66666667e-01F, 0.0F, 0.0F}, @@ -1233,7 +1233,7 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { static auto A_C_P_linalg_solver = make_LinalgPartitionSolver(); - auto A_C_P_x = A_C_P_linalg_solver.solve(A_P, C_P, 3); + auto A_C_P_x = A_C_P_linalg_solver.cold_solve(A_P, C_P, 3); Matrix A_C_P_x_answer({ { 3.33333333e-01F, 0.0F, 2.66666667F, 0.0F}, @@ -1247,7 +1247,7 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { static auto B_A_P_linalg_solver = make_LinalgPartitionSolver(); - auto B_A_P_x = B_A_P_linalg_solver.solve(B_P, A_P, 3); + auto B_A_P_x = B_A_P_linalg_solver.cold_solve(B_P, A_P, 3); Matrix B_A_P_x_answer({ { 1.0F, 2.0F, 3.0F, 0.0F }, @@ -1276,7 +1276,7 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { static auto B_C_P_linalg_solver = make_LinalgPartitionSolver(); - auto B_C_P_x = B_C_P_linalg_solver.solve(B_P, C_P, 3); + auto B_C_P_x = B_C_P_linalg_solver.cold_solve(B_P, C_P, 3); Matrix B_C_P_x_answer({ { 1.0F, 0.0F, 0.0F, 0.0F }, @@ -1290,7 +1290,7 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { static auto C_A_P_linalg_solver = make_LinalgPartitionSolver(); - auto C_A_P_x = C_A_P_linalg_solver.solve(C_P, A_P, 3); + auto C_A_P_x = C_A_P_linalg_solver.cold_solve(C_P, A_P, 3); Matrix C_A_P_x_answer({ { 1.0F, 2.0F, 3.0F, 0.0F }, @@ -1304,7 +1304,7 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { static auto C_B_P_linalg_solver = make_LinalgPartitionSolver(); - auto C_B_P_x = C_B_P_linalg_solver.solve(C_P, B_P, 3); + auto C_B_P_x = C_B_P_linalg_solver.cold_solve(C_P, B_P, 3); Matrix C_B_P_x_answer({ { 1.0F, 0.0F, 0.0F, 0.0F }, @@ -1318,7 +1318,7 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { static auto C_C_P_linalg_solver = make_LinalgPartitionSolver(); - auto C_C_P_x = C_C_P_linalg_solver.solve(C_P, C_P, 3); + auto C_C_P_x = C_C_P_linalg_solver.cold_solve(C_P, C_P, 3); Matrix C_C_P_x_answer({ { 1.0F, 0.0F, 0.0F, 0.0F }, From 789a2b2a416f66b695c51f08e43b9d766fbab428 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 8 Jun 2025 10:10:20 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BD=9C=E6=88=90=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test_vs/check_python_numpy.hpp | 56 +++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/test_vs/check_python_numpy.hpp b/test_vs/check_python_numpy.hpp index 9605435..8b57539 100644 --- a/test_vs/check_python_numpy.hpp +++ b/test_vs/check_python_numpy.hpp @@ -1205,7 +1205,7 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { = std::move(A_A_P_linalg_solver_copy); A_A_P_linalg_solver = A_A_P_linalg_solver_move; - auto A_A_P_x = A_A_P_linalg_solver.cold_solve(A_P, A_P, 3); + auto A_A_P_x = A_A_P_linalg_solver.solve(A_P, A_P, 3); Matrix A_A_P_x_answer({ { 1.0F, 0.0F, 0.0F, 0.0F }, @@ -1217,9 +1217,14 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { tester.expect_near(A_A_P_x.matrix.data, A_A_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, "check LinalgPartitionSolver solve Dense and Dense."); + A_A_P_x = A_A_P_linalg_solver.cold_solve(A_P, A_P, 3); + + tester.expect_near(A_A_P_x.matrix.data, A_A_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, + "check LinalgPartitionSolver solve Dense and Dense cold solve."); + static auto A_B_P_linalg_solver = make_LinalgPartitionSolver(); - auto A_B_P_x = A_B_P_linalg_solver.cold_solve(A_P, B_P, 3); + auto A_B_P_x = A_B_P_linalg_solver.solve(A_P, B_P, 3); Matrix A_B_P_x_answer({ {-6.66666667e-01F, 6.66666667e-01F, 0.0F, 0.0F}, @@ -1231,9 +1236,14 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { tester.expect_near(A_B_P_x.matrix.data, A_B_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, "check LinalgPartitionSolver solve Dense and Diag."); + A_B_P_x = A_B_P_linalg_solver.cold_solve(A_P, B_P, 3); + + tester.expect_near(A_B_P_x.matrix.data, A_B_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, + "check LinalgPartitionSolver solve Dense and Diag cold solve."); + static auto A_C_P_linalg_solver = make_LinalgPartitionSolver(); - auto A_C_P_x = A_C_P_linalg_solver.cold_solve(A_P, C_P, 3); + auto A_C_P_x = A_C_P_linalg_solver.solve(A_P, C_P, 3); Matrix A_C_P_x_answer({ { 3.33333333e-01F, 0.0F, 2.66666667F, 0.0F}, @@ -1245,9 +1255,14 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { tester.expect_near(A_C_P_x.matrix.data, A_C_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, "check LinalgPartitionSolver solve Dense and Sparse."); + A_C_P_x = A_C_P_linalg_solver.cold_solve(A_P, C_P, 3); + + tester.expect_near(A_C_P_x.matrix.data, A_C_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, + "check LinalgPartitionSolver solve Dense and Sparse cold solve."); + static auto B_A_P_linalg_solver = make_LinalgPartitionSolver(); - auto B_A_P_x = B_A_P_linalg_solver.cold_solve(B_P, A_P, 3); + auto B_A_P_x = B_A_P_linalg_solver.solve(B_P, A_P, 3); Matrix B_A_P_x_answer({ { 1.0F, 2.0F, 3.0F, 0.0F }, @@ -1259,6 +1274,11 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { tester.expect_near(B_A_P_x.matrix.data, B_A_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, "check LinalgPartitionSolver solve Diag and Dense."); + B_A_P_x = B_A_P_linalg_solver.cold_solve(B_P, A_P, 3); + + tester.expect_near(B_A_P_x.matrix.data, B_A_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, + "check LinalgPartitionSolver solve Diag and Dense cold solve."); + static auto B_B_P_linalg_solver = make_LinalgPartitionSolver(); auto B_B_P_x = B_B_P_linalg_solver.solve(B_P, B_P, 3); @@ -1276,7 +1296,7 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { static auto B_C_P_linalg_solver = make_LinalgPartitionSolver(); - auto B_C_P_x = B_C_P_linalg_solver.cold_solve(B_P, C_P, 3); + auto B_C_P_x = B_C_P_linalg_solver.solve(B_P, C_P, 3); Matrix B_C_P_x_answer({ { 1.0F, 0.0F, 0.0F, 0.0F }, @@ -1288,9 +1308,14 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { tester.expect_near(B_C_P_x.matrix.data, B_C_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, "check LinalgPartitionSolver solve Diag and Sparse."); + B_C_P_x = B_C_P_linalg_solver.cold_solve(B_P, C_P, 3); + + tester.expect_near(B_C_P_x.matrix.data, B_C_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, + "check LinalgPartitionSolver solve Diag and Sparse cold solve."); + static auto C_A_P_linalg_solver = make_LinalgPartitionSolver(); - auto C_A_P_x = C_A_P_linalg_solver.cold_solve(C_P, A_P, 3); + auto C_A_P_x = C_A_P_linalg_solver.solve(C_P, A_P, 3); Matrix C_A_P_x_answer({ { 1.0F, 2.0F, 3.0F, 0.0F }, @@ -1302,9 +1327,14 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { tester.expect_near(C_A_P_x.matrix.data, C_A_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, "check LinalgPartitionSolver solve Sparse and Dense."); + C_A_P_x = C_A_P_linalg_solver.cold_solve(C_P, A_P, 3); + + tester.expect_near(C_A_P_x.matrix.data, C_A_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, + "check LinalgPartitionSolver solve Sparse and Dense cold solve."); + static auto C_B_P_linalg_solver = make_LinalgPartitionSolver(); - auto C_B_P_x = C_B_P_linalg_solver.cold_solve(C_P, B_P, 3); + auto C_B_P_x = C_B_P_linalg_solver.solve(C_P, B_P, 3); Matrix C_B_P_x_answer({ { 1.0F, 0.0F, 0.0F, 0.0F }, @@ -1316,9 +1346,14 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { tester.expect_near(C_B_P_x.matrix.data, C_B_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, "check LinalgPartitionSolver solve Sparse and Diag."); + C_B_P_x = C_B_P_linalg_solver.cold_solve(C_P, B_P, 3); + + tester.expect_near(C_B_P_x.matrix.data, C_B_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, + "check LinalgPartitionSolver solve Sparse and Diag cold solve."); + static auto C_C_P_linalg_solver = make_LinalgPartitionSolver(); - auto C_C_P_x = C_C_P_linalg_solver.cold_solve(C_P, C_P, 3); + auto C_C_P_x = C_C_P_linalg_solver.solve(C_P, C_P, 3); Matrix C_C_P_x_answer({ { 1.0F, 0.0F, 0.0F, 0.0F }, @@ -1330,6 +1365,11 @@ void CheckPythonNumpy::check_python_numpy_left_divide_and_inv(void) { tester.expect_near(C_C_P_x.matrix.data, C_C_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, "check LinalgPartitionSolver solve Sparse and Sparse."); + C_C_P_x = C_C_P_linalg_solver.cold_solve(C_P, C_P, 3); + + tester.expect_near(C_C_P_x.matrix.data, C_C_P_x_answer.matrix.data, NEAR_LIMIT_STRICT, + "check LinalgPartitionSolver solve Sparse and Sparse cold solve."); + /* 矩形 左除算 */ Matrix AL({ {1, 2, 3}, {5, 4, 6}, {9, 8, 7}, {2, 2, 3} }); From d2033279f9f7ef8192915a5bfb3c8538bb17031f Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 8 Jun 2025 10:10:48 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/run_test_vs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_test_vs.yml b/.github/workflows/run_test_vs.yml index 97f7dc2..19e9be4 100644 --- a/.github/workflows/run_test_vs.yml +++ b/.github/workflows/run_test_vs.yml @@ -2,7 +2,7 @@ name: Run test VS on: push: - branches: [ develop ] + branches: [ develop, feature/* ] jobs: build: From 55950b90224b5183e24c9b10c0e437f9bbedb981 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 8 Jun 2025 10:12:06 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python_numpy/python_numpy_linalg_solver.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/python_numpy/python_numpy_linalg_solver.hpp b/python_numpy/python_numpy_linalg_solver.hpp index ef845f4..d4fc598 100644 --- a/python_numpy/python_numpy_linalg_solver.hpp +++ b/python_numpy/python_numpy_linalg_solver.hpp @@ -824,9 +824,6 @@ class LinalgPartitionSolver { const Matrix &B, std::size_t matrix_size) -> Matrix { - using RowIndices_B = RowIndicesFromSparseAvailable; - using RowPointers_B = RowPointersFromSparseAvailable; - if (matrix_size > M) { matrix_size = M; }