20 #ifndef UBLAS_INTERFACE_HH 21 #define UBLAS_INTERFACE_HH 23 #include <boost/numeric/ublas/vector.hpp> 24 #include <boost/numeric/ublas/matrix.hpp> 25 #include <boost/numeric/ublas/io.hpp> 26 #include <boost/numeric/ublas/triangular.hpp> 40 typedef typename boost::numeric::ublas::matrix<real,boost::numeric::ublas::column_major>
gene_matrix;
41 typedef typename boost::numeric::ublas::vector<real>
gene_vector;
43 static inline std::string
name(
void ) {
return "ublas"; }
50 A.resize(A_stl.size(),A_stl[0].size());
51 for (
int j=0;
j<A_stl.size() ;
j++)
52 for (
int i=0;
i<A_stl[
j].size() ;
i++)
57 B.resize(B_stl.size());
58 for (
int i=0;
i<B_stl.size() ;
i++)
63 for (
int i=0;
i<B_stl.size() ;
i++)
77 static inline void copy_vector(
const gene_vector & source, gene_vector & cible,
int N){
78 for (
int i=0;
i<
N;
i++){
83 static inline void copy_matrix(
const gene_matrix & source, gene_matrix & cible,
int N){
84 for (
int i=0;
i<
N;
i++){
85 for (
int j=0;
j<
N;
j++){
86 cible(
i,
j) = source(
i,
j);
99 static inline void axpy_slow(
const real coef,
const gene_vector &
X, gene_vector &
Y,
int N){
109 static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector &
X,
int N){
117 static inline void axpy(
const real coef,
const gene_vector &
X, gene_vector &
Y,
int N){
118 Y.plus_assign(coef*X);
135 static inline void trisolve_lower(
const gene_matrix &
L,
const gene_vector& B, gene_vector &
X,
int N){
136 X = solve(L, B, ublas::lower_tag ());
static void trisolve_lower(const gene_matrix &L, const gene_vector &B, gene_vector &X, int N)
static std::string name(void)
static void ata_product(gene_matrix &A, gene_matrix &X, int N)
static void aat_product(gene_matrix &A, gene_matrix &X, int N)
static void atv_product(gene_matrix &A, gene_vector &B, gene_vector &X, int N)
static void axpby(real a, const gene_vector &X, real b, gene_vector &Y, int N)
static void vector_to_stl(gene_vector &B, stl_vector &B_stl)
static void copy_vector(const gene_vector &source, gene_vector &cible, int N)
std::vector< real > stl_vector
static void axpy_slow(const real coef, const gene_vector &X, gene_vector &Y, int N)
static void free_matrix(gene_matrix &A, int N)
static void copy_matrix(const gene_matrix &source, gene_matrix &cible, int N)
static void matrix_to_stl(gene_matrix &A, stl_matrix &A_stl)
static void matrix_from_stl(gene_matrix &A, stl_matrix &A_stl)
EIGEN_DONT_INLINE void prod(const Lhs &a, const Rhs &b, Res &c)
static void vector_from_stl(gene_vector &B, stl_vector &B_stl)
static void matrix_matrix_product(gene_matrix &A, gene_matrix &B, gene_matrix &X, int N)
static void matrix_matrix_product_slow(gene_matrix &A, gene_matrix &B, gene_matrix &X, int N)
static void axpy(const real coef, const gene_vector &X, gene_vector &Y, int N)
static void matrix_vector_product_slow(gene_matrix &A, gene_vector &B, gene_vector &X, int N)
boost::numeric::ublas::vector< real > gene_vector
static void free_vector(gene_vector &B)
std::vector< stl_vector > stl_matrix
static void matrix_vector_product(gene_matrix &A, gene_vector &B, gene_vector &X, int N)
boost::numeric::ublas::matrix< real, boost::numeric::ublas::column_major > gene_matrix