From 5fa815828b6ce0ab2e1730a71931aff07afa7f5d Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Sep 2025 19:44:09 +0900 Subject: [PATCH 1/3] Remove element-wise multiplication function and update references to use PythonNumpy implementation --- ...thon_optimization_sqp_matrix_operation.hpp | 44 ------------------- ...python_optimization_sqp_matrix_utility.hpp | 23 ++++++---- 2 files changed, 14 insertions(+), 53 deletions(-) diff --git a/optimization_utility/python_optimization_sqp_matrix_operation.hpp b/optimization_utility/python_optimization_sqp_matrix_operation.hpp index 239f708..d0d7e39 100644 --- a/optimization_utility/python_optimization_sqp_matrix_operation.hpp +++ b/optimization_utility/python_optimization_sqp_matrix_operation.hpp @@ -195,50 +195,6 @@ inline auto get_row(const Matrix_In_Type &in_matrix, return out; } -/** - * @brief Performs element-wise multiplication of two matrices. - * - * This function takes two matrices, A and B, of the same dimensions and returns - * a new matrix where each element is the product of the corresponding elements - * in A and B. - * - * @tparam Matrix_A_Type Type of the first input matrix. Must define Value_Type, - * COLS, and ROWS. - * @tparam Matrix_B_Type Type of the second input matrix. Must define COLS and - * ROWS. - * @param A The first input matrix. - * @param B The second input matrix. - * @return PythonNumpy::DenseMatrix_Type A matrix containing the - * element-wise products of A and B. - * - * @note The function enforces at compile time that both matrices have the same - * dimensions. - */ -template -inline auto element_wise_multiply(const Matrix_A_Type &A, - const Matrix_B_Type &B) - -> PythonNumpy::DenseMatrix_Type { - - static_assert(Matrix_A_Type::COLS == Matrix_B_Type::COLS, - "Matrix_A_Type::COLS != Matrix_B_Type::COLS"); - static_assert(Matrix_A_Type::ROWS == Matrix_B_Type::ROWS, - "Matrix_A_Type::ROWS != Matrix_B_Type::ROWS"); - - PythonNumpy::DenseMatrix_Type - out; - - for (std::size_t i = 0; i < Matrix_A_Type::COLS; i++) { - for (std::size_t j = 0; j < Matrix_A_Type::ROWS; j++) { - out(i, j) = A(i, j) * B(i, j); - } - } - - return out; -} - /** * @brief Calculates the quadratic form X * W * X^T for a given row vector X and * matrix W. diff --git a/optimization_utility/python_optimization_sqp_matrix_utility.hpp b/optimization_utility/python_optimization_sqp_matrix_utility.hpp index 91b1c5c..22a4bf6 100644 --- a/optimization_utility/python_optimization_sqp_matrix_utility.hpp +++ b/optimization_utility/python_optimization_sqp_matrix_utility.hpp @@ -1042,9 +1042,10 @@ class SQP_CostMatrices_NMPC { * @return X_Horizon_Type The matrix containing the state trajectory over the * horizon. */ - inline auto - simulate_trajectory(const X_Type &X_initial, const U_Horizon_Type &U_horizon, - const _Parameter_Type ¶meter) -> X_Horizon_Type { + inline auto simulate_trajectory(const X_Type &X_initial, + const U_Horizon_Type &U_horizon, + const _Parameter_Type ¶meter) + -> X_Horizon_Type { X_Horizon_Type X_horizon; X_Type X = X_initial; @@ -1074,8 +1075,8 @@ class SQP_CostMatrices_NMPC { * @return Y_Horizon_Type The resulting penalty matrix for Y horizon limit * violations. */ - inline auto - calculate_Y_limit_penalty(const Y_Horizon_Type &Y_horizon) -> Y_Horizon_Type { + inline auto calculate_Y_limit_penalty(const Y_Horizon_Type &Y_horizon) + -> Y_Horizon_Type { Y_Horizon_Type Y_limit_penalty; MatrixOperation::calculate_Y_limit_penalty( @@ -1457,8 +1458,10 @@ class SQP_CostMatrices_NMPC { auto CX_N_T_Py_Cx_N_dx = PythonNumpy::ATranspose_mul_B( Cx_N, (static_cast<_T>(2) * this->_Py * Cx_N_dx)); - auto YN_limit_active_CX_N_dx = MatrixOperation::element_wise_multiply( - MatrixOperation::get_row(Y_limit_active, NP), Cx_N_dx); + Y_Type YN_limit_active_CX_N_dx; + PythonNumpy::element_wise_multiply( + YN_limit_active_CX_N_dx, MatrixOperation::get_row(Y_limit_active, NP), + Cx_N_dx); auto Y_min_max_rho_YN_limit_active_CX_N_dx = static_cast<_T>(2) * this->_Y_min_max_rho * YN_limit_active_CX_N_dx; @@ -1506,8 +1509,10 @@ class SQP_CostMatrices_NMPC { static_cast<_T>(2) * this->_Py * ek_y, MatrixOperation::get_row(dx, k)); - auto YN_limit_active_CX_k_dx = MatrixOperation::element_wise_multiply( - MatrixOperation::get_row(Y_limit_active, k), Cx_dx_k); + Y_Type YN_limit_active_CX_k_dx; + PythonNumpy::element_wise_multiply( + YN_limit_active_CX_k_dx, MatrixOperation::get_row(Y_limit_active, k), + Cx_dx_k); auto Y_min_max_rho_Yk_limit_active_Cx_dx_k = static_cast<_T>(2) * this->_Y_min_max_rho * YN_limit_active_CX_k_dx; From 298c5b542a0c3fa09b23d6122aa4b236cd167782 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Sep 2025 19:44:41 +0900 Subject: [PATCH 2/3] =?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 | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run_test_vs.yml b/.github/workflows/run_test_vs.yml index acab89b..952c259 100644 --- a/.github/workflows/run_test_vs.yml +++ b/.github/workflows/run_test_vs.yml @@ -4,6 +4,7 @@ on: push: branches: - develop + - feature/* jobs: test_vs: From 7f4e1ade9411b1fe35ee6bdde699e80a5736773c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Sep 2025 19:45:42 +0900 Subject: [PATCH 3/3] Remove feature branch trigger from GitHub Actions workflow --- .github/workflows/run_test_vs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/run_test_vs.yml b/.github/workflows/run_test_vs.yml index 952c259..acab89b 100644 --- a/.github/workflows/run_test_vs.yml +++ b/.github/workflows/run_test_vs.yml @@ -4,7 +4,6 @@ on: push: branches: - develop - - feature/* jobs: test_vs: