From 4ef94d4cb2cc7e6e3a083ebfdfd3e71721157bca Mon Sep 17 00:00:00 2001 From: Karl-Wilfried Zimmer Date: Sun, 21 Jul 2024 15:31:51 +0200 Subject: [PATCH] added arbitrariy sized matrix --- include/LinAlg/matrixmxn.h | 23 +++++++++++++++++++++++ src/CMakeLists.txt | 2 +- src/matrixmxn.cpp | 8 ++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 include/LinAlg/matrixmxn.h create mode 100644 src/matrixmxn.cpp diff --git a/include/LinAlg/matrixmxn.h b/include/LinAlg/matrixmxn.h new file mode 100644 index 0000000..45fc102 --- /dev/null +++ b/include/LinAlg/matrixmxn.h @@ -0,0 +1,23 @@ +// +// Created by nb on 21.07.24. +// + +#ifndef VOLSVECS_MATRIXMXN_H +#define VOLSVECS_MATRIXMXN_H + +namespace LinAlg{ + template + class Matrix{ + + protected: + int static getIndex(short x, short y){ + if(x>=m) return -1; + if(y>=n) return -2; + return x+y*n; + } + private: + double _entris[m*n]; + }; +} + +#endif //VOLSVECS_MATRIXMXN_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ef2286e..1670bc9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ file(GLOB HEADER_LIST CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/include/*") file(GLOB SOURCE_LIST CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*") -add_library(volsvecs block.cpp vector3.cpp ${HEADER_LIST}) +add_library(volsvecs ${SOURCE_LIST} ${HEADER_LIST}) add_library(VolumesVectors::volsvecs ALIAS volsvecs) target_include_directories(volsvecs PUBLIC "${PROJECT_SOURCE_DIR}/include") diff --git a/src/matrixmxn.cpp b/src/matrixmxn.cpp new file mode 100644 index 0000000..4cae6d6 --- /dev/null +++ b/src/matrixmxn.cpp @@ -0,0 +1,8 @@ +// +// Created by nb on 21.07.24. +// +#include "LinAlg/matrixmxn.h" + +namespace LinAlg{ + +} \ No newline at end of file