Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TEST_CASE("Operator * (vector * matrix)") {
- Matrix A(5, 3, 1);
- std::pair<size_t, size_t> p(5, 3);
- for (int i = 0; i < p.first; ++i) {
- for (int j = 0; j < p.second; ++j) {
- A.get(i, j) = i * p.first + i + j + 1;
- }
- }
- Vector B(5);
- for (int i = 0; i < B.size(); ++i) {
- B[i] = i + 1;
- }
- Vector C(1);
- C = B * A;
- REQUIRE(C.size() == 3);
- REQUIRE(abs(C[0] - 135) < eps);
- REQUIRE(abs(C[1] - 150) < eps);
- REQUIRE(abs(C[2] - 165) < eps);
- ////////////////////
- B *= A;
- REQUIRE(B.size() == 3);
- REQUIRE(abs(B[0] - 135) < eps);
- REQUIRE(abs(B[1] - 150) < eps);
- REQUIRE(abs(B[2] - 165) < eps);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement