mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
btl: add a trmm action and update eigen interface
This commit is contained in:
@@ -134,6 +134,7 @@ static char trans = 'T';
|
||||
static char nonunit = 'N';
|
||||
static char lower = 'L';
|
||||
static char right = 'R';
|
||||
static char left = 'L';
|
||||
static int intone = 1;
|
||||
|
||||
template<>
|
||||
@@ -186,7 +187,7 @@ public :
|
||||
cblas_srot(N,A,1,B,1,c,s);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
#ifdef PUREBLAS
|
||||
sgemv_(&trans,&N,&N,&fone,A,&N,B,&intone,&fzero,X,&intone);
|
||||
@@ -274,7 +275,7 @@ public :
|
||||
sgetc2_(&N, C, &N, ipiv, jpiv, &info);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){
|
||||
#ifdef PUREBLAS
|
||||
@@ -338,6 +339,14 @@ public :
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void trmm(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){
|
||||
#ifdef PUREBLAS
|
||||
strmm_(&left, &lower, ¬rans,&nonunit, &N,&N,&fone,A,&N,B,&N);
|
||||
#else
|
||||
cblas_strmm(CblasColMajor, CblasLeft, CblasLower, CblasNoTrans,CblasNonUnit, N,N,1,A,N,B,N);
|
||||
#endif
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ int main()
|
||||
bench<Action_trisolve<C_BLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_trisolve_matrix<C_BLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_trmm<C_BLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_cholesky<C_BLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_partial_lu<C_BLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
|
||||
@@ -197,6 +197,10 @@ public :
|
||||
X = L.template triangularView<Lower>().solve(B);
|
||||
}
|
||||
|
||||
static inline void trmm(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int N){
|
||||
X = L.template triangularView<Lower>() * B;
|
||||
}
|
||||
|
||||
static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){
|
||||
C = X;
|
||||
ei_llt_inplace<Lower>::blocked(C);
|
||||
@@ -211,8 +215,8 @@ public :
|
||||
}
|
||||
|
||||
static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
|
||||
RowVectorXi piv(N);
|
||||
int nb;
|
||||
Matrix<DenseIndex,1,Dynamic> piv(N);
|
||||
DenseIndex nb;
|
||||
C = X;
|
||||
ei_partial_lu_inplace(C,piv,nb);
|
||||
// C = X.partialPivLu().matrixLU();
|
||||
@@ -221,8 +225,7 @@ public :
|
||||
static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){
|
||||
typename Tridiagonalization<gene_matrix>::CoeffVectorType aux(N-1);
|
||||
C = X;
|
||||
Tridiagonalization<gene_matrix>::_compute(C, aux);
|
||||
// C = Tridiagonalization<gene_matrix>(X).packedMatrix();
|
||||
ei_tridiagonalization_inplace(C, aux);
|
||||
}
|
||||
|
||||
static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){
|
||||
|
||||
@@ -27,6 +27,7 @@ int main()
|
||||
bench<Action_matrix_matrix_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_ata_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_aat_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_trmm<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user