diff --git a/include/tuvx/linear_algebra/banded_matrix.hpp b/include/tuvx/linear_algebra/banded_matrix.hpp new file mode 100644 index 00000000..e6d79fa2 --- /dev/null +++ b/include/tuvx/linear_algebra/banded_matrix.hpp @@ -0,0 +1,21 @@ +#include + +namespace tuvx +{ + + template + struct BandedMatrix + { + // data fields + std::size_t size_; + std::size_t bandwidth_up_; + std::size_t bandwidth_down_; + std::vector> band; + // constructor + BandedMatrix(std::size_t size, std::size_t up, std::size_t down); + }; + + template + std::vector Dot(const BandedMatrix& A, const std::vector&); + +} // namespace tuvx diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb4e571c..698d2a6e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,6 +22,12 @@ message(STATUS "lapack libraries: ${LAPACK_LIBRARIES}") target_link_libraries(tuvx_object PRIVATE PkgConfig::netcdff PkgConfig::netcdfc yaml-cpp::yaml-cpp) +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM") + target_compile_definitions(tuvx_object PUBLIC TUVX_COMPILE_WITH_INTEL) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + target_compile_definitions(tuvx_object PUBLIC TUVX_COMPILE_WITH_GCC) +endif() + if(BLAS_LIBRARIES) target_link_libraries(tuvx_object PRIVATE ${BLAS_LIBRARIES}) else() @@ -44,7 +50,7 @@ set_target_properties( VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) -target_link_libraries(tuvx PRIVATE tuvx_object) +target_link_libraries(tuvx PUBLIC tuvx_object) message( STATUS diff --git a/test/unit/linear_algebra/test_lapacke.cpp b/test/unit/linear_algebra/test_lapacke.cpp index 01a6b15f..c24d1211 100644 --- a/test/unit/linear_algebra/test_lapacke.cpp +++ b/test/unit/linear_algebra/test_lapacke.cpp @@ -9,10 +9,15 @@ #include #include #include -#include #include #include +#ifdef TUVX_COMPILE_WITH_INTEL + #include +#elif TUVX_COMPILE_WITH_GCC + #include +#endif + using namespace tuvx; using std::chrono::duration; using std::chrono::duration_cast; diff --git a/tool/numerical_analysis/analysis.ipynb b/tool/numerical_analysis/analysis.ipynb new file mode 100644 index 00000000..e69de29b diff --git a/tool/numerical_analysis/tridiagonal_solver/lapacke_double_precision.dat b/tool/numerical_analysis/tridiagonal_solver/lapacke_double_precision.dat index c9bdc9ec..1a5f7f9b 100644 --- a/tool/numerical_analysis/tridiagonal_solver/lapacke_double_precision.dat +++ b/tool/numerical_analysis/tridiagonal_solver/lapacke_double_precision.dat @@ -1,5 +1,5 @@ -3.29913e-17 0.0176367 -3.30137e-17 0.175568 -3.29986e-17 1.73411 -3.29744e-17 17.864 -3.29784e-17 188.188 +0 0.0312956 +0 0.229959 +0 2.2255 +0 22.7488 +0 240.375 diff --git a/tool/numerical_analysis/tridiagonal_solver/lapacke_single_precision.dat b/tool/numerical_analysis/tridiagonal_solver/lapacke_single_precision.dat index 9d22993d..28e881b1 100644 --- a/tool/numerical_analysis/tridiagonal_solver/lapacke_single_precision.dat +++ b/tool/numerical_analysis/tridiagonal_solver/lapacke_single_precision.dat @@ -1,5 +1,5 @@ -1.63141e-08 0.0319062 -1.62981e-08 0.315242 -1.63017e-08 3.15343 -1.62755e-08 18.4041 -1.63076e-08 166.735 +0 3.46066 +0 0.295798 +0 3.97411 +0 25.0105 +0 238.504