From a7a05382d1c51964bf3ea0536c6ddd9cc9888b72 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 4 Aug 2008 23:12:48 +0000 Subject: Add a LU decomposition action in BTL and various cleaning in BTL. For instance all per plot settings have been moved to a single file, go_mean now takes an optional second argument "tiny" to generate plots for tiny matrices, and output of comparison information wrt to previous benchs (if any). --- bench/btl/libs/C_BLAS/C_BLAS_interface.hh | 18 +++++++++++++++++- bench/btl/libs/C_BLAS/main.cpp | 6 ++++-- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'bench/btl/libs/C_BLAS') diff --git a/bench/btl/libs/C_BLAS/C_BLAS_interface.hh b/bench/btl/libs/C_BLAS/C_BLAS_interface.hh index a3ea73740..21d9bde1a 100644 --- a/bench/btl/libs/C_BLAS/C_BLAS_interface.hh +++ b/bench/btl/libs/C_BLAS/C_BLAS_interface.hh @@ -50,6 +50,11 @@ void scopy_(const int *n, const float *x, const int *incx, float *y, const int * void dpotrf_(const char* uplo, const int* n, double *a, const int* ld, int* info); void ssytrd_(char *uplo, const int *n, float *a, const int *lda, float *d, float *e, float *tau, float *work, int *lwork, int *info ); void sgehrd_( const int *n, int *ilo, int *ihi, float *a, const int *lda, float *tau, float *work, int *lwork, int *info ); + + // LU row pivoting + void sgetrf_(const int* m, const int* n, float *a, const int* ld, int* ipivot, int* info); + // LU full pivoting + void sgetc2_(const int* n, float *a, const int *lda, int *ipiv, int *jpiv, int*info ); #ifdef HAS_LAPACK #endif } @@ -193,7 +198,8 @@ public : } static inline void cholesky(const gene_vector & X, gene_vector & C, int N){ - cblas_scopy(N*N, X, 1, C, 1); + int N2 = N*N; + scopy_(&N2, X, &intone, C, &intone); char uplo = 'L'; int info = 0; spotrf_(&uplo, &N, C, &N, &info); @@ -201,6 +207,16 @@ public : #ifdef HAS_LAPACK + static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ + int N2 = N*N; + scopy_(&N2, X, &intone, C, &intone); + char uplo = 'L'; + int info = 0; + int * ipiv = (int*)alloca(sizeof(int)*N); + int * jpiv = (int*)alloca(sizeof(int)*N); + sgetc2_(&N, C, &N, ipiv, jpiv, &info); + } + static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){ cblas_scopy(N*N, X, 1, C, 1); int info = 0; diff --git a/bench/btl/libs/C_BLAS/main.cpp b/bench/btl/libs/C_BLAS/main.cpp index 81b350325..21da0b4aa 100644 --- a/bench/btl/libs/C_BLAS/main.cpp +++ b/bench/btl/libs/C_BLAS/main.cpp @@ -23,6 +23,7 @@ #include "basic_actions.hh" #include "action_cholesky.hh" +#include "action_lu_decomp.hh" #ifdef HAS_LAPACK #include "action_hessenberg.hh" @@ -45,9 +46,10 @@ int main() bench > >(MIN_MM,MAX_MM,NB_POINT); -// bench > >(MIN_MM,MAX_MM,NB_POINT); - + bench > >(MIN_MM,MAX_MM,NB_POINT); + #ifdef HAS_LAPACK + bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); #endif -- cgit v1.2.3