Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions base_matrix/base_matrix_concatenate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct VerticalConcatenateLoop {
static void compute(const Matrix<T, M, N> &A, const Matrix<T, P, N> &B,
Matrix<T, M + P, N> &Y) {
Base::Utility::copy<T, 0, M, 0, M, (M + P)>(A.data[Row], Y.data[Row]);
Base::Utility::copy<T, 0, P, M, M, (M + P)>(B.data[Row], Y.data[Row]);
Base::Utility::copy<T, 0, P, M, P, (M + P)>(B.data[Row], Y.data[Row]);
VerticalConcatenateLoop<T, M, P, N, Row - 1>::compute(A, B, Y);
}
};
Expand All @@ -35,7 +35,7 @@ struct VerticalConcatenateLoop<T, M, P, N, 0> {
static void compute(const Matrix<T, M, N> &A, const Matrix<T, P, N> &B,
Matrix<T, M + P, N> &Y) {
Base::Utility::copy<T, 0, M, 0, M, (M + P)>(A.data[0], Y.data[0]);
Base::Utility::copy<T, 0, P, M, M, (M + P)>(B.data[0], Y.data[0]);
Base::Utility::copy<T, 0, P, M, P, (M + P)>(B.data[0], Y.data[0]);
}
};

Expand All @@ -56,7 +56,7 @@ inline void update_vertically_concatenated_matrix(Matrix<T, M + P, N> &Y,

for (std::size_t row = 0; row < N; row++) {
Base::Utility::copy<T, 0, M, 0, M, (M + P)>(A.data[row], Y.data[row]);
Base::Utility::copy<T, 0, P, M, M, (M + P)>(B.data[row], Y.data[row]);
Base::Utility::copy<T, 0, P, M, P, (M + P)>(B.data[row], Y.data[row]);
}

#else // __BASE_MATRIX_USE_FOR_LOOP_OPERATION__
Expand Down
38 changes: 38 additions & 0 deletions test_vs/check_python_numpy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,44 @@ void CheckPythonNumpy<T>::check_python_numpy_concatenate(void) {


/* 結合 */
Matrix<DefDense, T, 1, 1> a({ {1} });
Matrix<DefDense, T, 1, 1> b({ {2} });
Matrix<DefDense, T, 2, 1> aa({ {1}, {2} });
Matrix<DefDense, T, 2, 1> bb({ {3}, {4} });

auto a_v_b = concatenate_vertically(a, b);

Matrix<DefDense, T, 2, 1> a_v_b_answer({
{1},
{2}
});

tester.expect_near(a_v_b.matrix.data, a_v_b_answer.matrix.data, NEAR_LIMIT_STRICT,
"check concatenate vertically Dense and Dense small, 1 1.");

auto aa_v_b = concatenate_vertically(aa, b);

Matrix<DefDense, T, 3, 1> aa_v_b_answer({
{1},
{2},
{2}
});

tester.expect_near(aa_v_b.matrix.data, aa_v_b_answer.matrix.data, NEAR_LIMIT_STRICT,
"check concatenate vertically Dense and Dense small, 2 1.");

auto a_v_bb = concatenate_vertically(a, bb);

Matrix<DefDense, T, 3, 1> a_v_bb_answer({
{1},
{3},
{4}
});

tester.expect_near(a_v_bb.matrix.data, a_v_bb_answer.matrix.data, NEAR_LIMIT_STRICT,
"check concatenate vertically Dense and Dense small, 1 2.");


auto A_v_A = concatenate_vertically(A, A);
ConcatenateVertically_Type<decltype(A), decltype(A)> A_v_A_t;
A_v_A_t = A_v_A;
Expand Down