Initial Course

This commit is contained in:
David Gil de Gómez Pérez
2026-08-11 17:40:36 +03:00
commit 9aed1d1d86
202 changed files with 3420 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
#include "mdspan.hpp"
#include <gtest/gtest.h>
TEST(Mdspan, MatrixElement) {
auto storage = cpp23::make_row_major_matrix(2, 3, 1);
const auto matrix = std::mdspan<const int, std::extents<int, std::dynamic_extent, std::dynamic_extent>>(
storage.data(), 2, 3);
EXPECT_EQ(cpp23::matrix_element(matrix, 1, 2), 1);
}
TEST(Mdspan, RowSums) {
std::vector<int> storage = {1, 2, 3, 4, 5, 6};
const auto matrix = std::mdspan<const int, std::extents<int, std::dynamic_extent, std::dynamic_extent>>(
storage.data(), 2, 3);
EXPECT_EQ(cpp23::row_sums(matrix), (std::vector<int>{6, 15}));
}