ADD: added other eigen lib

This commit is contained in:
Henry Winkel
2022-12-21 16:19:04 +01:00
parent a570766dc6
commit 9e56c7f2c0
832 changed files with 36586 additions and 20006 deletions

View File

@@ -29,11 +29,9 @@ struct band_solve_triangular_selector<Index,Mode,LhsScalar,ConjLhs,RhsScalar,Row
{
const LhsMap lhs(_lhs,size,k+1,OuterStride<>(lhsStride));
RhsMap other(_other,size,1);
typename internal::conditional<
ConjLhs,
const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,
const LhsMap&>
::type cjLhs(lhs);
std::conditional_t<ConjLhs,
const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,
const LhsMap&> cjLhs(lhs);
for(int col=0 ; col<other.cols() ; ++col)
{
@@ -65,11 +63,9 @@ struct band_solve_triangular_selector<Index,Mode,LhsScalar,ConjLhs,RhsScalar,Col
{
const LhsMap lhs(_lhs,k+1,size,OuterStride<>(lhsStride));
RhsMap other(_other,size,1);
typename internal::conditional<
ConjLhs,
const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,
const LhsMap&>
::type cjLhs(lhs);
std::conditional_t<ConjLhs,
const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,
const LhsMap&> cjLhs(lhs);
for(int col=0 ; col<other.cols() ; ++col)
{

View File

@@ -1,6 +1,7 @@
project(EigenBlas CXX)
if(EIGEN_BUILD_BLAS)
include(CheckLanguage)
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
@@ -50,7 +51,7 @@ endforeach()
if(EIGEN_Fortran_COMPILER_WORKS)
if(BUILD_TESTING)
if(EIGEN_BUILD_TESTING)
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
add_subdirectory(testing) # can't do EXCLUDE_FROM_ALL here, breaks CTest
else()
@@ -59,4 +60,4 @@ if(BUILD_TESTING)
endif()
endif()
endif()

View File

@@ -31,15 +31,16 @@ struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsS
typedef typename conj_expr_if<ConjLhs,LhsMap>::type ConjLhsType;
typedef Map<Matrix<ResScalar,Dynamic,1> > ResMap;
for (Index i=0; i<size; ++i)
{
Index s = IsLower&&(HasUnitDiag||HasZeroDiag) ? 1 : 0;
Index r = IsLower ? size-i: i+1;
if (EIGEN_IMPLIES(HasUnitDiag||HasZeroDiag, (--r)>0))
ResMap(res+(IsLower ? s+i : 0),r) += alpha * cj(rhs[i]) * ConjLhsType(LhsMap(lhs+s,r));
if (HasUnitDiag)
res[i] += alpha * cj(rhs[i]);
lhs += IsLower ? size-i: i+1;
for (Index i = 0; i < size; ++i) {
Index s = IsLower && (HasUnitDiag || HasZeroDiag) ? 1 : 0;
Index r = IsLower ? size - i : i + 1;
if (!(HasUnitDiag || HasZeroDiag) || (--r > 0)) {
ResMap(res + (IsLower ? s + i : 0), r) += alpha * cj(rhs[i]) * ConjLhsType(LhsMap(lhs + s, r));
}
if (HasUnitDiag) {
res[i] += alpha * cj(rhs[i]);
}
lhs += IsLower ? size - i : i + 1;
}
};
};
@@ -61,15 +62,16 @@ struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsS
typedef Map<const Matrix<RhsScalar,Dynamic,1> > RhsMap;
typedef typename conj_expr_if<ConjRhs,RhsMap>::type ConjRhsType;
for (Index i=0; i<size; ++i)
{
Index s = !IsLower&&(HasUnitDiag||HasZeroDiag) ? 1 : 0;
Index r = IsLower ? i+1 : size-i;
if (EIGEN_IMPLIES(HasUnitDiag||HasZeroDiag, (--r)>0))
res[i] += alpha * (ConjLhsType(LhsMap(lhs+s,r)).cwiseProduct(ConjRhsType(RhsMap(rhs+(IsLower ? 0 : s+i),r)))).sum();
if (HasUnitDiag)
res[i] += alpha * cj(rhs[i]);
lhs += IsLower ? i+1 : size-i;
for (Index i = 0; i < size; ++i) {
Index s = !IsLower && (HasUnitDiag || HasZeroDiag) ? 1 : 0;
Index r = IsLower ? i + 1 : size - i;
if (!(HasUnitDiag || HasZeroDiag) || (--r > 0)) {
res[i] += alpha * (ConjLhsType(LhsMap(lhs + s, r)).cwiseProduct(ConjRhsType(RhsMap(rhs + (IsLower ? 0 : s + i), r)))).sum();
}
if (HasUnitDiag) {
res[i] += alpha * cj(rhs[i]);
}
lhs += IsLower ? i + 1 : size - i;
}
};
};

View File

@@ -149,7 +149,7 @@ T* get_compact_vector(T* x, int n, int incx)
if(incx==1)
return x;
typename Eigen::internal::remove_const<T>::type* ret = new Scalar[n];
std::remove_const_t<T>* ret = new Scalar[n];
if(incx<0) make_vector(ret,n) = make_vector(x,n,-incx).reverse();
else make_vector(ret,n) = make_vector(x,n, incx);
return ret;

View File

@@ -11,7 +11,6 @@
struct scalar_norm1_op {
typedef RealScalar result_type;
EIGEN_EMPTY_STRUCT_CTOR(scalar_norm1_op)
inline RealScalar operator() (const Scalar& a) const { return numext::norm1(a); }
};
namespace Eigen {

View File

@@ -362,18 +362,18 @@ int EIGEN_BLAS_FUNC(syrk)(const char *uplo, const char *op, const int *n, const
typedef void (*functype)(DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, DenseIndex, const Scalar&, internal::level3_blocking<Scalar,Scalar>&);
static const functype func[8] = {
// array index: NOTR | (UP << 2)
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,ColMajor,Conj, 1, Upper>::run),
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,Conj,ColMajor, 1, Upper>::run),
// array index: TR | (UP << 2)
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,false,Scalar,ColMajor,ColMajor,Conj, 1, Upper>::run),
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,false,Scalar,ColMajor,Conj,ColMajor, 1, Upper>::run),
// array index: ADJ | (UP << 2)
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,ColMajor,ColMajor,false,1, Upper>::run),
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,ColMajor,false,ColMajor, 1, Upper>::run),
0,
// array index: NOTR | (LO << 2)
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,ColMajor,Conj, 1, Lower>::run),
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,Conj,ColMajor, 1, Lower>::run),
// array index: TR | (LO << 2)
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,false,Scalar,ColMajor,ColMajor,Conj, 1, Lower>::run),
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,false,Scalar,ColMajor,Conj,ColMajor, 1, Lower>::run),
// array index: ADJ | (LO << 2)
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,ColMajor,ColMajor,false,1, Lower>::run),
(internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,ColMajor,false,ColMajor, 1, Lower>::run),
0
};
#endif