Removed need to supply the Symmetric flag to UpLo argument for Accelerate LLT and LDLT

This commit is contained in:
John Mather 2022-04-21 20:02:10 +00:00 committed by Antonio Sánchez
parent 44ba7a0da3
commit 9e026e5e28
2 changed files with 30 additions and 32 deletions

View File

@ -17,12 +17,12 @@ class AccelerateImpl;
* \warning Only single and double precision real scalar types are supported by Accelerate * \warning Only single and double precision real scalar types are supported by Accelerate
* *
* \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<>
* \tparam UpLo_ additional information about the matrix structure. Default is Lower | Symmetric. * \tparam UpLo_ additional information about the matrix structure. Default is Lower.
* *
* \sa \ref TutorialSparseSolverConcept, class AccelerateLLT * \sa \ref TutorialSparseSolverConcept, class AccelerateLLT
*/ */
template <typename MatrixType, int UpLo = Lower | Symmetric> template <typename MatrixType, int UpLo = Lower>
using AccelerateLLT = AccelerateImpl<MatrixType, UpLo, SparseFactorizationCholesky, true>; using AccelerateLLT = AccelerateImpl<MatrixType, UpLo | Symmetric, SparseFactorizationCholesky, true>;
/** \ingroup AccelerateSupport_Module /** \ingroup AccelerateSupport_Module
* \class AccelerateLDLT * \class AccelerateLDLT
@ -31,12 +31,12 @@ using AccelerateLLT = AccelerateImpl<MatrixType, UpLo, SparseFactorizationCholes
* \warning Only single and double precision real scalar types are supported by Accelerate * \warning Only single and double precision real scalar types are supported by Accelerate
* *
* \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<>
* \tparam UpLo_ additional information about the matrix structure. Default is Lower | Symmetric. * \tparam UpLo_ additional information about the matrix structure. Default is Lower.
* *
* \sa \ref TutorialSparseSolverConcept, class AccelerateLDLT * \sa \ref TutorialSparseSolverConcept, class AccelerateLDLT
*/ */
template <typename MatrixType, int UpLo = Lower | Symmetric> template <typename MatrixType, int UpLo = Lower>
using AccelerateLDLT = AccelerateImpl<MatrixType, UpLo, SparseFactorizationLDLT, true>; using AccelerateLDLT = AccelerateImpl<MatrixType, UpLo | Symmetric, SparseFactorizationLDLT, true>;
/** \ingroup AccelerateSupport_Module /** \ingroup AccelerateSupport_Module
* \class AccelerateLDLTUnpivoted * \class AccelerateLDLTUnpivoted
@ -45,12 +45,12 @@ using AccelerateLDLT = AccelerateImpl<MatrixType, UpLo, SparseFactorizationLDLT,
* \warning Only single and double precision real scalar types are supported by Accelerate * \warning Only single and double precision real scalar types are supported by Accelerate
* *
* \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<>
* \tparam UpLo_ additional information about the matrix structure. Default is Lower | Symmetric. * \tparam UpLo_ additional information about the matrix structure. Default is Lower.
* *
* \sa \ref TutorialSparseSolverConcept, class AccelerateLDLTUnpivoted * \sa \ref TutorialSparseSolverConcept, class AccelerateLDLTUnpivoted
*/ */
template <typename MatrixType, int UpLo = Lower | Symmetric> template <typename MatrixType, int UpLo = Lower>
using AccelerateLDLTUnpivoted = AccelerateImpl<MatrixType, UpLo, SparseFactorizationLDLTUnpivoted, true>; using AccelerateLDLTUnpivoted = AccelerateImpl<MatrixType, UpLo | Symmetric, SparseFactorizationLDLTUnpivoted, true>;
/** \ingroup AccelerateSupport_Module /** \ingroup AccelerateSupport_Module
* \class AccelerateLDLTSBK * \class AccelerateLDLTSBK
@ -59,12 +59,12 @@ using AccelerateLDLTUnpivoted = AccelerateImpl<MatrixType, UpLo, SparseFactoriza
* \warning Only single and double precision real scalar types are supported by Accelerate * \warning Only single and double precision real scalar types are supported by Accelerate
* *
* \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<>
* \tparam UpLo_ additional information about the matrix structure. Default is Lower | Symmetric. * \tparam UpLo_ additional information about the matrix structure. Default is Lower.
* *
* \sa \ref TutorialSparseSolverConcept, class AccelerateLDLTSBK * \sa \ref TutorialSparseSolverConcept, class AccelerateLDLTSBK
*/ */
template <typename MatrixType, int UpLo = Lower | Symmetric> template <typename MatrixType, int UpLo = Lower>
using AccelerateLDLTSBK = AccelerateImpl<MatrixType, UpLo, SparseFactorizationLDLTSBK, true>; using AccelerateLDLTSBK = AccelerateImpl<MatrixType, UpLo | Symmetric, SparseFactorizationLDLTSBK, true>;
/** \ingroup AccelerateSupport_Module /** \ingroup AccelerateSupport_Module
* \class AccelerateLDLTTPP * \class AccelerateLDLTTPP
@ -73,12 +73,12 @@ using AccelerateLDLTSBK = AccelerateImpl<MatrixType, UpLo, SparseFactorizationLD
* \warning Only single and double precision real scalar types are supported by Accelerate * \warning Only single and double precision real scalar types are supported by Accelerate
* *
* \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<>
* \tparam UpLo_ additional information about the matrix structure. Default is Lower | Symmetric. * \tparam UpLo_ additional information about the matrix structure. Default is Lower.
* *
* \sa \ref TutorialSparseSolverConcept, class AccelerateLDLTTPP * \sa \ref TutorialSparseSolverConcept, class AccelerateLDLTTPP
*/ */
template <typename MatrixType, int UpLo = Lower | Symmetric> template <typename MatrixType, int UpLo = Lower>
using AccelerateLDLTTPP = AccelerateImpl<MatrixType, UpLo, SparseFactorizationLDLTTPP, true>; using AccelerateLDLTTPP = AccelerateImpl<MatrixType, UpLo | Symmetric, SparseFactorizationLDLTTPP, true>;
/** \ingroup AccelerateSupport_Module /** \ingroup AccelerateSupport_Module
* \class AccelerateQR * \class AccelerateQR
@ -87,12 +87,11 @@ using AccelerateLDLTTPP = AccelerateImpl<MatrixType, UpLo, SparseFactorizationLD
* \warning Only single and double precision real scalar types are supported by Accelerate * \warning Only single and double precision real scalar types are supported by Accelerate
* *
* \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<>
* \tparam UpLo_ additional information about the matrix structure. Default is 0.
* *
* \sa \ref TutorialSparseSolverConcept, class AccelerateQR * \sa \ref TutorialSparseSolverConcept, class AccelerateQR
*/ */
template <typename MatrixType, int UpLo = 0> template <typename MatrixType>
using AccelerateQR = AccelerateImpl<MatrixType, UpLo, SparseFactorizationQR, false>; using AccelerateQR = AccelerateImpl<MatrixType, 0, SparseFactorizationQR, false>;
/** \ingroup AccelerateSupport_Module /** \ingroup AccelerateSupport_Module
* \class AccelerateCholeskyAtA * \class AccelerateCholeskyAtA
@ -101,12 +100,11 @@ using AccelerateQR = AccelerateImpl<MatrixType, UpLo, SparseFactorizationQR, fal
* \warning Only single and double precision real scalar types are supported by Accelerate * \warning Only single and double precision real scalar types are supported by Accelerate
* *
* \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<>
* \tparam UpLo_ additional information about the matrix structure. Default is 0.
* *
* \sa \ref TutorialSparseSolverConcept, class AccelerateCholeskyAtA * \sa \ref TutorialSparseSolverConcept, class AccelerateCholeskyAtA
*/ */
template <typename MatrixType, int UpLo = 0> template <typename MatrixType>
using AccelerateCholeskyAtA = AccelerateImpl<MatrixType, UpLo, SparseFactorizationCholeskyAtA, false>; using AccelerateCholeskyAtA = AccelerateImpl<MatrixType, 0, SparseFactorizationCholeskyAtA, false>;
namespace internal { namespace internal {
template <typename T> template <typename T>

View File

@ -152,21 +152,21 @@ void run_tests()
{ {
typedef SparseMatrix<Scalar> MatrixType; typedef SparseMatrix<Scalar> MatrixType;
test_accelerate_ldlt<Scalar, AccelerateLDLT<MatrixType, Lower | Symmetric> >(); test_accelerate_ldlt<Scalar, AccelerateLDLT<MatrixType, Lower> >();
test_accelerate_ldlt<Scalar, AccelerateLDLTUnpivoted<MatrixType, Lower | Symmetric> >(); test_accelerate_ldlt<Scalar, AccelerateLDLTUnpivoted<MatrixType, Lower> >();
test_accelerate_ldlt<Scalar, AccelerateLDLTSBK<MatrixType, Lower | Symmetric> >(); test_accelerate_ldlt<Scalar, AccelerateLDLTSBK<MatrixType, Lower> >();
test_accelerate_ldlt<Scalar, AccelerateLDLTTPP<MatrixType, Lower | Symmetric> >(); test_accelerate_ldlt<Scalar, AccelerateLDLTTPP<MatrixType, Lower> >();
test_accelerate_ldlt<Scalar, AccelerateLDLT<MatrixType, Upper | Symmetric> >(); test_accelerate_ldlt<Scalar, AccelerateLDLT<MatrixType, Upper> >();
test_accelerate_ldlt<Scalar, AccelerateLDLTUnpivoted<MatrixType, Upper | Symmetric> >(); test_accelerate_ldlt<Scalar, AccelerateLDLTUnpivoted<MatrixType, Upper> >();
test_accelerate_ldlt<Scalar, AccelerateLDLTSBK<MatrixType, Upper | Symmetric> >(); test_accelerate_ldlt<Scalar, AccelerateLDLTSBK<MatrixType, Upper> >();
test_accelerate_ldlt<Scalar, AccelerateLDLTTPP<MatrixType, Upper | Symmetric> >(); test_accelerate_ldlt<Scalar, AccelerateLDLTTPP<MatrixType, Upper> >();
test_accelerate_llt<Scalar, AccelerateLLT<MatrixType, Lower | Symmetric> >(); test_accelerate_llt<Scalar, AccelerateLLT<MatrixType, Lower> >();
test_accelerate_llt<Scalar, AccelerateLLT<MatrixType, Upper | Symmetric> >(); test_accelerate_llt<Scalar, AccelerateLLT<MatrixType, Upper> >();
test_accelerate_qr<Scalar, AccelerateQR<MatrixType, 0> >(); test_accelerate_qr<Scalar, AccelerateQR<MatrixType> >();
} }
EIGEN_DECLARE_TEST(accelerate_support) EIGEN_DECLARE_TEST(accelerate_support)