Disabled external gits
This commit is contained in:
47
cs440-acg/ext/eigen/bench/btl/libs/BLAS/CMakeLists.txt
Normal file
47
cs440-acg/ext/eigen/bench/btl/libs/BLAS/CMakeLists.txt
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
find_package(ATLAS)
|
||||
if (ATLAS_FOUND)
|
||||
btl_add_bench(btl_atlas main.cpp)
|
||||
if(BUILD_btl_atlas)
|
||||
target_link_libraries(btl_atlas ${ATLAS_LIBRARIES})
|
||||
set_target_properties(btl_atlas PROPERTIES COMPILE_FLAGS "-DCBLASNAME=ATLAS -DHAS_LAPACK=1")
|
||||
endif(BUILD_btl_atlas)
|
||||
endif (ATLAS_FOUND)
|
||||
|
||||
find_package(MKL)
|
||||
if (MKL_FOUND)
|
||||
btl_add_bench(btl_mkl main.cpp)
|
||||
if(BUILD_btl_mkl)
|
||||
target_link_libraries(btl_mkl ${MKL_LIBRARIES})
|
||||
set_target_properties(btl_mkl PROPERTIES COMPILE_FLAGS "-DCBLASNAME=INTEL_MKL -DHAS_LAPACK=1")
|
||||
endif(BUILD_btl_mkl)
|
||||
endif (MKL_FOUND)
|
||||
|
||||
|
||||
find_package(OPENBLAS)
|
||||
if (OPENBLAS_FOUND)
|
||||
btl_add_bench(btl_openblas main.cpp)
|
||||
if(BUILD_btl_openblas)
|
||||
target_link_libraries(btl_openblas ${OPENBLAS_LIBRARIES} )
|
||||
set_target_properties(btl_openblas PROPERTIES COMPILE_FLAGS "-DCBLASNAME=OPENBLAS")
|
||||
endif(BUILD_btl_openblas)
|
||||
endif (OPENBLAS_FOUND)
|
||||
|
||||
find_package(ACML)
|
||||
if (ACML_FOUND)
|
||||
btl_add_bench(btl_acml main.cpp)
|
||||
if(BUILD_btl_acml)
|
||||
target_link_libraries(btl_acml ${ACML_LIBRARIES} )
|
||||
set_target_properties(btl_acml PROPERTIES COMPILE_FLAGS "-DCBLASNAME=ACML -DHAS_LAPACK=1")
|
||||
endif(BUILD_btl_acml)
|
||||
endif (ACML_FOUND)
|
||||
|
||||
if(Eigen_SOURCE_DIR AND CMAKE_Fortran_COMPILER_WORKS)
|
||||
# we are inside Eigen and blas/lapack interface is compilable
|
||||
include_directories(${Eigen_SOURCE_DIR})
|
||||
btl_add_bench(btl_eigenblas main.cpp)
|
||||
if(BUILD_btl_eigenblas)
|
||||
target_link_libraries(btl_eigenblas eigen_blas eigen_lapack )
|
||||
set_target_properties(btl_eigenblas PROPERTIES COMPILE_FLAGS "-DCBLASNAME=EigenBLAS")
|
||||
endif()
|
||||
endif()
|
675
cs440-acg/ext/eigen/bench/btl/libs/BLAS/blas.h
Normal file
675
cs440-acg/ext/eigen/bench/btl/libs/BLAS/blas.h
Normal file
@@ -0,0 +1,675 @@
|
||||
#ifndef BLAS_H
|
||||
#define BLAS_H
|
||||
|
||||
#define BLASFUNC(FUNC) FUNC##_
|
||||
|
||||
#ifdef __WIN64__
|
||||
typedef long long BLASLONG;
|
||||
typedef unsigned long long BLASULONG;
|
||||
#else
|
||||
typedef long BLASLONG;
|
||||
typedef unsigned long BLASULONG;
|
||||
#endif
|
||||
|
||||
int BLASFUNC(xerbla)(const char *, int *info, int);
|
||||
|
||||
float BLASFUNC(sdot) (int *, float *, int *, float *, int *);
|
||||
float BLASFUNC(sdsdot)(int *, float *, float *, int *, float *, int *);
|
||||
|
||||
double BLASFUNC(dsdot) (int *, float *, int *, float *, int *);
|
||||
double BLASFUNC(ddot) (int *, double *, int *, double *, int *);
|
||||
double BLASFUNC(qdot) (int *, double *, int *, double *, int *);
|
||||
|
||||
#if defined(F_INTERFACE_GFORT) && !defined(__64BIT__)
|
||||
int BLASFUNC(cdotu) (int *, float * , int *, float *, int *);
|
||||
int BLASFUNC(cdotc) (int *, float *, int *, float *, int *);
|
||||
void BLASFUNC(zdotu) (double *, int *, double *, int *, double *, int *);
|
||||
void BLASFUNC(zdotc) (double *, int *, double *, int *, double *, int *);
|
||||
void BLASFUNC(xdotu) (double *, int *, double *, int *, double *, int *);
|
||||
void BLASFUNC(xdotc) (double *, int *, double *, int *, double *, int *);
|
||||
#elif defined(F_INTERFACE_F2C) || \
|
||||
defined(F_INTERFACE_PGI) || \
|
||||
defined(F_INTERFACE_GFORT) || \
|
||||
(defined(F_INTERFACE_PATHSCALE) && defined(__64BIT__))
|
||||
void BLASFUNC(cdotu) (float *, int *, float * , int *, float *, int *);
|
||||
void BLASFUNC(cdotc) (float *, int *, float *, int *, float *, int *);
|
||||
void BLASFUNC(zdotu) (double *, int *, double *, int *, double *, int *);
|
||||
void BLASFUNC(zdotc) (double *, int *, double *, int *, double *, int *);
|
||||
void BLASFUNC(xdotu) (double *, int *, double *, int *, double *, int *);
|
||||
void BLASFUNC(xdotc) (double *, int *, double *, int *, double *, int *);
|
||||
#else
|
||||
std::complex<float> BLASFUNC(cdotu) (int *, float *, int *, float *, int *);
|
||||
std::complex<float> BLASFUNC(cdotc) (int *, float *, int *, float *, int *);
|
||||
std::complex<double> BLASFUNC(zdotu) (int *, double *, int *, double *, int *);
|
||||
std::complex<double> BLASFUNC(zdotc) (int *, double *, int *, double *, int *);
|
||||
double BLASFUNC(xdotu) (int *, double *, int *, double *, int *);
|
||||
double BLASFUNC(xdotc) (int *, double *, int *, double *, int *);
|
||||
#endif
|
||||
|
||||
int BLASFUNC(cdotuw) (int *, float *, int *, float *, int *, float*);
|
||||
int BLASFUNC(cdotcw) (int *, float *, int *, float *, int *, float*);
|
||||
int BLASFUNC(zdotuw) (int *, double *, int *, double *, int *, double*);
|
||||
int BLASFUNC(zdotcw) (int *, double *, int *, double *, int *, double*);
|
||||
|
||||
int BLASFUNC(saxpy) (int *, float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(daxpy) (int *, double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(qaxpy) (int *, double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(caxpy) (int *, float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(zaxpy) (int *, double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(xaxpy) (int *, double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(caxpyc)(int *, float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(zaxpyc)(int *, double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(xaxpyc)(int *, double *, double *, int *, double *, int *);
|
||||
|
||||
int BLASFUNC(scopy) (int *, float *, int *, float *, int *);
|
||||
int BLASFUNC(dcopy) (int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(qcopy) (int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(ccopy) (int *, float *, int *, float *, int *);
|
||||
int BLASFUNC(zcopy) (int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(xcopy) (int *, double *, int *, double *, int *);
|
||||
|
||||
int BLASFUNC(sswap) (int *, float *, int *, float *, int *);
|
||||
int BLASFUNC(dswap) (int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(qswap) (int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(cswap) (int *, float *, int *, float *, int *);
|
||||
int BLASFUNC(zswap) (int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(xswap) (int *, double *, int *, double *, int *);
|
||||
|
||||
float BLASFUNC(sasum) (int *, float *, int *);
|
||||
float BLASFUNC(scasum)(int *, float *, int *);
|
||||
double BLASFUNC(dasum) (int *, double *, int *);
|
||||
double BLASFUNC(qasum) (int *, double *, int *);
|
||||
double BLASFUNC(dzasum)(int *, double *, int *);
|
||||
double BLASFUNC(qxasum)(int *, double *, int *);
|
||||
|
||||
int BLASFUNC(isamax)(int *, float *, int *);
|
||||
int BLASFUNC(idamax)(int *, double *, int *);
|
||||
int BLASFUNC(iqamax)(int *, double *, int *);
|
||||
int BLASFUNC(icamax)(int *, float *, int *);
|
||||
int BLASFUNC(izamax)(int *, double *, int *);
|
||||
int BLASFUNC(ixamax)(int *, double *, int *);
|
||||
|
||||
int BLASFUNC(ismax) (int *, float *, int *);
|
||||
int BLASFUNC(idmax) (int *, double *, int *);
|
||||
int BLASFUNC(iqmax) (int *, double *, int *);
|
||||
int BLASFUNC(icmax) (int *, float *, int *);
|
||||
int BLASFUNC(izmax) (int *, double *, int *);
|
||||
int BLASFUNC(ixmax) (int *, double *, int *);
|
||||
|
||||
int BLASFUNC(isamin)(int *, float *, int *);
|
||||
int BLASFUNC(idamin)(int *, double *, int *);
|
||||
int BLASFUNC(iqamin)(int *, double *, int *);
|
||||
int BLASFUNC(icamin)(int *, float *, int *);
|
||||
int BLASFUNC(izamin)(int *, double *, int *);
|
||||
int BLASFUNC(ixamin)(int *, double *, int *);
|
||||
|
||||
int BLASFUNC(ismin)(int *, float *, int *);
|
||||
int BLASFUNC(idmin)(int *, double *, int *);
|
||||
int BLASFUNC(iqmin)(int *, double *, int *);
|
||||
int BLASFUNC(icmin)(int *, float *, int *);
|
||||
int BLASFUNC(izmin)(int *, double *, int *);
|
||||
int BLASFUNC(ixmin)(int *, double *, int *);
|
||||
|
||||
float BLASFUNC(samax) (int *, float *, int *);
|
||||
double BLASFUNC(damax) (int *, double *, int *);
|
||||
double BLASFUNC(qamax) (int *, double *, int *);
|
||||
float BLASFUNC(scamax)(int *, float *, int *);
|
||||
double BLASFUNC(dzamax)(int *, double *, int *);
|
||||
double BLASFUNC(qxamax)(int *, double *, int *);
|
||||
|
||||
float BLASFUNC(samin) (int *, float *, int *);
|
||||
double BLASFUNC(damin) (int *, double *, int *);
|
||||
double BLASFUNC(qamin) (int *, double *, int *);
|
||||
float BLASFUNC(scamin)(int *, float *, int *);
|
||||
double BLASFUNC(dzamin)(int *, double *, int *);
|
||||
double BLASFUNC(qxamin)(int *, double *, int *);
|
||||
|
||||
float BLASFUNC(smax) (int *, float *, int *);
|
||||
double BLASFUNC(dmax) (int *, double *, int *);
|
||||
double BLASFUNC(qmax) (int *, double *, int *);
|
||||
float BLASFUNC(scmax) (int *, float *, int *);
|
||||
double BLASFUNC(dzmax) (int *, double *, int *);
|
||||
double BLASFUNC(qxmax) (int *, double *, int *);
|
||||
|
||||
float BLASFUNC(smin) (int *, float *, int *);
|
||||
double BLASFUNC(dmin) (int *, double *, int *);
|
||||
double BLASFUNC(qmin) (int *, double *, int *);
|
||||
float BLASFUNC(scmin) (int *, float *, int *);
|
||||
double BLASFUNC(dzmin) (int *, double *, int *);
|
||||
double BLASFUNC(qxmin) (int *, double *, int *);
|
||||
|
||||
int BLASFUNC(sscal) (int *, float *, float *, int *);
|
||||
int BLASFUNC(dscal) (int *, double *, double *, int *);
|
||||
int BLASFUNC(qscal) (int *, double *, double *, int *);
|
||||
int BLASFUNC(cscal) (int *, float *, float *, int *);
|
||||
int BLASFUNC(zscal) (int *, double *, double *, int *);
|
||||
int BLASFUNC(xscal) (int *, double *, double *, int *);
|
||||
int BLASFUNC(csscal)(int *, float *, float *, int *);
|
||||
int BLASFUNC(zdscal)(int *, double *, double *, int *);
|
||||
int BLASFUNC(xqscal)(int *, double *, double *, int *);
|
||||
|
||||
float BLASFUNC(snrm2) (int *, float *, int *);
|
||||
float BLASFUNC(scnrm2)(int *, float *, int *);
|
||||
|
||||
double BLASFUNC(dnrm2) (int *, double *, int *);
|
||||
double BLASFUNC(qnrm2) (int *, double *, int *);
|
||||
double BLASFUNC(dznrm2)(int *, double *, int *);
|
||||
double BLASFUNC(qxnrm2)(int *, double *, int *);
|
||||
|
||||
int BLASFUNC(srot) (int *, float *, int *, float *, int *, float *, float *);
|
||||
int BLASFUNC(drot) (int *, double *, int *, double *, int *, double *, double *);
|
||||
int BLASFUNC(qrot) (int *, double *, int *, double *, int *, double *, double *);
|
||||
int BLASFUNC(csrot) (int *, float *, int *, float *, int *, float *, float *);
|
||||
int BLASFUNC(zdrot) (int *, double *, int *, double *, int *, double *, double *);
|
||||
int BLASFUNC(xqrot) (int *, double *, int *, double *, int *, double *, double *);
|
||||
|
||||
int BLASFUNC(srotg) (float *, float *, float *, float *);
|
||||
int BLASFUNC(drotg) (double *, double *, double *, double *);
|
||||
int BLASFUNC(qrotg) (double *, double *, double *, double *);
|
||||
int BLASFUNC(crotg) (float *, float *, float *, float *);
|
||||
int BLASFUNC(zrotg) (double *, double *, double *, double *);
|
||||
int BLASFUNC(xrotg) (double *, double *, double *, double *);
|
||||
|
||||
int BLASFUNC(srotmg)(float *, float *, float *, float *, float *);
|
||||
int BLASFUNC(drotmg)(double *, double *, double *, double *, double *);
|
||||
|
||||
int BLASFUNC(srotm) (int *, float *, int *, float *, int *, float *);
|
||||
int BLASFUNC(drotm) (int *, double *, int *, double *, int *, double *);
|
||||
int BLASFUNC(qrotm) (int *, double *, int *, double *, int *, double *);
|
||||
|
||||
/* Level 2 routines */
|
||||
|
||||
int BLASFUNC(sger)(int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, int *);
|
||||
int BLASFUNC(dger)(int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, int *);
|
||||
int BLASFUNC(qger)(int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, int *);
|
||||
int BLASFUNC(cgeru)(int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, int *);
|
||||
int BLASFUNC(cgerc)(int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, int *);
|
||||
int BLASFUNC(zgeru)(int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, int *);
|
||||
int BLASFUNC(zgerc)(int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, int *);
|
||||
int BLASFUNC(xgeru)(int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, int *);
|
||||
int BLASFUNC(xgerc)(int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, int *);
|
||||
|
||||
int BLASFUNC(sgemv)(char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(dgemv)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(qgemv)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(cgemv)(char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zgemv)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xgemv)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(strsv) (char *, char *, char *, int *, float *, int *,
|
||||
float *, int *);
|
||||
int BLASFUNC(dtrsv) (char *, char *, char *, int *, double *, int *,
|
||||
double *, int *);
|
||||
int BLASFUNC(qtrsv) (char *, char *, char *, int *, double *, int *,
|
||||
double *, int *);
|
||||
int BLASFUNC(ctrsv) (char *, char *, char *, int *, float *, int *,
|
||||
float *, int *);
|
||||
int BLASFUNC(ztrsv) (char *, char *, char *, int *, double *, int *,
|
||||
double *, int *);
|
||||
int BLASFUNC(xtrsv) (char *, char *, char *, int *, double *, int *,
|
||||
double *, int *);
|
||||
|
||||
int BLASFUNC(stpsv) (char *, char *, char *, int *, float *, float *, int *);
|
||||
int BLASFUNC(dtpsv) (char *, char *, char *, int *, double *, double *, int *);
|
||||
int BLASFUNC(qtpsv) (char *, char *, char *, int *, double *, double *, int *);
|
||||
int BLASFUNC(ctpsv) (char *, char *, char *, int *, float *, float *, int *);
|
||||
int BLASFUNC(ztpsv) (char *, char *, char *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xtpsv) (char *, char *, char *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(strmv) (char *, char *, char *, int *, float *, int *,
|
||||
float *, int *);
|
||||
int BLASFUNC(dtrmv) (char *, char *, char *, int *, double *, int *,
|
||||
double *, int *);
|
||||
int BLASFUNC(qtrmv) (char *, char *, char *, int *, double *, int *,
|
||||
double *, int *);
|
||||
int BLASFUNC(ctrmv) (char *, char *, char *, int *, float *, int *,
|
||||
float *, int *);
|
||||
int BLASFUNC(ztrmv) (char *, char *, char *, int *, double *, int *,
|
||||
double *, int *);
|
||||
int BLASFUNC(xtrmv) (char *, char *, char *, int *, double *, int *,
|
||||
double *, int *);
|
||||
|
||||
int BLASFUNC(stpmv) (char *, char *, char *, int *, float *, float *, int *);
|
||||
int BLASFUNC(dtpmv) (char *, char *, char *, int *, double *, double *, int *);
|
||||
int BLASFUNC(qtpmv) (char *, char *, char *, int *, double *, double *, int *);
|
||||
int BLASFUNC(ctpmv) (char *, char *, char *, int *, float *, float *, int *);
|
||||
int BLASFUNC(ztpmv) (char *, char *, char *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xtpmv) (char *, char *, char *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(stbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *);
|
||||
int BLASFUNC(dtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(qtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(ctbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *);
|
||||
int BLASFUNC(ztbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(xtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
|
||||
|
||||
int BLASFUNC(stbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *);
|
||||
int BLASFUNC(dtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(qtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(ctbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *);
|
||||
int BLASFUNC(ztbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(xtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
|
||||
|
||||
int BLASFUNC(ssymv) (char *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(dsymv) (char *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(qsymv) (char *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(csymv) (char *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zsymv) (char *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xsymv) (char *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(sspmv) (char *, int *, float *, float *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(dspmv) (char *, int *, double *, double *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(qspmv) (char *, int *, double *, double *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(cspmv) (char *, int *, float *, float *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zspmv) (char *, int *, double *, double *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xspmv) (char *, int *, double *, double *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(ssyr) (char *, int *, float *, float *, int *,
|
||||
float *, int *);
|
||||
int BLASFUNC(dsyr) (char *, int *, double *, double *, int *,
|
||||
double *, int *);
|
||||
int BLASFUNC(qsyr) (char *, int *, double *, double *, int *,
|
||||
double *, int *);
|
||||
int BLASFUNC(csyr) (char *, int *, float *, float *, int *,
|
||||
float *, int *);
|
||||
int BLASFUNC(zsyr) (char *, int *, double *, double *, int *,
|
||||
double *, int *);
|
||||
int BLASFUNC(xsyr) (char *, int *, double *, double *, int *,
|
||||
double *, int *);
|
||||
|
||||
int BLASFUNC(ssyr2) (char *, int *, float *,
|
||||
float *, int *, float *, int *, float *, int *);
|
||||
int BLASFUNC(dsyr2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(qsyr2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(csyr2) (char *, int *, float *,
|
||||
float *, int *, float *, int *, float *, int *);
|
||||
int BLASFUNC(zsyr2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(xsyr2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *, int *);
|
||||
|
||||
int BLASFUNC(sspr) (char *, int *, float *, float *, int *,
|
||||
float *);
|
||||
int BLASFUNC(dspr) (char *, int *, double *, double *, int *,
|
||||
double *);
|
||||
int BLASFUNC(qspr) (char *, int *, double *, double *, int *,
|
||||
double *);
|
||||
int BLASFUNC(cspr) (char *, int *, float *, float *, int *,
|
||||
float *);
|
||||
int BLASFUNC(zspr) (char *, int *, double *, double *, int *,
|
||||
double *);
|
||||
int BLASFUNC(xspr) (char *, int *, double *, double *, int *,
|
||||
double *);
|
||||
|
||||
int BLASFUNC(sspr2) (char *, int *, float *,
|
||||
float *, int *, float *, int *, float *);
|
||||
int BLASFUNC(dspr2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *);
|
||||
int BLASFUNC(qspr2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *);
|
||||
int BLASFUNC(cspr2) (char *, int *, float *,
|
||||
float *, int *, float *, int *, float *);
|
||||
int BLASFUNC(zspr2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *);
|
||||
int BLASFUNC(xspr2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *);
|
||||
|
||||
int BLASFUNC(cher) (char *, int *, float *, float *, int *,
|
||||
float *, int *);
|
||||
int BLASFUNC(zher) (char *, int *, double *, double *, int *,
|
||||
double *, int *);
|
||||
int BLASFUNC(xher) (char *, int *, double *, double *, int *,
|
||||
double *, int *);
|
||||
|
||||
int BLASFUNC(chpr) (char *, int *, float *, float *, int *, float *);
|
||||
int BLASFUNC(zhpr) (char *, int *, double *, double *, int *, double *);
|
||||
int BLASFUNC(xhpr) (char *, int *, double *, double *, int *, double *);
|
||||
|
||||
int BLASFUNC(cher2) (char *, int *, float *,
|
||||
float *, int *, float *, int *, float *, int *);
|
||||
int BLASFUNC(zher2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *, int *);
|
||||
int BLASFUNC(xher2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *, int *);
|
||||
|
||||
int BLASFUNC(chpr2) (char *, int *, float *,
|
||||
float *, int *, float *, int *, float *);
|
||||
int BLASFUNC(zhpr2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *);
|
||||
int BLASFUNC(xhpr2) (char *, int *, double *,
|
||||
double *, int *, double *, int *, double *);
|
||||
|
||||
int BLASFUNC(chemv) (char *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zhemv) (char *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xhemv) (char *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(chpmv) (char *, int *, float *, float *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zhpmv) (char *, int *, double *, double *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xhpmv) (char *, int *, double *, double *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(snorm)(char *, int *, int *, float *, int *);
|
||||
int BLASFUNC(dnorm)(char *, int *, int *, double *, int *);
|
||||
int BLASFUNC(cnorm)(char *, int *, int *, float *, int *);
|
||||
int BLASFUNC(znorm)(char *, int *, int *, double *, int *);
|
||||
|
||||
int BLASFUNC(sgbmv)(char *, int *, int *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(dgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(qgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(cgbmv)(char *, int *, int *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(ssbmv)(char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(dsbmv)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(qsbmv)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(csbmv)(char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zsbmv)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xsbmv)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(chbmv)(char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zhbmv)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xhbmv)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
/* Level 3 routines */
|
||||
|
||||
int BLASFUNC(sgemm)(char *, char *, int *, int *, int *, float *,
|
||||
float *, int *, float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(dgemm)(char *, char *, int *, int *, int *, double *,
|
||||
double *, int *, double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(qgemm)(char *, char *, int *, int *, int *, double *,
|
||||
double *, int *, double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(cgemm)(char *, char *, int *, int *, int *, float *,
|
||||
float *, int *, float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zgemm)(char *, char *, int *, int *, int *, double *,
|
||||
double *, int *, double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xgemm)(char *, char *, int *, int *, int *, double *,
|
||||
double *, int *, double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(cgemm3m)(char *, char *, int *, int *, int *, float *,
|
||||
float *, int *, float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zgemm3m)(char *, char *, int *, int *, int *, double *,
|
||||
double *, int *, double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xgemm3m)(char *, char *, int *, int *, int *, double *,
|
||||
double *, int *, double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(sge2mm)(char *, char *, char *, int *, int *,
|
||||
float *, float *, int *, float *, int *,
|
||||
float *, float *, int *);
|
||||
int BLASFUNC(dge2mm)(char *, char *, char *, int *, int *,
|
||||
double *, double *, int *, double *, int *,
|
||||
double *, double *, int *);
|
||||
int BLASFUNC(cge2mm)(char *, char *, char *, int *, int *,
|
||||
float *, float *, int *, float *, int *,
|
||||
float *, float *, int *);
|
||||
int BLASFUNC(zge2mm)(char *, char *, char *, int *, int *,
|
||||
double *, double *, int *, double *, int *,
|
||||
double *, double *, int *);
|
||||
|
||||
int BLASFUNC(strsm)(char *, char *, char *, char *, int *, int *,
|
||||
float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(dtrsm)(char *, char *, char *, char *, int *, int *,
|
||||
double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(qtrsm)(char *, char *, char *, char *, int *, int *,
|
||||
double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(ctrsm)(char *, char *, char *, char *, int *, int *,
|
||||
float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(ztrsm)(char *, char *, char *, char *, int *, int *,
|
||||
double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(xtrsm)(char *, char *, char *, char *, int *, int *,
|
||||
double *, double *, int *, double *, int *);
|
||||
|
||||
int BLASFUNC(strmm)(char *, char *, char *, char *, int *, int *,
|
||||
float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(dtrmm)(char *, char *, char *, char *, int *, int *,
|
||||
double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(qtrmm)(char *, char *, char *, char *, int *, int *,
|
||||
double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(ctrmm)(char *, char *, char *, char *, int *, int *,
|
||||
float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(ztrmm)(char *, char *, char *, char *, int *, int *,
|
||||
double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(xtrmm)(char *, char *, char *, char *, int *, int *,
|
||||
double *, double *, int *, double *, int *);
|
||||
|
||||
int BLASFUNC(ssymm)(char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(dsymm)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(qsymm)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(csymm)(char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zsymm)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xsymm)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(csymm3m)(char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zsymm3m)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xsymm3m)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(ssyrk)(char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, float *, int *);
|
||||
int BLASFUNC(dsyrk)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, double *, int *);
|
||||
int BLASFUNC(qsyrk)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, double *, int *);
|
||||
int BLASFUNC(csyrk)(char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, float *, int *);
|
||||
int BLASFUNC(zsyrk)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, double *, int *);
|
||||
int BLASFUNC(xsyrk)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, double *, int *);
|
||||
|
||||
int BLASFUNC(ssyr2k)(char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(dsyr2k)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double*, int *, double *, double *, int *);
|
||||
int BLASFUNC(qsyr2k)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double*, int *, double *, double *, int *);
|
||||
int BLASFUNC(csyr2k)(char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zsyr2k)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double*, int *, double *, double *, int *);
|
||||
int BLASFUNC(xsyr2k)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double*, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(chemm)(char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zhemm)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xhemm)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(chemm3m)(char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zhemm3m)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
int BLASFUNC(xhemm3m)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(cherk)(char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, float *, int *);
|
||||
int BLASFUNC(zherk)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, double *, int *);
|
||||
int BLASFUNC(xherk)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double *, double *, int *);
|
||||
|
||||
int BLASFUNC(cher2k)(char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zher2k)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double*, int *, double *, double *, int *);
|
||||
int BLASFUNC(xher2k)(char *, char *, int *, int *, double *, double *, int *,
|
||||
double*, int *, double *, double *, int *);
|
||||
int BLASFUNC(cher2m)(char *, char *, char *, int *, int *, float *, float *, int *,
|
||||
float *, int *, float *, float *, int *);
|
||||
int BLASFUNC(zher2m)(char *, char *, char *, int *, int *, double *, double *, int *,
|
||||
double*, int *, double *, double *, int *);
|
||||
int BLASFUNC(xher2m)(char *, char *, char *, int *, int *, double *, double *, int *,
|
||||
double*, int *, double *, double *, int *);
|
||||
|
||||
int BLASFUNC(sgemt)(char *, int *, int *, float *, float *, int *,
|
||||
float *, int *);
|
||||
int BLASFUNC(dgemt)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *);
|
||||
int BLASFUNC(cgemt)(char *, int *, int *, float *, float *, int *,
|
||||
float *, int *);
|
||||
int BLASFUNC(zgemt)(char *, int *, int *, double *, double *, int *,
|
||||
double *, int *);
|
||||
|
||||
int BLASFUNC(sgema)(char *, char *, int *, int *, float *,
|
||||
float *, int *, float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(dgema)(char *, char *, int *, int *, double *,
|
||||
double *, int *, double*, double *, int *, double*, int *);
|
||||
int BLASFUNC(cgema)(char *, char *, int *, int *, float *,
|
||||
float *, int *, float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(zgema)(char *, char *, int *, int *, double *,
|
||||
double *, int *, double*, double *, int *, double*, int *);
|
||||
|
||||
int BLASFUNC(sgems)(char *, char *, int *, int *, float *,
|
||||
float *, int *, float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(dgems)(char *, char *, int *, int *, double *,
|
||||
double *, int *, double*, double *, int *, double*, int *);
|
||||
int BLASFUNC(cgems)(char *, char *, int *, int *, float *,
|
||||
float *, int *, float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(zgems)(char *, char *, int *, int *, double *,
|
||||
double *, int *, double*, double *, int *, double*, int *);
|
||||
|
||||
int BLASFUNC(sgetf2)(int *, int *, float *, int *, int *, int *);
|
||||
int BLASFUNC(dgetf2)(int *, int *, double *, int *, int *, int *);
|
||||
int BLASFUNC(qgetf2)(int *, int *, double *, int *, int *, int *);
|
||||
int BLASFUNC(cgetf2)(int *, int *, float *, int *, int *, int *);
|
||||
int BLASFUNC(zgetf2)(int *, int *, double *, int *, int *, int *);
|
||||
int BLASFUNC(xgetf2)(int *, int *, double *, int *, int *, int *);
|
||||
|
||||
int BLASFUNC(sgetrf)(int *, int *, float *, int *, int *, int *);
|
||||
int BLASFUNC(dgetrf)(int *, int *, double *, int *, int *, int *);
|
||||
int BLASFUNC(qgetrf)(int *, int *, double *, int *, int *, int *);
|
||||
int BLASFUNC(cgetrf)(int *, int *, float *, int *, int *, int *);
|
||||
int BLASFUNC(zgetrf)(int *, int *, double *, int *, int *, int *);
|
||||
int BLASFUNC(xgetrf)(int *, int *, double *, int *, int *, int *);
|
||||
|
||||
int BLASFUNC(slaswp)(int *, float *, int *, int *, int *, int *, int *);
|
||||
int BLASFUNC(dlaswp)(int *, double *, int *, int *, int *, int *, int *);
|
||||
int BLASFUNC(qlaswp)(int *, double *, int *, int *, int *, int *, int *);
|
||||
int BLASFUNC(claswp)(int *, float *, int *, int *, int *, int *, int *);
|
||||
int BLASFUNC(zlaswp)(int *, double *, int *, int *, int *, int *, int *);
|
||||
int BLASFUNC(xlaswp)(int *, double *, int *, int *, int *, int *, int *);
|
||||
|
||||
int BLASFUNC(sgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *);
|
||||
int BLASFUNC(dgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
|
||||
int BLASFUNC(qgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
|
||||
int BLASFUNC(cgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *);
|
||||
int BLASFUNC(zgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
|
||||
int BLASFUNC(xgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
|
||||
|
||||
int BLASFUNC(sgesv)(int *, int *, float *, int *, int *, float *, int *, int *);
|
||||
int BLASFUNC(dgesv)(int *, int *, double *, int *, int *, double*, int *, int *);
|
||||
int BLASFUNC(qgesv)(int *, int *, double *, int *, int *, double*, int *, int *);
|
||||
int BLASFUNC(cgesv)(int *, int *, float *, int *, int *, float *, int *, int *);
|
||||
int BLASFUNC(zgesv)(int *, int *, double *, int *, int *, double*, int *, int *);
|
||||
int BLASFUNC(xgesv)(int *, int *, double *, int *, int *, double*, int *, int *);
|
||||
|
||||
int BLASFUNC(spotf2)(char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(dpotf2)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(qpotf2)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(cpotf2)(char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(zpotf2)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(xpotf2)(char *, int *, double *, int *, int *);
|
||||
|
||||
int BLASFUNC(spotrf)(char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(dpotrf)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(qpotrf)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(cpotrf)(char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(zpotrf)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(xpotrf)(char *, int *, double *, int *, int *);
|
||||
|
||||
int BLASFUNC(slauu2)(char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(dlauu2)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(qlauu2)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(clauu2)(char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(zlauu2)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(xlauu2)(char *, int *, double *, int *, int *);
|
||||
|
||||
int BLASFUNC(slauum)(char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(dlauum)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(qlauum)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(clauum)(char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(zlauum)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(xlauum)(char *, int *, double *, int *, int *);
|
||||
|
||||
int BLASFUNC(strti2)(char *, char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(dtrti2)(char *, char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(qtrti2)(char *, char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(ctrti2)(char *, char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(ztrti2)(char *, char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(xtrti2)(char *, char *, int *, double *, int *, int *);
|
||||
|
||||
int BLASFUNC(strtri)(char *, char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(dtrtri)(char *, char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(qtrtri)(char *, char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(ctrtri)(char *, char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(ztrtri)(char *, char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(xtrtri)(char *, char *, int *, double *, int *, int *);
|
||||
|
||||
int BLASFUNC(spotri)(char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(dpotri)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(qpotri)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(cpotri)(char *, int *, float *, int *, int *);
|
||||
int BLASFUNC(zpotri)(char *, int *, double *, int *, int *);
|
||||
int BLASFUNC(xpotri)(char *, int *, double *, int *, int *);
|
||||
|
||||
#endif
|
83
cs440-acg/ext/eigen/bench/btl/libs/BLAS/blas_interface.hh
Normal file
83
cs440-acg/ext/eigen/bench/btl/libs/BLAS/blas_interface.hh
Normal file
@@ -0,0 +1,83 @@
|
||||
//=====================================================
|
||||
// File : blas_interface.hh
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:28 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef blas_PRODUIT_MATRICE_VECTEUR_HH
|
||||
#define blas_PRODUIT_MATRICE_VECTEUR_HH
|
||||
|
||||
#include <c_interface_base.h>
|
||||
#include <complex>
|
||||
extern "C"
|
||||
{
|
||||
#include "blas.h"
|
||||
|
||||
// Cholesky Factorization
|
||||
// void spotrf_(const char* uplo, const int* n, float *a, const int* ld, int* info);
|
||||
// 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 dsytrd_(char *uplo, const int *n, double *a, const int *lda, double *d, double *e, double *tau, double *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 );
|
||||
void dgehrd_( const int *n, int *ilo, int *ihi, double *a, const int *lda, double *tau, double *work, int *lwork, int *info );
|
||||
|
||||
// LU row pivoting
|
||||
// void dgetrf_( int *m, int *n, double *a, int *lda, int *ipiv, int *info );
|
||||
// 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 );
|
||||
void dgetc2_(const int* n, double *a, const int *lda, int *ipiv, int *jpiv, int*info );
|
||||
#ifdef HAS_LAPACK
|
||||
#endif
|
||||
}
|
||||
|
||||
#define MAKE_STRING2(S) #S
|
||||
#define MAKE_STRING(S) MAKE_STRING2(S)
|
||||
|
||||
#define CAT2(A,B) A##B
|
||||
#define CAT(A,B) CAT2(A,B)
|
||||
|
||||
|
||||
template<class real> class blas_interface;
|
||||
|
||||
|
||||
static char notrans = 'N';
|
||||
static char trans = 'T';
|
||||
static char nonunit = 'N';
|
||||
static char lower = 'L';
|
||||
static char right = 'R';
|
||||
static char left = 'L';
|
||||
static int intone = 1;
|
||||
|
||||
|
||||
|
||||
#define SCALAR float
|
||||
#define SCALAR_PREFIX s
|
||||
#include "blas_interface_impl.hh"
|
||||
#undef SCALAR
|
||||
#undef SCALAR_PREFIX
|
||||
|
||||
|
||||
#define SCALAR double
|
||||
#define SCALAR_PREFIX d
|
||||
#include "blas_interface_impl.hh"
|
||||
#undef SCALAR
|
||||
#undef SCALAR_PREFIX
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
147
cs440-acg/ext/eigen/bench/btl/libs/BLAS/blas_interface_impl.hh
Normal file
147
cs440-acg/ext/eigen/bench/btl/libs/BLAS/blas_interface_impl.hh
Normal file
@@ -0,0 +1,147 @@
|
||||
|
||||
#define BLAS_FUNC(NAME) CAT(CAT(SCALAR_PREFIX,NAME),_)
|
||||
|
||||
template<> class blas_interface<SCALAR> : public c_interface_base<SCALAR>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
static SCALAR fone;
|
||||
static SCALAR fzero;
|
||||
|
||||
static inline std::string name()
|
||||
{
|
||||
return MAKE_STRING(CBLASNAME);
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
BLAS_FUNC(gemv)(¬rans,&N,&N,&fone,A,&N,B,&intone,&fzero,X,&intone);
|
||||
}
|
||||
|
||||
static inline void symv(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
BLAS_FUNC(symv)(&lower, &N,&fone,A,&N,B,&intone,&fzero,X,&intone);
|
||||
}
|
||||
|
||||
static inline void syr2(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
BLAS_FUNC(syr2)(&lower,&N,&fone,B,&intone,X,&intone,A,&N);
|
||||
}
|
||||
|
||||
static inline void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){
|
||||
BLAS_FUNC(ger)(&N,&N,&fone,X,&intone,Y,&intone,A,&N);
|
||||
}
|
||||
|
||||
static inline void rot(gene_vector & A, gene_vector & B, SCALAR c, SCALAR s, int N){
|
||||
BLAS_FUNC(rot)(&N,A,&intone,B,&intone,&c,&s);
|
||||
}
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
BLAS_FUNC(gemv)(&trans,&N,&N,&fone,A,&N,B,&intone,&fzero,X,&intone);
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){
|
||||
BLAS_FUNC(gemm)(¬rans,¬rans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N);
|
||||
}
|
||||
|
||||
static inline void transposed_matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){
|
||||
BLAS_FUNC(gemm)(¬rans,¬rans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N);
|
||||
}
|
||||
|
||||
// static inline void ata_product(gene_matrix & A, gene_matrix & X, int N){
|
||||
// ssyrk_(&lower,&trans,&N,&N,&fone,A,&N,&fzero,X,&N);
|
||||
// }
|
||||
|
||||
static inline void aat_product(gene_matrix & A, gene_matrix & X, int N){
|
||||
BLAS_FUNC(syrk)(&lower,¬rans,&N,&N,&fone,A,&N,&fzero,X,&N);
|
||||
}
|
||||
|
||||
static inline void axpy(SCALAR coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
BLAS_FUNC(axpy)(&N,&coef,X,&intone,Y,&intone);
|
||||
}
|
||||
|
||||
static inline void axpby(SCALAR a, const gene_vector & X, SCALAR b, gene_vector & Y, int N){
|
||||
BLAS_FUNC(scal)(&N,&b,Y,&intone);
|
||||
BLAS_FUNC(axpy)(&N,&a,X,&intone,Y,&intone);
|
||||
}
|
||||
|
||||
static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){
|
||||
int N2 = N*N;
|
||||
BLAS_FUNC(copy)(&N2, X, &intone, C, &intone);
|
||||
char uplo = 'L';
|
||||
int info = 0;
|
||||
BLAS_FUNC(potrf)(&uplo, &N, C, &N, &info);
|
||||
if(info!=0) std::cerr << "potrf_ error " << info << "\n";
|
||||
}
|
||||
|
||||
static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
|
||||
int N2 = N*N;
|
||||
BLAS_FUNC(copy)(&N2, X, &intone, C, &intone);
|
||||
int info = 0;
|
||||
int * ipiv = (int*)alloca(sizeof(int)*N);
|
||||
BLAS_FUNC(getrf)(&N, &N, C, &N, ipiv, &info);
|
||||
if(info!=0) std::cerr << "getrf_ error " << info << "\n";
|
||||
}
|
||||
|
||||
static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){
|
||||
BLAS_FUNC(copy)(&N, B, &intone, X, &intone);
|
||||
BLAS_FUNC(trsv)(&lower, ¬rans, &nonunit, &N, L, &N, X, &intone);
|
||||
}
|
||||
|
||||
static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix & X, int N){
|
||||
BLAS_FUNC(copy)(&N, B, &intone, X, &intone);
|
||||
BLAS_FUNC(trsm)(&right, &lower, ¬rans, &nonunit, &N, &N, &fone, L, &N, X, &N);
|
||||
}
|
||||
|
||||
static inline void trmm(gene_matrix & A, gene_matrix & B, gene_matrix & /*X*/, int N){
|
||||
BLAS_FUNC(trmm)(&left, &lower, ¬rans,&nonunit, &N,&N,&fone,A,&N,B,&N);
|
||||
}
|
||||
|
||||
#ifdef HAS_LAPACK
|
||||
|
||||
static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
|
||||
int N2 = N*N;
|
||||
BLAS_FUNC(copy)(&N2, X, &intone, C, &intone);
|
||||
int info = 0;
|
||||
int * ipiv = (int*)alloca(sizeof(int)*N);
|
||||
int * jpiv = (int*)alloca(sizeof(int)*N);
|
||||
BLAS_FUNC(getc2)(&N, C, &N, ipiv, jpiv, &info);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){
|
||||
{
|
||||
int N2 = N*N;
|
||||
int inc = 1;
|
||||
BLAS_FUNC(copy)(&N2, X, &inc, C, &inc);
|
||||
}
|
||||
int info = 0;
|
||||
int ilo = 1;
|
||||
int ihi = N;
|
||||
int bsize = 64;
|
||||
int worksize = N*bsize;
|
||||
SCALAR* d = new SCALAR[N+worksize];
|
||||
BLAS_FUNC(gehrd)(&N, &ilo, &ihi, C, &N, d, d+N, &worksize, &info);
|
||||
delete[] d;
|
||||
}
|
||||
|
||||
static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){
|
||||
{
|
||||
int N2 = N*N;
|
||||
int inc = 1;
|
||||
BLAS_FUNC(copy)(&N2, X, &inc, C, &inc);
|
||||
}
|
||||
char uplo = 'U';
|
||||
int info = 0;
|
||||
int bsize = 64;
|
||||
int worksize = N*bsize;
|
||||
SCALAR* d = new SCALAR[3*N+worksize];
|
||||
BLAS_FUNC(sytrd)(&uplo, &N, C, &N, d, d+N, d+2*N, d+3*N, &worksize, &info);
|
||||
delete[] d;
|
||||
}
|
||||
|
||||
#endif // HAS_LAPACK
|
||||
|
||||
};
|
||||
|
||||
SCALAR blas_interface<SCALAR>::fone = SCALAR(1);
|
||||
SCALAR blas_interface<SCALAR>::fzero = SCALAR(0);
|
73
cs440-acg/ext/eigen/bench/btl/libs/BLAS/c_interface_base.h
Normal file
73
cs440-acg/ext/eigen/bench/btl/libs/BLAS/c_interface_base.h
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
#ifndef BTL_C_INTERFACE_BASE_H
|
||||
#define BTL_C_INTERFACE_BASE_H
|
||||
|
||||
#include "utilities.h"
|
||||
#include <vector>
|
||||
|
||||
template<class real> class c_interface_base
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef real real_type;
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector > stl_matrix;
|
||||
|
||||
typedef real* gene_matrix;
|
||||
typedef real* gene_vector;
|
||||
|
||||
static void free_matrix(gene_matrix & A, int /*N*/){
|
||||
delete[] A;
|
||||
}
|
||||
|
||||
static void free_vector(gene_vector & B){
|
||||
delete[] B;
|
||||
}
|
||||
|
||||
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N = A_stl.size();
|
||||
A = new real[N*N];
|
||||
for (int j=0;j<N;j++)
|
||||
for (int i=0;i<N;i++)
|
||||
A[i+N*j] = A_stl[j][i];
|
||||
}
|
||||
|
||||
static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
int N = B_stl.size();
|
||||
B = new real[N];
|
||||
for (int i=0;i<N;i++)
|
||||
B[i] = B_stl[i];
|
||||
}
|
||||
|
||||
static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
int N = B_stl.size();
|
||||
for (int i=0;i<N;i++)
|
||||
B_stl[i] = B[i];
|
||||
}
|
||||
|
||||
static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N = A_stl.size();
|
||||
for (int j=0;j<N;j++){
|
||||
A_stl[j].resize(N);
|
||||
for (int i=0;i<N;i++)
|
||||
A_stl[j][i] = A[i+N*j];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
|
||||
for (int i=0;i<N;i++)
|
||||
cible[i]=source[i];
|
||||
}
|
||||
|
||||
static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
|
||||
for (int j=0;j<N;j++){
|
||||
for (int i=0;i<N;i++){
|
||||
cible[i+N*j] = source[i+N*j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
73
cs440-acg/ext/eigen/bench/btl/libs/BLAS/main.cpp
Normal file
73
cs440-acg/ext/eigen/bench/btl/libs/BLAS/main.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
//=====================================================
|
||||
// File : main.cpp
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:28 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "blas_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
#include "action_cholesky.hh"
|
||||
#include "action_lu_decomp.hh"
|
||||
#include "action_partial_lu.hh"
|
||||
#include "action_trisolve_matrix.hh"
|
||||
|
||||
#ifdef HAS_LAPACK
|
||||
#include "action_hessenberg.hh"
|
||||
#endif
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
bench<Action_axpy<blas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
bench<Action_axpby<blas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
|
||||
bench<Action_matrix_vector_product<blas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_atv_product<blas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_symv<blas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_syr2<blas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
|
||||
bench<Action_ger<blas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_rot<blas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
|
||||
bench<Action_matrix_matrix_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_ata_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_aat_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_trisolve<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_trisolve_matrix<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_trmm<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_cholesky<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
bench<Action_partial_lu<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
|
||||
#ifdef HAS_LAPACK
|
||||
// bench<Action_lu_decomp<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
bench<Action_hessenberg<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
bench<Action_tridiagonalization<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
#endif
|
||||
|
||||
//bench<Action_lu_solve<blas_LU_solve_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
2
cs440-acg/ext/eigen/bench/btl/libs/STL/CMakeLists.txt
Normal file
2
cs440-acg/ext/eigen/bench/btl/libs/STL/CMakeLists.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
btl_add_bench(btl_STL main.cpp OFF)
|
244
cs440-acg/ext/eigen/bench/btl/libs/STL/STL_interface.hh
Normal file
244
cs440-acg/ext/eigen/bench/btl/libs/STL/STL_interface.hh
Normal file
@@ -0,0 +1,244 @@
|
||||
//=====================================================
|
||||
// File : STL_interface.hh
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:24 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef STL_INTERFACE_HH
|
||||
#define STL_INTERFACE_HH
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "utilities.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
template<class real>
|
||||
class STL_interface{
|
||||
|
||||
public :
|
||||
|
||||
typedef real real_type ;
|
||||
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector > stl_matrix;
|
||||
|
||||
typedef stl_matrix gene_matrix;
|
||||
|
||||
typedef stl_vector gene_vector;
|
||||
|
||||
static inline std::string name( void )
|
||||
{
|
||||
return "STL";
|
||||
}
|
||||
|
||||
static void free_matrix(gene_matrix & /*A*/, int /*N*/){}
|
||||
|
||||
static void free_vector(gene_vector & /*B*/){}
|
||||
|
||||
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
A = A_stl;
|
||||
}
|
||||
|
||||
static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
B = B_stl;
|
||||
}
|
||||
|
||||
static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
B_stl = B ;
|
||||
}
|
||||
|
||||
|
||||
static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
A_stl = A ;
|
||||
}
|
||||
|
||||
static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
|
||||
for (int i=0;i<N;i++){
|
||||
cible[i]=source[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
|
||||
for (int i=0;i<N;i++)
|
||||
for (int j=0;j<N;j++)
|
||||
cible[i][j]=source[i][j];
|
||||
}
|
||||
|
||||
// static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N)
|
||||
// {
|
||||
// real somme;
|
||||
// for (int j=0;j<N;j++){
|
||||
// for (int i=0;i<N;i++){
|
||||
// somme=0.0;
|
||||
// for (int k=0;k<N;k++)
|
||||
// somme += A[i][k]*A[j][k];
|
||||
// X[j][i]=somme;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N)
|
||||
{
|
||||
real somme;
|
||||
for (int j=0;j<N;j++){
|
||||
for (int i=0;i<N;i++){
|
||||
somme=0.0;
|
||||
if(i>=j)
|
||||
{
|
||||
for (int k=0;k<N;k++){
|
||||
somme+=A[k][i]*A[k][j];
|
||||
}
|
||||
X[j][i]=somme;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N)
|
||||
{
|
||||
real somme;
|
||||
for (int j=0;j<N;j++){
|
||||
for (int i=0;i<N;i++){
|
||||
somme=0.0;
|
||||
for (int k=0;k<N;k++)
|
||||
somme+=A[k][i]*B[j][k];
|
||||
X[j][i]=somme;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)
|
||||
{
|
||||
real somme;
|
||||
for (int i=0;i<N;i++){
|
||||
somme=0.0;
|
||||
for (int j=0;j<N;j++)
|
||||
somme+=A[j][i]*B[j];
|
||||
X[i]=somme;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void symv(gene_matrix & A, gene_vector & B, gene_vector & X, int N)
|
||||
{
|
||||
for (int j=0; j<N; ++j)
|
||||
X[j] = 0;
|
||||
for (int j=0; j<N; ++j)
|
||||
{
|
||||
real t1 = B[j];
|
||||
real t2 = 0;
|
||||
X[j] += t1 * A[j][j];
|
||||
for (int i=j+1; i<N; ++i) {
|
||||
X[i] += t1 * A[j][i];
|
||||
t2 += A[j][i] * B[i];
|
||||
}
|
||||
X[j] += t2;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void syr2(gene_matrix & A, gene_vector & B, gene_vector & X, int N)
|
||||
{
|
||||
for (int j=0; j<N; ++j)
|
||||
{
|
||||
for (int i=j; i<N; ++i)
|
||||
A[j][i] += B[i]*X[j] + B[j]*X[i];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N)
|
||||
{
|
||||
for (int j=0; j<N; ++j)
|
||||
{
|
||||
for (int i=j; i<N; ++i)
|
||||
A[j][i] += X[i]*Y[j];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)
|
||||
{
|
||||
real somme;
|
||||
for (int i=0;i<N;i++){
|
||||
somme = 0.0;
|
||||
for (int j=0;j<N;j++)
|
||||
somme += A[i][j]*B[j];
|
||||
X[i] = somme;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
for (int i=0;i<N;i++)
|
||||
Y[i]+=coef*X[i];
|
||||
}
|
||||
|
||||
static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){
|
||||
for (int i=0;i<N;i++)
|
||||
Y[i] = a*X[i] + b*Y[i];
|
||||
}
|
||||
|
||||
static inline void trisolve_lower(const gene_matrix & L, const gene_vector & B, gene_vector & X, int N){
|
||||
copy_vector(B,X,N);
|
||||
for(int i=0; i<N; ++i)
|
||||
{
|
||||
X[i] /= L[i][i];
|
||||
real tmp = X[i];
|
||||
for (int j=i+1; j<N; ++j)
|
||||
X[j] -= tmp * L[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
static inline real norm_diff(const stl_vector & A, const stl_vector & B)
|
||||
{
|
||||
int N=A.size();
|
||||
real somme=0.0;
|
||||
real somme2=0.0;
|
||||
|
||||
for (int i=0;i<N;i++){
|
||||
real diff=A[i]-B[i];
|
||||
somme+=diff*diff;
|
||||
somme2+=A[i]*A[i];
|
||||
}
|
||||
return somme/somme2;
|
||||
}
|
||||
|
||||
static inline real norm_diff(const stl_matrix & A, const stl_matrix & B)
|
||||
{
|
||||
int N=A[0].size();
|
||||
real somme=0.0;
|
||||
real somme2=0.0;
|
||||
|
||||
for (int i=0;i<N;i++){
|
||||
for (int j=0;j<N;j++){
|
||||
real diff=A[i][j] - B[i][j];
|
||||
somme += diff*diff;
|
||||
somme2 += A[i][j]*A[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
return somme/somme2;
|
||||
}
|
||||
|
||||
static inline void display_vector(const stl_vector & A)
|
||||
{
|
||||
int N=A.size();
|
||||
for (int i=0;i<N;i++){
|
||||
INFOS("A["<<i<<"]="<<A[i]<<endl);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
42
cs440-acg/ext/eigen/bench/btl/libs/STL/main.cpp
Normal file
42
cs440-acg/ext/eigen/bench/btl/libs/STL/main.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
//=====================================================
|
||||
// File : main.cpp
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:23 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "STL_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench<Action_axpy<STL_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
bench<Action_axpby<STL_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
bench<Action_matrix_vector_product<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_atv_product<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_symv<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_syr2<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_matrix_matrix_product<STL_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_ata_product<STL_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_aat_product<STL_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
13
cs440-acg/ext/eigen/bench/btl/libs/blaze/CMakeLists.txt
Normal file
13
cs440-acg/ext/eigen/bench/btl/libs/blaze/CMakeLists.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
find_package(BLAZE)
|
||||
find_package(Boost COMPONENTS system)
|
||||
if (BLAZE_FOUND AND Boost_FOUND)
|
||||
include_directories(${BLAZE_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
|
||||
btl_add_bench(btl_blaze main.cpp)
|
||||
# Note: The newest blaze version requires C++14.
|
||||
# Ideally, we should set this depending on the version of Blaze we found
|
||||
set_property(TARGET btl_blaze PROPERTY CXX_STANDARD 14)
|
||||
if(BUILD_btl_blaze)
|
||||
target_link_libraries(btl_blaze ${Boost_LIBRARIES})
|
||||
endif()
|
||||
endif ()
|
140
cs440-acg/ext/eigen/bench/btl/libs/blaze/blaze_interface.hh
Normal file
140
cs440-acg/ext/eigen/bench/btl/libs/blaze/blaze_interface.hh
Normal file
@@ -0,0 +1,140 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef BLAZE_INTERFACE_HH
|
||||
#define BLAZE_INTERFACE_HH
|
||||
|
||||
#include <blaze/Math.h>
|
||||
#include <blaze/Blaze.h>
|
||||
// using namespace blaze;
|
||||
|
||||
#include <vector>
|
||||
|
||||
template<class real>
|
||||
class blaze_interface {
|
||||
|
||||
public :
|
||||
|
||||
typedef real real_type ;
|
||||
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector > stl_matrix;
|
||||
|
||||
typedef blaze::DynamicMatrix<real,blaze::columnMajor> gene_matrix;
|
||||
typedef blaze::DynamicVector<real> gene_vector;
|
||||
|
||||
static inline std::string name() { return "blaze"; }
|
||||
|
||||
static void free_matrix(gene_matrix & A, int N){
|
||||
return ;
|
||||
}
|
||||
|
||||
static void free_vector(gene_vector & B){
|
||||
return ;
|
||||
}
|
||||
|
||||
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
A.resize(A_stl[0].size(), A_stl.size());
|
||||
|
||||
for (int j=0; j<A_stl.size() ; j++){
|
||||
for (int i=0; i<A_stl[j].size() ; i++){
|
||||
A(i,j) = A_stl[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
B.resize(B_stl.size());
|
||||
for (int i=0; i<B_stl.size() ; i++){
|
||||
B[i] = B_stl[i];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
for (int i=0; i<B_stl.size() ; i++){
|
||||
B_stl[i] = B[i];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N=A_stl.size();
|
||||
for (int j=0;j<N;j++){
|
||||
A_stl[j].resize(N);
|
||||
for (int i=0;i<N;i++){
|
||||
A_stl[j][i] = A(i,j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
X = (A*B);
|
||||
}
|
||||
|
||||
static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
X = (trans(A)*trans(B));
|
||||
}
|
||||
|
||||
static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
X = (trans(A)*A);
|
||||
}
|
||||
|
||||
static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
X = (A*trans(A));
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X = (A*B);
|
||||
}
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X = (trans(A)*B);
|
||||
}
|
||||
|
||||
static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
Y += coef * X;
|
||||
}
|
||||
|
||||
static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){
|
||||
Y = a*X + b*Y;
|
||||
}
|
||||
|
||||
// static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){
|
||||
// C = X;
|
||||
// recursive_cholesky(C);
|
||||
// }
|
||||
|
||||
// static inline void lu_decomp(const gene_matrix & X, gene_matrix & R, int N){
|
||||
// R = X;
|
||||
// std::vector<int> ipvt(N);
|
||||
// lu_factor(R, ipvt);
|
||||
// }
|
||||
|
||||
// static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){
|
||||
// X = lower_trisolve(L, B);
|
||||
// }
|
||||
|
||||
static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
|
||||
cible = source;
|
||||
}
|
||||
|
||||
static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
|
||||
cible = source;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
40
cs440-acg/ext/eigen/bench/btl/libs/blaze/main.cpp
Normal file
40
cs440-acg/ext/eigen/bench/btl/libs/blaze/main.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "blaze_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
bench<Action_axpy<blaze_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
bench<Action_axpby<blaze_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
|
||||
bench<Action_matrix_vector_product<blaze_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_atv_product<blaze_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
// bench<Action_matrix_matrix_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_ata_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_aat_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
17
cs440-acg/ext/eigen/bench/btl/libs/blitz/CMakeLists.txt
Normal file
17
cs440-acg/ext/eigen/bench/btl/libs/blitz/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
find_package(Blitz)
|
||||
|
||||
if (BLITZ_FOUND)
|
||||
include_directories(${BLITZ_INCLUDES})
|
||||
|
||||
btl_add_bench(btl_blitz btl_blitz.cpp)
|
||||
if (BUILD_btl_blitz)
|
||||
target_link_libraries(btl_blitz ${BLITZ_LIBRARIES})
|
||||
endif (BUILD_btl_blitz)
|
||||
|
||||
btl_add_bench(btl_tiny_blitz btl_tiny_blitz.cpp OFF)
|
||||
if (BUILD_btl_tiny_blitz)
|
||||
target_link_libraries(btl_tiny_blitz ${BLITZ_LIBRARIES})
|
||||
endif (BUILD_btl_tiny_blitz)
|
||||
|
||||
endif (BLITZ_FOUND)
|
@@ -0,0 +1,192 @@
|
||||
//=====================================================
|
||||
// File : blitz_LU_solve_interface.hh
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef BLITZ_LU_SOLVE_INTERFACE_HH
|
||||
#define BLITZ_LU_SOLVE_INTERFACE_HH
|
||||
|
||||
#include "blitz/array.h"
|
||||
#include <vector>
|
||||
|
||||
BZ_USING_NAMESPACE(blitz)
|
||||
|
||||
template<class real>
|
||||
class blitz_LU_solve_interface : public blitz_interface<real>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
typedef typename blitz_interface<real>::gene_matrix gene_matrix;
|
||||
typedef typename blitz_interface<real>::gene_vector gene_vector;
|
||||
|
||||
typedef blitz::Array<int,1> Pivot_Vector;
|
||||
|
||||
inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N)
|
||||
{
|
||||
|
||||
pivot.resize(N);
|
||||
|
||||
}
|
||||
|
||||
inline static void free_Pivot_Vector(Pivot_Vector & pivot)
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end)
|
||||
{
|
||||
|
||||
real somme=0.;
|
||||
|
||||
for (int j=col_start ; j<col_end+1 ; j++){
|
||||
|
||||
somme+=A(row,j)*B(j);
|
||||
|
||||
}
|
||||
|
||||
return somme;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static inline real matrix_matrix_product_sliced(gene_matrix & A, int row, int col_start, int col_end, gene_matrix & B, int row_shift, int col )
|
||||
{
|
||||
|
||||
real somme=0.;
|
||||
|
||||
for (int j=col_start ; j<col_end+1 ; j++){
|
||||
|
||||
somme+=A(row,j)*B(j+row_shift,col);
|
||||
|
||||
}
|
||||
|
||||
return somme;
|
||||
|
||||
}
|
||||
|
||||
inline static void LU_factor(gene_matrix & LU, Pivot_Vector & pivot, int N)
|
||||
{
|
||||
|
||||
ASSERT( LU.rows()==LU.cols() ) ;
|
||||
int index_max = 0 ;
|
||||
real big = 0. ;
|
||||
real theSum = 0. ;
|
||||
real dum = 0. ;
|
||||
// Get the implicit scaling information :
|
||||
gene_vector ImplicitScaling( N ) ;
|
||||
for( int i=0; i<N; i++ ) {
|
||||
big = 0. ;
|
||||
for( int j=0; j<N; j++ ) {
|
||||
if( abs( LU( i, j ) )>=big ) big = abs( LU( i, j ) ) ;
|
||||
}
|
||||
if( big==0. ) {
|
||||
INFOS( "blitz_LU_factor::Singular matrix" ) ;
|
||||
exit( 0 ) ;
|
||||
}
|
||||
ImplicitScaling( i ) = 1./big ;
|
||||
}
|
||||
// Loop over columns of Crout's method :
|
||||
for( int j=0; j<N; j++ ) {
|
||||
for( int i=0; i<j; i++ ) {
|
||||
theSum = LU( i, j ) ;
|
||||
theSum -= matrix_matrix_product_sliced(LU, i, 0, i-1, LU, 0, j) ;
|
||||
// theSum -= sum( LU( i, Range( fromStart, i-1 ) )*LU( Range( fromStart, i-1 ), j ) ) ;
|
||||
LU( i, j ) = theSum ;
|
||||
}
|
||||
|
||||
// Search for the largest pivot element :
|
||||
big = 0. ;
|
||||
for( int i=j; i<N; i++ ) {
|
||||
theSum = LU( i, j ) ;
|
||||
theSum -= matrix_matrix_product_sliced(LU, i, 0, j-1, LU, 0, j) ;
|
||||
// theSum -= sum( LU( i, Range( fromStart, j-1 ) )*LU( Range( fromStart, j-1 ), j ) ) ;
|
||||
LU( i, j ) = theSum ;
|
||||
if( (ImplicitScaling( i )*abs( theSum ))>=big ) {
|
||||
dum = ImplicitScaling( i )*abs( theSum ) ;
|
||||
big = dum ;
|
||||
index_max = i ;
|
||||
}
|
||||
}
|
||||
// Interchanging rows and the scale factor :
|
||||
if( j!=index_max ) {
|
||||
for( int k=0; k<N; k++ ) {
|
||||
dum = LU( index_max, k ) ;
|
||||
LU( index_max, k ) = LU( j, k ) ;
|
||||
LU( j, k ) = dum ;
|
||||
}
|
||||
ImplicitScaling( index_max ) = ImplicitScaling( j ) ;
|
||||
}
|
||||
pivot( j ) = index_max ;
|
||||
if ( LU( j, j )==0. ) LU( j, j ) = 1.e-20 ;
|
||||
// Divide by the pivot element :
|
||||
if( j<N ) {
|
||||
dum = 1./LU( j, j ) ;
|
||||
for( int i=j+1; i<N; i++ ) LU( i, j ) *= dum ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline static void LU_solve(const gene_matrix & LU, const Pivot_Vector pivot, gene_vector &B, gene_vector X, int N)
|
||||
{
|
||||
|
||||
// Pour conserver le meme header, on travaille sur X, copie du second-membre B
|
||||
X = B.copy() ;
|
||||
ASSERT( LU.rows()==LU.cols() ) ;
|
||||
firstIndex indI ;
|
||||
// Forward substitution :
|
||||
int ii = 0 ;
|
||||
real theSum = 0. ;
|
||||
for( int i=0; i<N; i++ ) {
|
||||
int ip = pivot( i ) ;
|
||||
theSum = X( ip ) ;
|
||||
// theSum = B( ip ) ;
|
||||
X( ip ) = X( i ) ;
|
||||
// B( ip ) = B( i ) ;
|
||||
if( ii ) {
|
||||
theSum -= matrix_vector_product_sliced(LU, X, i, ii-1, i-1) ;
|
||||
// theSum -= sum( LU( i, Range( ii-1, i-1 ) )*X( Range( ii-1, i-1 ) ) ) ;
|
||||
// theSum -= sum( LU( i, Range( ii-1, i-1 ) )*B( Range( ii-1, i-1 ) ) ) ;
|
||||
} else if( theSum ) {
|
||||
ii = i+1 ;
|
||||
}
|
||||
X( i ) = theSum ;
|
||||
// B( i ) = theSum ;
|
||||
}
|
||||
// Backsubstitution :
|
||||
for( int i=N-1; i>=0; i-- ) {
|
||||
theSum = X( i ) ;
|
||||
// theSum = B( i ) ;
|
||||
theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ;
|
||||
// theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ;
|
||||
// theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ;
|
||||
// Store a component of the solution vector :
|
||||
X( i ) = theSum/LU( i, i ) ;
|
||||
// B( i ) = theSum/LU( i, i ) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
147
cs440-acg/ext/eigen/bench/btl/libs/blitz/blitz_interface.hh
Normal file
147
cs440-acg/ext/eigen/bench/btl/libs/blitz/blitz_interface.hh
Normal file
@@ -0,0 +1,147 @@
|
||||
//=====================================================
|
||||
// File : blitz_interface.hh
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef BLITZ_INTERFACE_HH
|
||||
#define BLITZ_INTERFACE_HH
|
||||
|
||||
#include <blitz/blitz.h>
|
||||
#include <blitz/array.h>
|
||||
#include <blitz/vector-et.h>
|
||||
#include <blitz/vecwhere.h>
|
||||
#include <blitz/matrix.h>
|
||||
#include <vector>
|
||||
|
||||
BZ_USING_NAMESPACE(blitz)
|
||||
|
||||
template<class real>
|
||||
class blitz_interface{
|
||||
|
||||
public :
|
||||
|
||||
typedef real real_type ;
|
||||
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector > stl_matrix;
|
||||
|
||||
typedef blitz::Array<real, 2> gene_matrix;
|
||||
typedef blitz::Array<real, 1> gene_vector;
|
||||
// typedef blitz::Matrix<real, blitz::ColumnMajor> gene_matrix;
|
||||
// typedef blitz::Vector<real> gene_vector;
|
||||
|
||||
static inline std::string name() { return "blitz"; }
|
||||
|
||||
static void free_matrix(gene_matrix & A, int N){}
|
||||
|
||||
static void free_vector(gene_vector & B){}
|
||||
|
||||
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
A.resize(A_stl[0].size(),A_stl.size());
|
||||
for (int j=0; j<A_stl.size() ; j++){
|
||||
for (int i=0; i<A_stl[j].size() ; i++){
|
||||
A(i,j)=A_stl[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
B.resize(B_stl.size());
|
||||
for (int i=0; i<B_stl.size() ; i++){
|
||||
B(i)=B_stl[i];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
for (int i=0; i<B_stl.size() ; i++){
|
||||
B_stl[i]=B(i);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N=A_stl.size();
|
||||
for (int j=0;j<N;j++){
|
||||
A_stl[j].resize(N);
|
||||
for (int i=0;i<N;i++)
|
||||
A_stl[j][i] = A(i,j);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N)
|
||||
{
|
||||
firstIndex i;
|
||||
secondIndex j;
|
||||
thirdIndex k;
|
||||
X = sum(A(i,k) * B(k,j), k);
|
||||
}
|
||||
|
||||
static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N)
|
||||
{
|
||||
firstIndex i;
|
||||
secondIndex j;
|
||||
thirdIndex k;
|
||||
X = sum(A(k,i) * A(k,j), k);
|
||||
}
|
||||
|
||||
static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N)
|
||||
{
|
||||
firstIndex i;
|
||||
secondIndex j;
|
||||
thirdIndex k;
|
||||
X = sum(A(i,k) * A(j,k), k);
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)
|
||||
{
|
||||
firstIndex i;
|
||||
secondIndex j;
|
||||
X = sum(A(i,j)*B(j),j);
|
||||
}
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)
|
||||
{
|
||||
firstIndex i;
|
||||
secondIndex j;
|
||||
X = sum(A(j,i) * B(j),j);
|
||||
}
|
||||
|
||||
static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N)
|
||||
{
|
||||
firstIndex i;
|
||||
Y = Y(i) + coef * X(i);
|
||||
//Y += coef * X;
|
||||
}
|
||||
|
||||
static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
|
||||
cible = source;
|
||||
//cible.template operator=<gene_matrix>(source);
|
||||
// for (int i=0;i<N;i++){
|
||||
// for (int j=0;j<N;j++){
|
||||
// cible(i,j)=source(i,j);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
|
||||
//cible.template operator=<gene_vector>(source);
|
||||
cible = source;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
51
cs440-acg/ext/eigen/bench/btl/libs/blitz/btl_blitz.cpp
Normal file
51
cs440-acg/ext/eigen/bench/btl/libs/blitz/btl_blitz.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
//=====================================================
|
||||
// File : main.cpp
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "blitz_interface.hh"
|
||||
#include "blitz_LU_solve_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "action_matrix_vector_product.hh"
|
||||
#include "action_matrix_matrix_product.hh"
|
||||
#include "action_axpy.hh"
|
||||
#include "action_lu_solve.hh"
|
||||
#include "action_ata_product.hh"
|
||||
#include "action_aat_product.hh"
|
||||
#include "action_atv_product.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
bench<Action_matrix_vector_product<blitz_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_atv_product<blitz_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
|
||||
bench<Action_matrix_matrix_product<blitz_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_ata_product<blitz_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_aat_product<blitz_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_axpy<blitz_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
|
||||
//bench<Action_lu_solve<blitz_LU_solve_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
38
cs440-acg/ext/eigen/bench/btl/libs/blitz/btl_tiny_blitz.cpp
Normal file
38
cs440-acg/ext/eigen/bench/btl/libs/blitz/btl_tiny_blitz.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
//=====================================================
|
||||
// File : main.cpp
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "tiny_blitz_interface.hh"
|
||||
#include "static/bench_static.hh"
|
||||
#include "action_matrix_vector_product.hh"
|
||||
#include "action_matrix_matrix_product.hh"
|
||||
#include "action_axpy.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench_static<Action_axpy,tiny_blitz_interface>();
|
||||
bench_static<Action_matrix_matrix_product,tiny_blitz_interface>();
|
||||
bench_static<Action_matrix_vector_product,tiny_blitz_interface>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
106
cs440-acg/ext/eigen/bench/btl/libs/blitz/tiny_blitz_interface.hh
Normal file
106
cs440-acg/ext/eigen/bench/btl/libs/blitz/tiny_blitz_interface.hh
Normal file
@@ -0,0 +1,106 @@
|
||||
//=====================================================
|
||||
// File : tiny_blitz_interface.hh
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef TINY_BLITZ_INTERFACE_HH
|
||||
#define TINY_BLITZ_INTERFACE_HH
|
||||
|
||||
#include "blitz/array.h"
|
||||
#include "blitz/tiny.h"
|
||||
#include "blitz/tinymat.h"
|
||||
#include "blitz/tinyvec.h"
|
||||
#include <blitz/tinyvec-et.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
BZ_USING_NAMESPACE(blitz)
|
||||
|
||||
template<class real, int SIZE>
|
||||
class tiny_blitz_interface
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
typedef real real_type ;
|
||||
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector > stl_matrix;
|
||||
|
||||
typedef TinyVector<real,SIZE> gene_vector;
|
||||
typedef TinyMatrix<real,SIZE,SIZE> gene_matrix;
|
||||
|
||||
static inline std::string name() { return "tiny_blitz"; }
|
||||
|
||||
static void free_matrix(gene_matrix & A, int N){}
|
||||
|
||||
static void free_vector(gene_vector & B){}
|
||||
|
||||
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
for (int j=0; j<A_stl.size() ; j++)
|
||||
for (int i=0; i<A_stl[j].size() ; i++)
|
||||
A(i,j)=A_stl[j][i];
|
||||
}
|
||||
|
||||
static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
for (int i=0; i<B_stl.size() ; i++)
|
||||
B(i) = B_stl[i];
|
||||
}
|
||||
|
||||
static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
for (int i=0; i<B_stl.size() ; i++)
|
||||
B_stl[i] = B(i);
|
||||
}
|
||||
|
||||
static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N = A_stl.size();
|
||||
for (int j=0;j<N;j++)
|
||||
{
|
||||
A_stl[j].resize(N);
|
||||
for (int i=0;i<N;i++)
|
||||
A_stl[j][i] = A(i,j);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
|
||||
for (int j=0;j<N;j++)
|
||||
for (int i=0;i<N;i++)
|
||||
cible(i,j) = source(i,j);
|
||||
}
|
||||
|
||||
static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
|
||||
for (int i=0;i<N;i++){
|
||||
cible(i) = source(i);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
X = product(A,B);
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X = product(A,B);
|
||||
}
|
||||
|
||||
static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
Y += coef * X;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
19
cs440-acg/ext/eigen/bench/btl/libs/eigen2/CMakeLists.txt
Normal file
19
cs440-acg/ext/eigen/bench/btl/libs/eigen2/CMakeLists.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
find_package(Eigen2)
|
||||
|
||||
if(EIGEN2_FOUND)
|
||||
|
||||
include_directories(BEFORE ${EIGEN2_INCLUDE_DIR})
|
||||
btl_add_bench(btl_eigen2_linear main_linear.cpp)
|
||||
btl_add_bench(btl_eigen2_vecmat main_vecmat.cpp)
|
||||
btl_add_bench(btl_eigen2_matmat main_matmat.cpp)
|
||||
btl_add_bench(btl_eigen2_adv main_adv.cpp )
|
||||
|
||||
btl_add_target_property(btl_eigen2_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen2")
|
||||
btl_add_target_property(btl_eigen2_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen2")
|
||||
btl_add_target_property(btl_eigen2_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen2")
|
||||
btl_add_target_property(btl_eigen2_adv COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen2")
|
||||
|
||||
btl_add_bench(btl_tiny_eigen2 btl_tiny_eigen2.cpp OFF)
|
||||
|
||||
endif() # EIGEN2_FOUND
|
@@ -0,0 +1,46 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "eigen3_interface.hh"
|
||||
#include "static/bench_static.hh"
|
||||
#include "action_matrix_vector_product.hh"
|
||||
#include "action_matrix_matrix_product.hh"
|
||||
#include "action_axpy.hh"
|
||||
#include "action_lu_solve.hh"
|
||||
#include "action_ata_product.hh"
|
||||
#include "action_aat_product.hh"
|
||||
#include "action_atv_product.hh"
|
||||
#include "action_cholesky.hh"
|
||||
#include "action_trisolve.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
bench_static<Action_axpy,eigen2_interface>();
|
||||
bench_static<Action_matrix_matrix_product,eigen2_interface>();
|
||||
bench_static<Action_matrix_vector_product,eigen2_interface>();
|
||||
bench_static<Action_atv_product,eigen2_interface>();
|
||||
bench_static<Action_cholesky,eigen2_interface>();
|
||||
bench_static<Action_trisolve,eigen2_interface>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
168
cs440-acg/ext/eigen/bench/btl/libs/eigen2/eigen2_interface.hh
Normal file
168
cs440-acg/ext/eigen/bench/btl/libs/eigen2/eigen2_interface.hh
Normal file
@@ -0,0 +1,168 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef EIGEN2_INTERFACE_HH
|
||||
#define EIGEN2_INTERFACE_HH
|
||||
// #include <cblas.h>
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Cholesky>
|
||||
#include <Eigen/LU>
|
||||
#include <Eigen/QR>
|
||||
#include <vector>
|
||||
#include "btl.hh"
|
||||
|
||||
using namespace Eigen;
|
||||
|
||||
template<class real, int SIZE=Dynamic>
|
||||
class eigen2_interface
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
enum {IsFixedSize = (SIZE!=Dynamic)};
|
||||
|
||||
typedef real real_type;
|
||||
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector> stl_matrix;
|
||||
|
||||
typedef Eigen::Matrix<real,SIZE,SIZE> gene_matrix;
|
||||
typedef Eigen::Matrix<real,SIZE,1> gene_vector;
|
||||
|
||||
static inline std::string name( void )
|
||||
{
|
||||
#if defined(EIGEN_VECTORIZE_SSE)
|
||||
if (SIZE==Dynamic) return "eigen2"; else return "tiny_eigen2";
|
||||
#elif defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX)
|
||||
if (SIZE==Dynamic) return "eigen2"; else return "tiny_eigen2";
|
||||
#else
|
||||
if (SIZE==Dynamic) return "eigen2_novec"; else return "tiny_eigen2_novec";
|
||||
#endif
|
||||
}
|
||||
|
||||
static void free_matrix(gene_matrix & A, int N) {}
|
||||
|
||||
static void free_vector(gene_vector & B) {}
|
||||
|
||||
static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
A.resize(A_stl[0].size(), A_stl.size());
|
||||
|
||||
for (int j=0; j<A_stl.size() ; j++){
|
||||
for (int i=0; i<A_stl[j].size() ; i++){
|
||||
A.coeffRef(i,j) = A_stl[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static BTL_DONT_INLINE void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
B.resize(B_stl.size(),1);
|
||||
|
||||
for (int i=0; i<B_stl.size() ; i++){
|
||||
B.coeffRef(i) = B_stl[i];
|
||||
}
|
||||
}
|
||||
|
||||
static BTL_DONT_INLINE void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
for (int i=0; i<B_stl.size() ; i++){
|
||||
B_stl[i] = B.coeff(i);
|
||||
}
|
||||
}
|
||||
|
||||
static BTL_DONT_INLINE void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N=A_stl.size();
|
||||
|
||||
for (int j=0;j<N;j++){
|
||||
A_stl[j].resize(N);
|
||||
for (int i=0;i<N;i++){
|
||||
A_stl[j][i] = A.coeff(i,j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
X = (A*B).lazy();
|
||||
}
|
||||
|
||||
static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
X = (A.transpose()*B.transpose()).lazy();
|
||||
}
|
||||
|
||||
static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
X = (A.transpose()*A).lazy();
|
||||
}
|
||||
|
||||
static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
X = (A*A.transpose()).lazy();
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N){
|
||||
X = (A*B)/*.lazy()*/;
|
||||
}
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X = (A.transpose()*B)/*.lazy()*/;
|
||||
}
|
||||
|
||||
static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
Y += coef * X;
|
||||
}
|
||||
|
||||
static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){
|
||||
Y = a*X + b*Y;
|
||||
}
|
||||
|
||||
static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
|
||||
cible = source;
|
||||
}
|
||||
|
||||
static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
|
||||
cible = source;
|
||||
}
|
||||
|
||||
static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector& X, int N){
|
||||
X = L.template marked<LowerTriangular>().solveTriangular(B);
|
||||
}
|
||||
|
||||
static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int N){
|
||||
X = L.template marked<LowerTriangular>().solveTriangular(B);
|
||||
}
|
||||
|
||||
static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){
|
||||
C = X.llt().matrixL();
|
||||
// C = X;
|
||||
// Cholesky<gene_matrix>::computeInPlace(C);
|
||||
// Cholesky<gene_matrix>::computeInPlaceBlock(C);
|
||||
}
|
||||
|
||||
static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
|
||||
C = X.lu().matrixLU();
|
||||
// C = X.inverse();
|
||||
}
|
||||
|
||||
static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){
|
||||
C = Tridiagonalization<gene_matrix>(X).packedMatrix();
|
||||
}
|
||||
|
||||
static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){
|
||||
C = HessenbergDecomposition<gene_matrix>(X).packedMatrix();
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
44
cs440-acg/ext/eigen/bench/btl/libs/eigen2/main_adv.cpp
Normal file
44
cs440-acg/ext/eigen/bench/btl/libs/eigen2/main_adv.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "eigen2_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "action_trisolve.hh"
|
||||
#include "action_trisolve_matrix.hh"
|
||||
#include "action_cholesky.hh"
|
||||
#include "action_hessenberg.hh"
|
||||
#include "action_lu_decomp.hh"
|
||||
// #include "action_partial_lu.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench<Action_trisolve<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_trisolve_matrix<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_cholesky<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_lu_decomp<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_partial_lu<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_hessenberg<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_tridiagonalization<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
34
cs440-acg/ext/eigen/bench/btl/libs/eigen2/main_linear.cpp
Normal file
34
cs440-acg/ext/eigen/bench/btl/libs/eigen2/main_linear.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "eigen2_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
bench<Action_axpy<eigen2_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
bench<Action_axpby<eigen2_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
35
cs440-acg/ext/eigen/bench/btl/libs/eigen2/main_matmat.cpp
Normal file
35
cs440-acg/ext/eigen/bench/btl/libs/eigen2/main_matmat.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "eigen2_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
36
cs440-acg/ext/eigen/bench/btl/libs/eigen2/main_vecmat.cpp
Normal file
36
cs440-acg/ext/eigen/bench/btl/libs/eigen2/main_vecmat.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "eigen2_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench<Action_matrix_vector_product<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_atv_product<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
// bench<Action_symv<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
// bench<Action_syr2<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
// bench<Action_ger<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
65
cs440-acg/ext/eigen/bench/btl/libs/eigen3/CMakeLists.txt
Normal file
65
cs440-acg/ext/eigen/bench/btl/libs/eigen3/CMakeLists.txt
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
|
||||
if((NOT EIGEN3_INCLUDE_DIR) AND Eigen_SOURCE_DIR)
|
||||
# unless EIGEN3_INCLUDE_DIR is defined, let's use current Eigen version
|
||||
set(EIGEN3_INCLUDE_DIR ${Eigen_SOURCE_DIR})
|
||||
set(EIGEN3_FOUND TRUE)
|
||||
else()
|
||||
find_package(Eigen3)
|
||||
endif()
|
||||
|
||||
if (EIGEN3_FOUND)
|
||||
|
||||
include_directories(${EIGEN3_INCLUDE_DIR})
|
||||
btl_add_bench(btl_eigen3_linear main_linear.cpp)
|
||||
btl_add_bench(btl_eigen3_vecmat main_vecmat.cpp)
|
||||
btl_add_bench(btl_eigen3_matmat main_matmat.cpp)
|
||||
btl_add_bench(btl_eigen3_adv main_adv.cpp )
|
||||
|
||||
btl_add_target_property(btl_eigen3_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3")
|
||||
btl_add_target_property(btl_eigen3_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3")
|
||||
btl_add_target_property(btl_eigen3_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3")
|
||||
btl_add_target_property(btl_eigen3_adv COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3")
|
||||
|
||||
option(BTL_BENCH_NOGCCVEC "also bench Eigen explicit vec without GCC's auto vec" OFF)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND BTL_BENCH_NOGCCVEC)
|
||||
btl_add_bench(btl_eigen3_nogccvec_linear main_linear.cpp)
|
||||
btl_add_bench(btl_eigen3_nogccvec_vecmat main_vecmat.cpp)
|
||||
btl_add_bench(btl_eigen3_nogccvec_matmat main_matmat.cpp)
|
||||
btl_add_bench(btl_eigen3_nogccvec_adv main_adv.cpp )
|
||||
|
||||
btl_add_target_property(btl_eigen3_nogccvec_linear COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec")
|
||||
btl_add_target_property(btl_eigen3_nogccvec_vecmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec")
|
||||
btl_add_target_property(btl_eigen3_nogccvec_matmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec")
|
||||
btl_add_target_property(btl_eigen3_nogccvec_adv COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec")
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT BTL_NOVEC)
|
||||
btl_add_bench(btl_eigen3_novec_linear main_linear.cpp OFF)
|
||||
btl_add_bench(btl_eigen3_novec_vecmat main_vecmat.cpp OFF)
|
||||
btl_add_bench(btl_eigen3_novec_matmat main_matmat.cpp OFF)
|
||||
btl_add_bench(btl_eigen3_novec_adv main_adv.cpp OFF)
|
||||
btl_add_target_property(btl_eigen3_novec_linear COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec")
|
||||
btl_add_target_property(btl_eigen3_novec_vecmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec")
|
||||
btl_add_target_property(btl_eigen3_novec_matmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec")
|
||||
btl_add_target_property(btl_eigen3_novec_adv COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec")
|
||||
|
||||
# if(BUILD_btl_eigen3_adv)
|
||||
# target_link_libraries(btl_eigen3_adv ${MKL_LIBRARIES})
|
||||
# endif(BUILD_btl_eigen3_adv)
|
||||
|
||||
endif(NOT BTL_NOVEC)
|
||||
|
||||
btl_add_bench(btl_tiny_eigen3 btl_tiny_eigen3.cpp OFF)
|
||||
|
||||
if(NOT BTL_NOVEC)
|
||||
btl_add_bench(btl_tiny_eigen3_novec btl_tiny_eigen3.cpp OFF)
|
||||
btl_add_target_property(btl_tiny_eigen3_novec COMPILE_FLAGS "-DBTL_PREFIX=eigen3_tiny")
|
||||
|
||||
if(BUILD_btl_tiny_eigen3_novec)
|
||||
btl_add_target_property(btl_tiny_eigen3_novec COMPILE_FLAGS "-DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_tiny_novec")
|
||||
endif(BUILD_btl_tiny_eigen3_novec)
|
||||
endif(NOT BTL_NOVEC)
|
||||
|
||||
endif (EIGEN3_FOUND)
|
@@ -0,0 +1,46 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "eigen3_interface.hh"
|
||||
#include "static/bench_static.hh"
|
||||
#include "action_matrix_vector_product.hh"
|
||||
#include "action_matrix_matrix_product.hh"
|
||||
#include "action_axpy.hh"
|
||||
#include "action_lu_solve.hh"
|
||||
#include "action_ata_product.hh"
|
||||
#include "action_aat_product.hh"
|
||||
#include "action_atv_product.hh"
|
||||
#include "action_cholesky.hh"
|
||||
#include "action_trisolve.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
bench_static<Action_axpy,eigen2_interface>();
|
||||
bench_static<Action_matrix_matrix_product,eigen2_interface>();
|
||||
bench_static<Action_matrix_vector_product,eigen2_interface>();
|
||||
bench_static<Action_atv_product,eigen2_interface>();
|
||||
bench_static<Action_cholesky,eigen2_interface>();
|
||||
bench_static<Action_trisolve,eigen2_interface>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
240
cs440-acg/ext/eigen/bench/btl/libs/eigen3/eigen3_interface.hh
Normal file
240
cs440-acg/ext/eigen/bench/btl/libs/eigen3/eigen3_interface.hh
Normal file
@@ -0,0 +1,240 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef EIGEN3_INTERFACE_HH
|
||||
#define EIGEN3_INTERFACE_HH
|
||||
|
||||
#include <Eigen/Eigen>
|
||||
#include <vector>
|
||||
#include "btl.hh"
|
||||
|
||||
using namespace Eigen;
|
||||
|
||||
template<class real, int SIZE=Dynamic>
|
||||
class eigen3_interface
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
enum {IsFixedSize = (SIZE!=Dynamic)};
|
||||
|
||||
typedef real real_type;
|
||||
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector> stl_matrix;
|
||||
|
||||
typedef Eigen::Matrix<real,SIZE,SIZE> gene_matrix;
|
||||
typedef Eigen::Matrix<real,SIZE,1> gene_vector;
|
||||
|
||||
static inline std::string name( void )
|
||||
{
|
||||
return EIGEN_MAKESTRING(BTL_PREFIX);
|
||||
}
|
||||
|
||||
static void free_matrix(gene_matrix & /*A*/, int /*N*/) {}
|
||||
|
||||
static void free_vector(gene_vector & /*B*/) {}
|
||||
|
||||
static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
A.resize(A_stl[0].size(), A_stl.size());
|
||||
|
||||
for (unsigned int j=0; j<A_stl.size() ; j++){
|
||||
for (unsigned int i=0; i<A_stl[j].size() ; i++){
|
||||
A.coeffRef(i,j) = A_stl[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static BTL_DONT_INLINE void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
B.resize(B_stl.size(),1);
|
||||
|
||||
for (unsigned int i=0; i<B_stl.size() ; i++){
|
||||
B.coeffRef(i) = B_stl[i];
|
||||
}
|
||||
}
|
||||
|
||||
static BTL_DONT_INLINE void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
for (unsigned int i=0; i<B_stl.size() ; i++){
|
||||
B_stl[i] = B.coeff(i);
|
||||
}
|
||||
}
|
||||
|
||||
static BTL_DONT_INLINE void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N=A_stl.size();
|
||||
|
||||
for (int j=0;j<N;j++){
|
||||
A_stl[j].resize(N);
|
||||
for (int i=0;i<N;i++){
|
||||
A_stl[j][i] = A.coeff(i,j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int /*N*/){
|
||||
X.noalias() = A*B;
|
||||
}
|
||||
|
||||
static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int /*N*/){
|
||||
X.noalias() = A.transpose()*B.transpose();
|
||||
}
|
||||
|
||||
// static inline void ata_product(const gene_matrix & A, gene_matrix & X, int /*N*/){
|
||||
// X.noalias() = A.transpose()*A;
|
||||
// }
|
||||
|
||||
static inline void aat_product(const gene_matrix & A, gene_matrix & X, int /*N*/){
|
||||
X.template triangularView<Lower>().setZero();
|
||||
X.template selfadjointView<Lower>().rankUpdate(A);
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){
|
||||
X.noalias() = A*B;
|
||||
}
|
||||
|
||||
static inline void symv(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){
|
||||
X.noalias() = (A.template selfadjointView<Lower>() * B);
|
||||
// internal::product_selfadjoint_vector<real,0,LowerTriangularBit,false,false>(N,A.data(),N, B.data(), 1, X.data(), 1);
|
||||
}
|
||||
|
||||
template<typename Dest, typename Src> static void triassign(Dest& dst, const Src& src)
|
||||
{
|
||||
typedef typename Dest::Scalar Scalar;
|
||||
typedef typename internal::packet_traits<Scalar>::type Packet;
|
||||
const int PacketSize = sizeof(Packet)/sizeof(Scalar);
|
||||
int size = dst.cols();
|
||||
for(int j=0; j<size; j+=1)
|
||||
{
|
||||
// const int alignedEnd = alignedStart + ((innerSize-alignedStart) & ~packetAlignedMask);
|
||||
Scalar* A0 = dst.data() + j*dst.stride();
|
||||
int starti = j;
|
||||
int alignedEnd = starti;
|
||||
int alignedStart = (starti) + internal::first_aligned(&A0[starti], size-starti);
|
||||
alignedEnd = alignedStart + ((size-alignedStart)/(2*PacketSize))*(PacketSize*2);
|
||||
|
||||
// do the non-vectorizable part of the assignment
|
||||
for (int index = starti; index<alignedStart ; ++index)
|
||||
{
|
||||
if(Dest::Flags&RowMajorBit)
|
||||
dst.copyCoeff(j, index, src);
|
||||
else
|
||||
dst.copyCoeff(index, j, src);
|
||||
}
|
||||
|
||||
// do the vectorizable part of the assignment
|
||||
for (int index = alignedStart; index<alignedEnd; index+=PacketSize)
|
||||
{
|
||||
if(Dest::Flags&RowMajorBit)
|
||||
dst.template copyPacket<Src, Aligned, Unaligned>(j, index, src);
|
||||
else
|
||||
dst.template copyPacket<Src, Aligned, Unaligned>(index, j, src);
|
||||
}
|
||||
|
||||
// do the non-vectorizable part of the assignment
|
||||
for (int index = alignedEnd; index<size; ++index)
|
||||
{
|
||||
if(Dest::Flags&RowMajorBit)
|
||||
dst.copyCoeff(j, index, src);
|
||||
else
|
||||
dst.copyCoeff(index, j, src);
|
||||
}
|
||||
//dst.col(j).tail(N-j) = src.col(j).tail(N-j);
|
||||
}
|
||||
}
|
||||
|
||||
static EIGEN_DONT_INLINE void syr2(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){
|
||||
// internal::product_selfadjoint_rank2_update<real,0,LowerTriangularBit>(N,A.data(),N, X.data(), 1, Y.data(), 1, -1);
|
||||
for(int j=0; j<N; ++j)
|
||||
A.col(j).tail(N-j) += X[j] * Y.tail(N-j) + Y[j] * X.tail(N-j);
|
||||
}
|
||||
|
||||
static EIGEN_DONT_INLINE void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){
|
||||
for(int j=0; j<N; ++j)
|
||||
A.col(j) += X * Y[j];
|
||||
}
|
||||
|
||||
static EIGEN_DONT_INLINE void rot(gene_vector & A, gene_vector & B, real c, real s, int /*N*/){
|
||||
internal::apply_rotation_in_the_plane(A, B, JacobiRotation<real>(c,s));
|
||||
}
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int /*N*/){
|
||||
X.noalias() = (A.transpose()*B);
|
||||
}
|
||||
|
||||
static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int /*N*/){
|
||||
Y += coef * X;
|
||||
}
|
||||
|
||||
static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int /*N*/){
|
||||
Y = a*X + b*Y;
|
||||
}
|
||||
|
||||
static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int /*N*/){
|
||||
cible = source;
|
||||
}
|
||||
|
||||
static EIGEN_DONT_INLINE void copy_vector(const gene_vector & source, gene_vector & cible, int /*N*/){
|
||||
cible = source;
|
||||
}
|
||||
|
||||
static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector& X, int /*N*/){
|
||||
X = L.template triangularView<Lower>().solve(B);
|
||||
}
|
||||
|
||||
static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int /*N*/){
|
||||
X = L.template triangularView<Upper>().solve(B);
|
||||
}
|
||||
|
||||
static inline void trmm(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int /*N*/){
|
||||
X.noalias() = L.template triangularView<Lower>() * B;
|
||||
}
|
||||
|
||||
static inline void cholesky(const gene_matrix & X, gene_matrix & C, int /*N*/){
|
||||
C = X;
|
||||
internal::llt_inplace<real,Lower>::blocked(C);
|
||||
//C = X.llt().matrixL();
|
||||
// C = X;
|
||||
// Cholesky<gene_matrix>::computeInPlace(C);
|
||||
// Cholesky<gene_matrix>::computeInPlaceBlock(C);
|
||||
}
|
||||
|
||||
static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int /*N*/){
|
||||
C = X.fullPivLu().matrixLU();
|
||||
}
|
||||
|
||||
static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
|
||||
Matrix<DenseIndex,1,Dynamic> piv(N);
|
||||
DenseIndex nb;
|
||||
C = X;
|
||||
internal::partial_lu_inplace(C,piv,nb);
|
||||
// C = X.partialPivLu().matrixLU();
|
||||
}
|
||||
|
||||
static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){
|
||||
typename Tridiagonalization<gene_matrix>::CoeffVectorType aux(N-1);
|
||||
C = X;
|
||||
internal::tridiagonalization_inplace(C, aux);
|
||||
}
|
||||
|
||||
static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int /*N*/){
|
||||
C = HessenbergDecomposition<gene_matrix>(X).packedMatrix();
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
44
cs440-acg/ext/eigen/bench/btl/libs/eigen3/main_adv.cpp
Normal file
44
cs440-acg/ext/eigen/bench/btl/libs/eigen3/main_adv.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "eigen3_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "action_trisolve.hh"
|
||||
#include "action_trisolve_matrix.hh"
|
||||
#include "action_cholesky.hh"
|
||||
#include "action_hessenberg.hh"
|
||||
#include "action_lu_decomp.hh"
|
||||
#include "action_partial_lu.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench<Action_trisolve<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
bench<Action_trisolve_matrix<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
bench<Action_cholesky<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
// bench<Action_lu_decomp<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
bench<Action_partial_lu<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
|
||||
// bench<Action_hessenberg<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
bench<Action_tridiagonalization<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
35
cs440-acg/ext/eigen/bench/btl/libs/eigen3/main_linear.cpp
Normal file
35
cs440-acg/ext/eigen/bench/btl/libs/eigen3/main_linear.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "eigen3_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
bench<Action_axpy<eigen3_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
bench<Action_axpby<eigen3_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
bench<Action_rot<eigen3_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
35
cs440-acg/ext/eigen/bench/btl/libs/eigen3/main_matmat.cpp
Normal file
35
cs440-acg/ext/eigen/bench/btl/libs/eigen3/main_matmat.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "eigen3_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench<Action_matrix_matrix_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_ata_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_aat_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_trmm<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
36
cs440-acg/ext/eigen/bench/btl/libs/eigen3/main_vecmat.cpp
Normal file
36
cs440-acg/ext/eigen/bench/btl/libs/eigen3/main_vecmat.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "eigen3_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench<Action_matrix_vector_product<eigen3_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_atv_product<eigen3_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_symv<eigen3_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_syr2<eigen3_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_ger<eigen3_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
6
cs440-acg/ext/eigen/bench/btl/libs/gmm/CMakeLists.txt
Normal file
6
cs440-acg/ext/eigen/bench/btl/libs/gmm/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
find_package(GMM)
|
||||
if (GMM_FOUND)
|
||||
include_directories(${GMM_INCLUDES})
|
||||
btl_add_bench(btl_gmm main.cpp)
|
||||
endif (GMM_FOUND)
|
192
cs440-acg/ext/eigen/bench/btl/libs/gmm/gmm_LU_solve_interface.hh
Normal file
192
cs440-acg/ext/eigen/bench/btl/libs/gmm/gmm_LU_solve_interface.hh
Normal file
@@ -0,0 +1,192 @@
|
||||
//=====================================================
|
||||
// File : blitz_LU_solve_interface.hh
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef BLITZ_LU_SOLVE_INTERFACE_HH
|
||||
#define BLITZ_LU_SOLVE_INTERFACE_HH
|
||||
|
||||
#include "blitz/array.h"
|
||||
#include <vector>
|
||||
|
||||
BZ_USING_NAMESPACE(blitz)
|
||||
|
||||
template<class real>
|
||||
class blitz_LU_solve_interface : public blitz_interface<real>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
typedef typename blitz_interface<real>::gene_matrix gene_matrix;
|
||||
typedef typename blitz_interface<real>::gene_vector gene_vector;
|
||||
|
||||
typedef blitz::Array<int,1> Pivot_Vector;
|
||||
|
||||
inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N)
|
||||
{
|
||||
|
||||
pivot.resize(N);
|
||||
|
||||
}
|
||||
|
||||
inline static void free_Pivot_Vector(Pivot_Vector & pivot)
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end)
|
||||
{
|
||||
|
||||
real somme=0.;
|
||||
|
||||
for (int j=col_start ; j<col_end+1 ; j++){
|
||||
|
||||
somme+=A(row,j)*B(j);
|
||||
|
||||
}
|
||||
|
||||
return somme;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static inline real matrix_matrix_product_sliced(gene_matrix & A, int row, int col_start, int col_end, gene_matrix & B, int row_shift, int col )
|
||||
{
|
||||
|
||||
real somme=0.;
|
||||
|
||||
for (int j=col_start ; j<col_end+1 ; j++){
|
||||
|
||||
somme+=A(row,j)*B(j+row_shift,col);
|
||||
|
||||
}
|
||||
|
||||
return somme;
|
||||
|
||||
}
|
||||
|
||||
inline static void LU_factor(gene_matrix & LU, Pivot_Vector & pivot, int N)
|
||||
{
|
||||
|
||||
ASSERT( LU.rows()==LU.cols() ) ;
|
||||
int index_max = 0 ;
|
||||
real big = 0. ;
|
||||
real theSum = 0. ;
|
||||
real dum = 0. ;
|
||||
// Get the implicit scaling information :
|
||||
gene_vector ImplicitScaling( N ) ;
|
||||
for( int i=0; i<N; i++ ) {
|
||||
big = 0. ;
|
||||
for( int j=0; j<N; j++ ) {
|
||||
if( abs( LU( i, j ) )>=big ) big = abs( LU( i, j ) ) ;
|
||||
}
|
||||
if( big==0. ) {
|
||||
INFOS( "blitz_LU_factor::Singular matrix" ) ;
|
||||
exit( 0 ) ;
|
||||
}
|
||||
ImplicitScaling( i ) = 1./big ;
|
||||
}
|
||||
// Loop over columns of Crout's method :
|
||||
for( int j=0; j<N; j++ ) {
|
||||
for( int i=0; i<j; i++ ) {
|
||||
theSum = LU( i, j ) ;
|
||||
theSum -= matrix_matrix_product_sliced(LU, i, 0, i-1, LU, 0, j) ;
|
||||
// theSum -= sum( LU( i, Range( fromStart, i-1 ) )*LU( Range( fromStart, i-1 ), j ) ) ;
|
||||
LU( i, j ) = theSum ;
|
||||
}
|
||||
|
||||
// Search for the largest pivot element :
|
||||
big = 0. ;
|
||||
for( int i=j; i<N; i++ ) {
|
||||
theSum = LU( i, j ) ;
|
||||
theSum -= matrix_matrix_product_sliced(LU, i, 0, j-1, LU, 0, j) ;
|
||||
// theSum -= sum( LU( i, Range( fromStart, j-1 ) )*LU( Range( fromStart, j-1 ), j ) ) ;
|
||||
LU( i, j ) = theSum ;
|
||||
if( (ImplicitScaling( i )*abs( theSum ))>=big ) {
|
||||
dum = ImplicitScaling( i )*abs( theSum ) ;
|
||||
big = dum ;
|
||||
index_max = i ;
|
||||
}
|
||||
}
|
||||
// Interchanging rows and the scale factor :
|
||||
if( j!=index_max ) {
|
||||
for( int k=0; k<N; k++ ) {
|
||||
dum = LU( index_max, k ) ;
|
||||
LU( index_max, k ) = LU( j, k ) ;
|
||||
LU( j, k ) = dum ;
|
||||
}
|
||||
ImplicitScaling( index_max ) = ImplicitScaling( j ) ;
|
||||
}
|
||||
pivot( j ) = index_max ;
|
||||
if ( LU( j, j )==0. ) LU( j, j ) = 1.e-20 ;
|
||||
// Divide by the pivot element :
|
||||
if( j<N ) {
|
||||
dum = 1./LU( j, j ) ;
|
||||
for( int i=j+1; i<N; i++ ) LU( i, j ) *= dum ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline static void LU_solve(const gene_matrix & LU, const Pivot_Vector pivot, gene_vector &B, gene_vector X, int N)
|
||||
{
|
||||
|
||||
// Pour conserver le meme header, on travaille sur X, copie du second-membre B
|
||||
X = B.copy() ;
|
||||
ASSERT( LU.rows()==LU.cols() ) ;
|
||||
firstIndex indI ;
|
||||
// Forward substitution :
|
||||
int ii = 0 ;
|
||||
real theSum = 0. ;
|
||||
for( int i=0; i<N; i++ ) {
|
||||
int ip = pivot( i ) ;
|
||||
theSum = X( ip ) ;
|
||||
// theSum = B( ip ) ;
|
||||
X( ip ) = X( i ) ;
|
||||
// B( ip ) = B( i ) ;
|
||||
if( ii ) {
|
||||
theSum -= matrix_vector_product_sliced(LU, X, i, ii-1, i-1) ;
|
||||
// theSum -= sum( LU( i, Range( ii-1, i-1 ) )*X( Range( ii-1, i-1 ) ) ) ;
|
||||
// theSum -= sum( LU( i, Range( ii-1, i-1 ) )*B( Range( ii-1, i-1 ) ) ) ;
|
||||
} else if( theSum ) {
|
||||
ii = i+1 ;
|
||||
}
|
||||
X( i ) = theSum ;
|
||||
// B( i ) = theSum ;
|
||||
}
|
||||
// Backsubstitution :
|
||||
for( int i=N-1; i>=0; i-- ) {
|
||||
theSum = X( i ) ;
|
||||
// theSum = B( i ) ;
|
||||
theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ;
|
||||
// theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ;
|
||||
// theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ;
|
||||
// Store a component of the solution vector :
|
||||
X( i ) = theSum/LU( i, i ) ;
|
||||
// B( i ) = theSum/LU( i, i ) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
144
cs440-acg/ext/eigen/bench/btl/libs/gmm/gmm_interface.hh
Normal file
144
cs440-acg/ext/eigen/bench/btl/libs/gmm/gmm_interface.hh
Normal file
@@ -0,0 +1,144 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef GMM_INTERFACE_HH
|
||||
#define GMM_INTERFACE_HH
|
||||
|
||||
#include <gmm/gmm.h>
|
||||
#include <vector>
|
||||
|
||||
using namespace gmm;
|
||||
|
||||
template<class real>
|
||||
class gmm_interface {
|
||||
|
||||
public :
|
||||
|
||||
typedef real real_type ;
|
||||
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector > stl_matrix;
|
||||
|
||||
typedef gmm::dense_matrix<real> gene_matrix;
|
||||
typedef stl_vector gene_vector;
|
||||
|
||||
static inline std::string name( void )
|
||||
{
|
||||
return "gmm";
|
||||
}
|
||||
|
||||
static void free_matrix(gene_matrix & A, int N){
|
||||
return ;
|
||||
}
|
||||
|
||||
static void free_vector(gene_vector & B){
|
||||
return ;
|
||||
}
|
||||
|
||||
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
A.resize(A_stl[0].size(),A_stl.size());
|
||||
|
||||
for (int j=0; j<A_stl.size() ; j++){
|
||||
for (int i=0; i<A_stl[j].size() ; i++){
|
||||
A(i,j) = A_stl[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
B = B_stl;
|
||||
}
|
||||
|
||||
static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
B_stl = B;
|
||||
}
|
||||
|
||||
static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N=A_stl.size();
|
||||
|
||||
for (int j=0;j<N;j++){
|
||||
A_stl[j].resize(N);
|
||||
for (int i=0;i<N;i++){
|
||||
A_stl[j][i] = A(i,j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
gmm::mult(A,B, X);
|
||||
}
|
||||
|
||||
static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
gmm::mult(gmm::transposed(A),gmm::transposed(B), X);
|
||||
}
|
||||
|
||||
static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
gmm::mult(gmm::transposed(A),A, X);
|
||||
}
|
||||
|
||||
static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
gmm::mult(A,gmm::transposed(A), X);
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
gmm::mult(A,B,X);
|
||||
}
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
gmm::mult(gmm::transposed(A),B,X);
|
||||
}
|
||||
|
||||
static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
gmm::add(gmm::scaled(X,coef), Y);
|
||||
}
|
||||
|
||||
static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){
|
||||
gmm::add(gmm::scaled(X,a), gmm::scaled(Y,b), Y);
|
||||
}
|
||||
|
||||
static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
|
||||
gmm::copy(source,cible);
|
||||
}
|
||||
|
||||
static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
|
||||
gmm::copy(source,cible);
|
||||
}
|
||||
|
||||
static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){
|
||||
gmm::copy(B,X);
|
||||
gmm::lower_tri_solve(L, X, false);
|
||||
}
|
||||
|
||||
static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & R, int N){
|
||||
gmm::copy(X,R);
|
||||
std::vector<int> ipvt(N);
|
||||
gmm::lu_factor(R, ipvt);
|
||||
}
|
||||
|
||||
static inline void hessenberg(const gene_matrix & X, gene_matrix & R, int N){
|
||||
gmm::copy(X,R);
|
||||
gmm::Hessenberg_reduction(R,X,false);
|
||||
}
|
||||
|
||||
static inline void tridiagonalization(const gene_matrix & X, gene_matrix & R, int N){
|
||||
gmm::copy(X,R);
|
||||
gmm::Householder_tridiagonalization(R,X,false);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
51
cs440-acg/ext/eigen/bench/btl/libs/gmm/main.cpp
Normal file
51
cs440-acg/ext/eigen/bench/btl/libs/gmm/main.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "gmm_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
#include "action_hessenberg.hh"
|
||||
#include "action_partial_lu.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
bench<Action_axpy<gmm_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
bench<Action_axpby<gmm_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
|
||||
bench<Action_matrix_vector_product<gmm_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_atv_product<gmm_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
|
||||
bench<Action_matrix_matrix_product<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_ata_product<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_aat_product<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_trisolve<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
//bench<Action_lu_solve<blitz_LU_solve_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
|
||||
|
||||
bench<Action_partial_lu<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_hessenberg<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_tridiagonalization<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
12
cs440-acg/ext/eigen/bench/btl/libs/mtl4/.kdbgrc.main
Normal file
12
cs440-acg/ext/eigen/bench/btl/libs/mtl4/.kdbgrc.main
Normal file
@@ -0,0 +1,12 @@
|
||||
[General]
|
||||
DebuggerCmdStr=
|
||||
DriverName=GDB
|
||||
FileVersion=1
|
||||
OptionsSelected=
|
||||
ProgramArgs=
|
||||
TTYLevel=7
|
||||
WorkingDirectory=
|
||||
|
||||
[Memory]
|
||||
ColumnWidths=80,0
|
||||
NumExprs=0
|
6
cs440-acg/ext/eigen/bench/btl/libs/mtl4/CMakeLists.txt
Normal file
6
cs440-acg/ext/eigen/bench/btl/libs/mtl4/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
find_package(MTL4)
|
||||
if (MTL4_FOUND)
|
||||
include_directories(${MTL4_INCLUDE_DIR})
|
||||
btl_add_bench(btl_mtl4 main.cpp)
|
||||
endif (MTL4_FOUND)
|
46
cs440-acg/ext/eigen/bench/btl/libs/mtl4/main.cpp
Normal file
46
cs440-acg/ext/eigen/bench/btl/libs/mtl4/main.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "mtl4_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
#include "action_cholesky.hh"
|
||||
// #include "action_lu_decomp.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
bench<Action_axpy<mtl4_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
bench<Action_axpby<mtl4_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
|
||||
bench<Action_matrix_vector_product<mtl4_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_atv_product<mtl4_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_matrix_matrix_product<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_ata_product<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_aat_product<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_trisolve<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_cholesky<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_lu_decomp<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,192 @@
|
||||
//=====================================================
|
||||
// File : blitz_LU_solve_interface.hh
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef BLITZ_LU_SOLVE_INTERFACE_HH
|
||||
#define BLITZ_LU_SOLVE_INTERFACE_HH
|
||||
|
||||
#include "blitz/array.h"
|
||||
#include <vector>
|
||||
|
||||
BZ_USING_NAMESPACE(blitz)
|
||||
|
||||
template<class real>
|
||||
class blitz_LU_solve_interface : public blitz_interface<real>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
typedef typename blitz_interface<real>::gene_matrix gene_matrix;
|
||||
typedef typename blitz_interface<real>::gene_vector gene_vector;
|
||||
|
||||
typedef blitz::Array<int,1> Pivot_Vector;
|
||||
|
||||
inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N)
|
||||
{
|
||||
|
||||
pivot.resize(N);
|
||||
|
||||
}
|
||||
|
||||
inline static void free_Pivot_Vector(Pivot_Vector & pivot)
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end)
|
||||
{
|
||||
|
||||
real somme=0.;
|
||||
|
||||
for (int j=col_start ; j<col_end+1 ; j++){
|
||||
|
||||
somme+=A(row,j)*B(j);
|
||||
|
||||
}
|
||||
|
||||
return somme;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static inline real matrix_matrix_product_sliced(gene_matrix & A, int row, int col_start, int col_end, gene_matrix & B, int row_shift, int col )
|
||||
{
|
||||
|
||||
real somme=0.;
|
||||
|
||||
for (int j=col_start ; j<col_end+1 ; j++){
|
||||
|
||||
somme+=A(row,j)*B(j+row_shift,col);
|
||||
|
||||
}
|
||||
|
||||
return somme;
|
||||
|
||||
}
|
||||
|
||||
inline static void LU_factor(gene_matrix & LU, Pivot_Vector & pivot, int N)
|
||||
{
|
||||
|
||||
ASSERT( LU.rows()==LU.cols() ) ;
|
||||
int index_max = 0 ;
|
||||
real big = 0. ;
|
||||
real theSum = 0. ;
|
||||
real dum = 0. ;
|
||||
// Get the implicit scaling information :
|
||||
gene_vector ImplicitScaling( N ) ;
|
||||
for( int i=0; i<N; i++ ) {
|
||||
big = 0. ;
|
||||
for( int j=0; j<N; j++ ) {
|
||||
if( abs( LU( i, j ) )>=big ) big = abs( LU( i, j ) ) ;
|
||||
}
|
||||
if( big==0. ) {
|
||||
INFOS( "blitz_LU_factor::Singular matrix" ) ;
|
||||
exit( 0 ) ;
|
||||
}
|
||||
ImplicitScaling( i ) = 1./big ;
|
||||
}
|
||||
// Loop over columns of Crout's method :
|
||||
for( int j=0; j<N; j++ ) {
|
||||
for( int i=0; i<j; i++ ) {
|
||||
theSum = LU( i, j ) ;
|
||||
theSum -= matrix_matrix_product_sliced(LU, i, 0, i-1, LU, 0, j) ;
|
||||
// theSum -= sum( LU( i, Range( fromStart, i-1 ) )*LU( Range( fromStart, i-1 ), j ) ) ;
|
||||
LU( i, j ) = theSum ;
|
||||
}
|
||||
|
||||
// Search for the largest pivot element :
|
||||
big = 0. ;
|
||||
for( int i=j; i<N; i++ ) {
|
||||
theSum = LU( i, j ) ;
|
||||
theSum -= matrix_matrix_product_sliced(LU, i, 0, j-1, LU, 0, j) ;
|
||||
// theSum -= sum( LU( i, Range( fromStart, j-1 ) )*LU( Range( fromStart, j-1 ), j ) ) ;
|
||||
LU( i, j ) = theSum ;
|
||||
if( (ImplicitScaling( i )*abs( theSum ))>=big ) {
|
||||
dum = ImplicitScaling( i )*abs( theSum ) ;
|
||||
big = dum ;
|
||||
index_max = i ;
|
||||
}
|
||||
}
|
||||
// Interchanging rows and the scale factor :
|
||||
if( j!=index_max ) {
|
||||
for( int k=0; k<N; k++ ) {
|
||||
dum = LU( index_max, k ) ;
|
||||
LU( index_max, k ) = LU( j, k ) ;
|
||||
LU( j, k ) = dum ;
|
||||
}
|
||||
ImplicitScaling( index_max ) = ImplicitScaling( j ) ;
|
||||
}
|
||||
pivot( j ) = index_max ;
|
||||
if ( LU( j, j )==0. ) LU( j, j ) = 1.e-20 ;
|
||||
// Divide by the pivot element :
|
||||
if( j<N ) {
|
||||
dum = 1./LU( j, j ) ;
|
||||
for( int i=j+1; i<N; i++ ) LU( i, j ) *= dum ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline static void LU_solve(const gene_matrix & LU, const Pivot_Vector pivot, gene_vector &B, gene_vector X, int N)
|
||||
{
|
||||
|
||||
// Pour conserver le meme header, on travaille sur X, copie du second-membre B
|
||||
X = B.copy() ;
|
||||
ASSERT( LU.rows()==LU.cols() ) ;
|
||||
firstIndex indI ;
|
||||
// Forward substitution :
|
||||
int ii = 0 ;
|
||||
real theSum = 0. ;
|
||||
for( int i=0; i<N; i++ ) {
|
||||
int ip = pivot( i ) ;
|
||||
theSum = X( ip ) ;
|
||||
// theSum = B( ip ) ;
|
||||
X( ip ) = X( i ) ;
|
||||
// B( ip ) = B( i ) ;
|
||||
if( ii ) {
|
||||
theSum -= matrix_vector_product_sliced(LU, X, i, ii-1, i-1) ;
|
||||
// theSum -= sum( LU( i, Range( ii-1, i-1 ) )*X( Range( ii-1, i-1 ) ) ) ;
|
||||
// theSum -= sum( LU( i, Range( ii-1, i-1 ) )*B( Range( ii-1, i-1 ) ) ) ;
|
||||
} else if( theSum ) {
|
||||
ii = i+1 ;
|
||||
}
|
||||
X( i ) = theSum ;
|
||||
// B( i ) = theSum ;
|
||||
}
|
||||
// Backsubstitution :
|
||||
for( int i=N-1; i>=0; i-- ) {
|
||||
theSum = X( i ) ;
|
||||
// theSum = B( i ) ;
|
||||
theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ;
|
||||
// theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ;
|
||||
// theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ;
|
||||
// Store a component of the solution vector :
|
||||
X( i ) = theSum/LU( i, i ) ;
|
||||
// B( i ) = theSum/LU( i, i ) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
144
cs440-acg/ext/eigen/bench/btl/libs/mtl4/mtl4_interface.hh
Normal file
144
cs440-acg/ext/eigen/bench/btl/libs/mtl4/mtl4_interface.hh
Normal file
@@ -0,0 +1,144 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef MTL4_INTERFACE_HH
|
||||
#define MTL4_INTERFACE_HH
|
||||
|
||||
#include <boost/numeric/mtl/mtl.hpp>
|
||||
#include <boost/numeric/mtl/utility/range_generator.hpp>
|
||||
// #include <boost/numeric/mtl/operation/cholesky.hpp>
|
||||
#include <vector>
|
||||
|
||||
using namespace mtl;
|
||||
|
||||
template<class real>
|
||||
class mtl4_interface {
|
||||
|
||||
public :
|
||||
|
||||
typedef real real_type ;
|
||||
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector > stl_matrix;
|
||||
|
||||
typedef mtl::dense2D<real, mtl::matrix::parameters<mtl::tag::col_major> > gene_matrix;
|
||||
typedef mtl::dense_vector<real> gene_vector;
|
||||
|
||||
static inline std::string name() { return "mtl4"; }
|
||||
|
||||
static void free_matrix(gene_matrix & A, int N){
|
||||
return ;
|
||||
}
|
||||
|
||||
static void free_vector(gene_vector & B){
|
||||
return ;
|
||||
}
|
||||
|
||||
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
A.change_dim(A_stl[0].size(), A_stl.size());
|
||||
|
||||
for (int j=0; j<A_stl.size() ; j++){
|
||||
for (int i=0; i<A_stl[j].size() ; i++){
|
||||
A(i,j) = A_stl[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
B.change_dim(B_stl.size());
|
||||
for (int i=0; i<B_stl.size() ; i++){
|
||||
B[i] = B_stl[i];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
for (int i=0; i<B_stl.size() ; i++){
|
||||
B_stl[i] = B[i];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N=A_stl.size();
|
||||
for (int j=0;j<N;j++){
|
||||
A_stl[j].resize(N);
|
||||
for (int i=0;i<N;i++){
|
||||
A_stl[j][i] = A(i,j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
X = (A*B);
|
||||
// morton_dense<double, doppled_64_row_mask> C(N,N);
|
||||
// C = B;
|
||||
// X = (A*C);
|
||||
}
|
||||
|
||||
static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
X = (trans(A)*trans(B));
|
||||
}
|
||||
|
||||
// static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
// X = (trans(A)*A);
|
||||
// }
|
||||
|
||||
static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
X = (A*trans(A));
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X = (A*B);
|
||||
}
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X = (trans(A)*B);
|
||||
}
|
||||
|
||||
static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
Y += coef * X;
|
||||
}
|
||||
|
||||
static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){
|
||||
Y = a*X + b*Y;
|
||||
}
|
||||
|
||||
// static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){
|
||||
// C = X;
|
||||
// recursive_cholesky(C);
|
||||
// }
|
||||
|
||||
// static inline void lu_decomp(const gene_matrix & X, gene_matrix & R, int N){
|
||||
// R = X;
|
||||
// std::vector<int> ipvt(N);
|
||||
// lu_factor(R, ipvt);
|
||||
// }
|
||||
|
||||
static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){
|
||||
X = lower_trisolve(L, B);
|
||||
}
|
||||
|
||||
static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
|
||||
cible = source;
|
||||
}
|
||||
|
||||
static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
|
||||
cible = source;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
44
cs440-acg/ext/eigen/bench/btl/libs/tensors/CMakeLists.txt
Normal file
44
cs440-acg/ext/eigen/bench/btl/libs/tensors/CMakeLists.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
|
||||
if((NOT TENSOR_INCLUDE_DIR) AND Eigen_SOURCE_DIR)
|
||||
# unless TENSOR_INCLUDE_DIR is defined, let's use current Eigen version
|
||||
set(TENSOR_INCLUDE_DIR ${Eigen_SOURCE_DIR})
|
||||
set(TENSOR_FOUND TRUE)
|
||||
else()
|
||||
find_package(Tensor)
|
||||
endif()
|
||||
|
||||
if (TENSOR_FOUND)
|
||||
|
||||
include_directories(${TENSOR_INCLUDE_DIR})
|
||||
btl_add_bench(btl_tensor_linear main_linear.cpp)
|
||||
btl_add_bench(btl_tensor_vecmat main_vecmat.cpp)
|
||||
btl_add_bench(btl_tensor_matmat main_matmat.cpp)
|
||||
|
||||
btl_add_target_property(btl_tensor_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor")
|
||||
btl_add_target_property(btl_tensor_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor")
|
||||
btl_add_target_property(btl_tensor_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor")
|
||||
|
||||
option(BTL_BENCH_NOGCCVEC "also bench Eigen explicit vec without GCC's auto vec" OFF)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND BTL_BENCH_NOGCCVEC)
|
||||
btl_add_bench(btl_tensor_nogccvec_linear main_linear.cpp)
|
||||
btl_add_bench(btl_tensor_nogccvec_vecmat main_vecmat.cpp)
|
||||
btl_add_bench(btl_tensor_nogccvec_matmat main_matmat.cpp)
|
||||
|
||||
btl_add_target_property(btl_tensor_nogccvec_linear COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec")
|
||||
btl_add_target_property(btl_tensor_nogccvec_vecmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec")
|
||||
btl_add_target_property(btl_tensor_nogccvec_matmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec")
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT BTL_NOVEC)
|
||||
btl_add_bench(btl_tensor_novec_linear main_linear.cpp OFF)
|
||||
btl_add_bench(btl_tensor_novec_vecmat main_vecmat.cpp OFF)
|
||||
btl_add_bench(btl_tensor_novec_matmat main_matmat.cpp OFF)
|
||||
btl_add_target_property(btl_tensor_novec_linear COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec")
|
||||
btl_add_target_property(btl_tensor_novec_vecmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec")
|
||||
btl_add_target_property(btl_tensor_novec_matmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec")
|
||||
|
||||
endif(NOT BTL_NOVEC)
|
||||
|
||||
endif (TENSOR_FOUND)
|
23
cs440-acg/ext/eigen/bench/btl/libs/tensors/main_linear.cpp
Normal file
23
cs440-acg/ext/eigen/bench/btl/libs/tensors/main_linear.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
// This file is part of Eigen, a lightweight C++ template library
|
||||
// for linear algebra.
|
||||
//
|
||||
// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
|
||||
//
|
||||
// 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/.
|
||||
|
||||
#include "utilities.h"
|
||||
#include "tensor_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench<Action_axpy<tensor_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
bench<Action_axpby<tensor_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
21
cs440-acg/ext/eigen/bench/btl/libs/tensors/main_matmat.cpp
Normal file
21
cs440-acg/ext/eigen/bench/btl/libs/tensors/main_matmat.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
|
||||
//=====================================================
|
||||
//
|
||||
// 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/.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "tensor_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench<Action_matrix_matrix_product<tensor_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
21
cs440-acg/ext/eigen/bench/btl/libs/tensors/main_vecmat.cpp
Normal file
21
cs440-acg/ext/eigen/bench/btl/libs/tensors/main_vecmat.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
|
||||
//=====================================================
|
||||
//
|
||||
// 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/.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "tensor_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench<Action_matrix_vector_product<tensor_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
105
cs440-acg/ext/eigen/bench/btl/libs/tensors/tensor_interface.hh
Normal file
105
cs440-acg/ext/eigen/bench/btl/libs/tensors/tensor_interface.hh
Normal file
@@ -0,0 +1,105 @@
|
||||
//=====================================================
|
||||
// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
|
||||
//=====================================================
|
||||
//
|
||||
// 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/.
|
||||
//
|
||||
#ifndef TENSOR_INTERFACE_HH
|
||||
#define TENSOR_INTERFACE_HH
|
||||
|
||||
#include <unsupported/Eigen/CXX11/Tensor>
|
||||
#include <vector>
|
||||
#include "btl.hh"
|
||||
|
||||
using namespace Eigen;
|
||||
|
||||
template<class real>
|
||||
class tensor_interface
|
||||
{
|
||||
public :
|
||||
typedef real real_type;
|
||||
typedef typename Eigen::Tensor<real,2>::Index Index;
|
||||
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector> stl_matrix;
|
||||
|
||||
typedef Eigen::Tensor<real,2> gene_matrix;
|
||||
typedef Eigen::Tensor<real,1> gene_vector;
|
||||
|
||||
|
||||
static inline std::string name( void )
|
||||
{
|
||||
return EIGEN_MAKESTRING(BTL_PREFIX);
|
||||
}
|
||||
|
||||
static void free_matrix(gene_matrix & /*A*/, int /*N*/) {}
|
||||
|
||||
static void free_vector(gene_vector & /*B*/) {}
|
||||
|
||||
static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
A.resize(Eigen::array<Index,2>(A_stl[0].size(), A_stl.size()));
|
||||
|
||||
for (unsigned int j=0; j<A_stl.size() ; j++){
|
||||
for (unsigned int i=0; i<A_stl[j].size() ; i++){
|
||||
A.coeffRef(Eigen::array<Index,2>(i,j)) = A_stl[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static BTL_DONT_INLINE void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
B.resize(B_stl.size());
|
||||
|
||||
for (unsigned int i=0; i<B_stl.size() ; i++){
|
||||
B.coeffRef(i) = B_stl[i];
|
||||
}
|
||||
}
|
||||
|
||||
static BTL_DONT_INLINE void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
for (unsigned int i=0; i<B_stl.size() ; i++){
|
||||
B_stl[i] = B.coeff(i);
|
||||
}
|
||||
}
|
||||
|
||||
static BTL_DONT_INLINE void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N=A_stl.size();
|
||||
|
||||
for (int j=0;j<N;j++){
|
||||
A_stl[j].resize(N);
|
||||
for (int i=0;i<N;i++){
|
||||
A_stl[j][i] = A.coeff(Eigen::array<Index,2>(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int /*N*/){
|
||||
typedef typename Eigen::Tensor<real_type, 1>::DimensionPair DimPair;
|
||||
const Eigen::array<DimPair, 1> dims(DimPair(1, 0));
|
||||
X/*.noalias()*/ = A.contract(B, dims);
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){
|
||||
typedef typename Eigen::Tensor<real_type, 1>::DimensionPair DimPair;
|
||||
const Eigen::array<DimPair, 1> dims(DimPair(1, 0));
|
||||
X/*.noalias()*/ = A.contract(B, dims);
|
||||
}
|
||||
|
||||
static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int /*N*/){
|
||||
Y += X.constant(coef) * X;
|
||||
}
|
||||
|
||||
static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int /*N*/){
|
||||
Y = X.constant(a)*X + Y.constant(b)*Y;
|
||||
}
|
||||
|
||||
static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int /*N*/){
|
||||
cible = source;
|
||||
}
|
||||
|
||||
static EIGEN_DONT_INLINE void copy_vector(const gene_vector & source, gene_vector & cible, int /*N*/){
|
||||
cible = source;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
6
cs440-acg/ext/eigen/bench/btl/libs/tvmet/CMakeLists.txt
Normal file
6
cs440-acg/ext/eigen/bench/btl/libs/tvmet/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
find_package(Tvmet)
|
||||
if (TVMET_FOUND)
|
||||
include_directories(${TVMET_INCLUDE_DIR})
|
||||
btl_add_bench(btl_tvmet main.cpp OFF)
|
||||
endif (TVMET_FOUND)
|
40
cs440-acg/ext/eigen/bench/btl/libs/tvmet/main.cpp
Normal file
40
cs440-acg/ext/eigen/bench/btl/libs/tvmet/main.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
//=====================================================
|
||||
// File : main.cpp
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "tvmet_interface.hh"
|
||||
#include "static/bench_static.hh"
|
||||
#include "action_matrix_vector_product.hh"
|
||||
#include "action_matrix_matrix_product.hh"
|
||||
#include "action_atv_product.hh"
|
||||
#include "action_axpy.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench_static<Action_axpy,tvmet_interface>();
|
||||
bench_static<Action_matrix_matrix_product,tvmet_interface>();
|
||||
bench_static<Action_matrix_vector_product,tvmet_interface>();
|
||||
bench_static<Action_atv_product,tvmet_interface>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
104
cs440-acg/ext/eigen/bench/btl/libs/tvmet/tvmet_interface.hh
Normal file
104
cs440-acg/ext/eigen/bench/btl/libs/tvmet/tvmet_interface.hh
Normal file
@@ -0,0 +1,104 @@
|
||||
//=====================================================
|
||||
// File : tvmet_interface.hh
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef TVMET_INTERFACE_HH
|
||||
#define TVMET_INTERFACE_HH
|
||||
|
||||
#include <tvmet/tvmet.h>
|
||||
#include <tvmet/Vector.h>
|
||||
#include <tvmet/Matrix.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace tvmet;
|
||||
|
||||
template<class real, int SIZE>
|
||||
class tvmet_interface{
|
||||
|
||||
public :
|
||||
|
||||
typedef real real_type ;
|
||||
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector > stl_matrix;
|
||||
|
||||
typedef Vector<real,SIZE> gene_vector;
|
||||
typedef Matrix<real,SIZE,SIZE> gene_matrix;
|
||||
|
||||
static inline std::string name() { return "tiny_tvmet"; }
|
||||
|
||||
static void free_matrix(gene_matrix & A, int N){}
|
||||
|
||||
static void free_vector(gene_vector & B){}
|
||||
|
||||
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
for (int j=0; j<A_stl.size() ; j++)
|
||||
for (int i=0; i<A_stl[j].size() ; i++)
|
||||
A(i,j) = A_stl[j][i];
|
||||
}
|
||||
|
||||
static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
for (int i=0; i<B_stl.size() ; i++)
|
||||
B[i]=B_stl[i];
|
||||
}
|
||||
|
||||
static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
for (int i=0; i<B_stl.size() ; i++){
|
||||
B_stl[i]=B[i];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N = A_stl.size();
|
||||
for (int j=0;j<N;j++){
|
||||
A_stl[j].resize(N);
|
||||
for (int i=0;i<N;i++)
|
||||
A_stl[j][i] = A(i,j);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
|
||||
cible = source;
|
||||
}
|
||||
|
||||
static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
|
||||
cible = source;
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
X = prod(A,B);
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X = prod(A,B);
|
||||
}
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X = prod(trans(A),B);
|
||||
}
|
||||
|
||||
static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
Y+=coef*X;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
7
cs440-acg/ext/eigen/bench/btl/libs/ublas/CMakeLists.txt
Normal file
7
cs440-acg/ext/eigen/bench/btl/libs/ublas/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
find_package(Boost)
|
||||
if (Boost_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
include_directories(${Boost_INCLUDES})
|
||||
btl_add_bench(btl_ublas main.cpp)
|
||||
endif (Boost_FOUND)
|
44
cs440-acg/ext/eigen/bench/btl/libs/ublas/main.cpp
Normal file
44
cs440-acg/ext/eigen/bench/btl/libs/ublas/main.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
//=====================================================
|
||||
// File : main.cpp
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:27 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#include "utilities.h"
|
||||
#include "ublas_interface.hh"
|
||||
#include "bench.hh"
|
||||
#include "basic_actions.hh"
|
||||
|
||||
BTL_MAIN;
|
||||
|
||||
int main()
|
||||
{
|
||||
bench<Action_axpy<ublas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
bench<Action_axpby<ublas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
|
||||
bench<Action_matrix_vector_product<ublas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_atv_product<ublas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
|
||||
bench<Action_matrix_matrix_product<ublas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_ata_product<ublas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_aat_product<ublas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_trisolve<ublas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
141
cs440-acg/ext/eigen/bench/btl/libs/ublas/ublas_interface.hh
Normal file
141
cs440-acg/ext/eigen/bench/btl/libs/ublas/ublas_interface.hh
Normal file
@@ -0,0 +1,141 @@
|
||||
//=====================================================
|
||||
// File : ublas_interface.hh
|
||||
// Author : L. Plagne <laurent.plagne@edf.fr)>
|
||||
// Copyright (C) EDF R&D, lun sep 30 14:23:27 CEST 2002
|
||||
//=====================================================
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
#ifndef UBLAS_INTERFACE_HH
|
||||
#define UBLAS_INTERFACE_HH
|
||||
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
#include <boost/numeric/ublas/triangular.hpp>
|
||||
|
||||
using namespace boost::numeric;
|
||||
|
||||
template <class real>
|
||||
class ublas_interface{
|
||||
|
||||
public :
|
||||
|
||||
typedef real real_type ;
|
||||
|
||||
typedef std::vector<real> stl_vector;
|
||||
typedef std::vector<stl_vector> stl_matrix;
|
||||
|
||||
typedef typename boost::numeric::ublas::matrix<real,boost::numeric::ublas::column_major> gene_matrix;
|
||||
typedef typename boost::numeric::ublas::vector<real> gene_vector;
|
||||
|
||||
static inline std::string name( void ) { return "ublas"; }
|
||||
|
||||
static void free_matrix(gene_matrix & A, int N) {}
|
||||
|
||||
static void free_vector(gene_vector & B) {}
|
||||
|
||||
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
A.resize(A_stl.size(),A_stl[0].size());
|
||||
for (int j=0; j<A_stl.size() ; j++)
|
||||
for (int i=0; i<A_stl[j].size() ; i++)
|
||||
A(i,j)=A_stl[j][i];
|
||||
}
|
||||
|
||||
static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
|
||||
B.resize(B_stl.size());
|
||||
for (int i=0; i<B_stl.size() ; i++)
|
||||
B(i)=B_stl[i];
|
||||
}
|
||||
|
||||
static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){
|
||||
for (int i=0; i<B_stl.size() ; i++)
|
||||
B_stl[i]=B(i);
|
||||
}
|
||||
|
||||
static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
|
||||
int N=A_stl.size();
|
||||
for (int j=0;j<N;j++)
|
||||
{
|
||||
A_stl[j].resize(N);
|
||||
for (int i=0;i<N;i++)
|
||||
A_stl[j][i]=A(i,j);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
|
||||
for (int i=0;i<N;i++){
|
||||
cible(i) = source(i);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
|
||||
for (int i=0;i<N;i++){
|
||||
for (int j=0;j<N;j++){
|
||||
cible(i,j) = source(i,j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product_slow(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X = prod(A,B);
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product_slow(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){
|
||||
X = prod(A,B);
|
||||
}
|
||||
|
||||
static inline void axpy_slow(const real coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
Y+=coef*X;
|
||||
}
|
||||
|
||||
// alias free assignements
|
||||
|
||||
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X.assign(prod(A,B));
|
||||
}
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X.assign(prod(trans(A),B));
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){
|
||||
X.assign(prod(A,B));
|
||||
}
|
||||
|
||||
static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
Y.plus_assign(coef*X);
|
||||
}
|
||||
|
||||
static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){
|
||||
Y = a*X + b*Y;
|
||||
}
|
||||
|
||||
static inline void ata_product(gene_matrix & A, gene_matrix & X, int N){
|
||||
// X = prod(trans(A),A);
|
||||
X.assign(prod(trans(A),A));
|
||||
}
|
||||
|
||||
static inline void aat_product(gene_matrix & A, gene_matrix & X, int N){
|
||||
// X = prod(A,trans(A));
|
||||
X.assign(prod(A,trans(A)));
|
||||
}
|
||||
|
||||
static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){
|
||||
X = solve(L, B, ublas::lower_tag ());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user