mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add support for SuiteSparse's KLU routines
This commit is contained in:
@@ -68,6 +68,17 @@ else()
|
||||
ei_add_property(EIGEN_MISSING_BACKENDS "UmfPack, ")
|
||||
endif()
|
||||
|
||||
find_package(KLU)
|
||||
if(KLU_FOUND)
|
||||
add_definitions("-DEIGEN_KLU_SUPPORT")
|
||||
include_directories(${KLU_INCLUDES})
|
||||
set(SPARSE_LIBS ${SPARSE_LIBS} ${KLU_LIBRARIES} ${EIGEN_BLAS_LIBRARIES})
|
||||
set(KLU_ALL_LIBS ${KLU_LIBRARIES} ${EIGEN_BLAS_LIBRARIES})
|
||||
ei_add_property(EIGEN_TESTED_BACKENDS "KLU, ")
|
||||
else()
|
||||
ei_add_property(EIGEN_MISSING_BACKENDS "KLU, ")
|
||||
endif()
|
||||
|
||||
find_package(SuperLU 4.0)
|
||||
if(SUPERLU_FOUND)
|
||||
add_definitions("-DEIGEN_SUPERLU_SUPPORT")
|
||||
@@ -297,6 +308,11 @@ if(UMFPACK_FOUND)
|
||||
ei_add_test(umfpack_support "" "${UMFPACK_ALL_LIBS}")
|
||||
endif()
|
||||
|
||||
if(KLU_FOUND OR SuiteSparse_FOUND)
|
||||
message("ADDING KLU TEST")
|
||||
ei_add_test(klu_support "" "${KLU_ALL_LIBS}")
|
||||
endif()
|
||||
|
||||
if(SUPERLU_FOUND)
|
||||
ei_add_test(superlu_support "" "${SUPERLU_ALL_LIBS}")
|
||||
endif()
|
||||
|
||||
32
test/klu_support.cpp
Normal file
32
test/klu_support.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
// This file is part of Eigen, a lightweight C++ template library
|
||||
// for linear algebra.
|
||||
//
|
||||
// Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla
|
||||
// Public License v. 2.0. If a copy of the MPL was not distributed
|
||||
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#define EIGEN_NO_DEBUG_SMALL_PRODUCT_BLOCKS
|
||||
#include "sparse_solver.h"
|
||||
|
||||
#include <unsupported/Eigen/KLUSupport>
|
||||
|
||||
template<typename T> void test_klu_support_T()
|
||||
{
|
||||
KLU<SparseMatrix<T, ColMajor> > klu_colmajor;
|
||||
KLU<SparseMatrix<T, RowMajor> > klu_rowmajor;
|
||||
|
||||
check_sparse_square_solving(klu_colmajor);
|
||||
check_sparse_square_solving(klu_rowmajor);
|
||||
|
||||
//check_sparse_square_determinant(umfpack_colmajor);
|
||||
//check_sparse_square_determinant(umfpack_rowmajor);
|
||||
}
|
||||
|
||||
void test_klu_support()
|
||||
{
|
||||
CALL_SUBTEST_1(test_klu_support_T<double>());
|
||||
CALL_SUBTEST_2(test_klu_support_T<std::complex<double> >());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user