示例#1
0
 typename _matmul_rvalue<A,B>::type
 operator * (A const & a, B const & b) { 
  if (second_dim(a) != first_dim(b)) TRIQS_RUNTIME_ERROR<< "Matrix product : dimension mismatch in A*B "<< a<<" "<< b; 
  auto R = typename _matmul_rvalue<A,B>::type( first_dim(a), second_dim(b));
  blas::gemm(1.0,a, b, 0.0, R);
  return R;
 }
示例#2
0
 typename _mat_vec_mul_rvalue<M,V>::type
 operator * (M const & m, V const & v) { 
  if (second_dim(m) != v.size()) TRIQS_RUNTIME_ERROR<< "Matrix product : dimension mismatch in Matrix*Vector "<< m<<" "<< v; 
  auto R = typename _mat_vec_mul_rvalue<M,V>::type(first_dim(m));
  blas::gemv(1.0,m,v,0.0,R);
  return R;
 }
示例#3
0
文件: ger.hpp 项目: TRIQS/triqs
  typename std::enable_if<is_blas_lapack_type<typename VTX::value_type>::value && have_same_value_type<VTX, VTY, MT>::value>::type
  ger(typename VTX::value_type alpha, VTX const &X, VTY const &Y, MT &A) {
    static_assert(is_amv_value_or_view_class<MT>::value, "ger : A must be a matrix or a matrix_view");
    if ((first_dim(A) != Y.size()) || (second_dim(A) != X.size()))
      TRIQS_RUNTIME_ERROR << "Dimension mismatch in ger : A : " << get_shape(A()) << " while X : " << get_shape(X()) << " and Y : " << get_shape(Y());
    const_qcache<VTX> Cx(X); // mettre la condition a la main
    const_qcache<VTY> Cy(Y); // mettre la condition a la main
    reflexive_qcache<MT> Ca(A);
    if (Ca().memory_layout_is_c()) // tA += alpha y tx
      f77::ger(get_n_rows(Ca()), get_n_cols(Ca()), alpha, Cy().data_start(), Cy().stride(), Cx().data_start(), Cx().stride(), Ca().data_start(),
               get_ld(Ca()));
    else
      f77::ger(get_n_rows(Ca()), get_n_cols(Ca()), alpha, Cx().data_start(), Cx().stride(), Cy().data_start(), Cy().stride(), Ca().data_start(),
               get_ld(Ca()));

    /* std::cerr << " Meme labout  C"<< Ca().memory_layout_is_c()  << "  "<<A.memory_layout_is_c()<<std::endl ;
   std::cerr<< " has_contiguous_data(A) : "<< has_contiguous_data(A) << std::endl;
   std::cerr<< Ca()<< std::endl;
   std::cerr<< Ca()(0,0) <<  "  "<< Ca()(1,0) <<  "  "<< Ca()(0,1) <<  "  "<< Ca()(1,1) <<  "  "<< std::endl;
   std::cerr<< Ca().data_start()[0]<< "  "<< Ca().data_start()[1]<< "  "<< Ca().data_start()[2]<< "  " << Ca().data_start()[3]<< "  "<<std::endl;

   std::cerr<< A<< std::endl;
   std::cerr<< A(0,0) <<  "  "<< A(1,0) <<  "  "<< A(0,1) <<  "  "<< A(1,1) <<  "  "<< std::endl;
   std::cerr<< A.data_start()[0]<< "  "<< A.data_start()[1]<< "  "<< A.data_start()[2]<< "  " << A.data_start()[3]<< "  "<<std::endl;
*/
  }
示例#4
0
文件: tools.hpp 项目: EBRUDU1/triqs
 // returns the # of cols of the matrix *seen* as fortran matrix
 template <typename MatrixType> int get_n_cols (MatrixType const & A) { 
  return (A.memory_layout_is_fortran() ? second_dim(A) : first_dim(A));
 }
示例#5
0
 det_and_inverse_worker (ViewType const & a): V(a), dim(first_dim(a)), ipiv(dim), step(0) { 
  if (first_dim(a)!=second_dim(a)) 
   TRIQS_RUNTIME_ERROR<<"Inverse/Det error : non-square matrix. Dimensions are : ("<<first_dim(a)<<","<<second_dim(a)<<")"<<"\n  ";
  if (!(has_contiguous_data(a))) TRIQS_RUNTIME_ERROR<<"det_and_inverse_worker only takes a contiguous view";
 }
示例#6
0
 template <typename AA> inverse_lazy(AA &&a_) : a(std::forward<AA>(a_)), M{}, computed{false} {
  if (first_dim(a) != second_dim(a))
   TRIQS_RUNTIME_ERROR << "Inverse : matrix is not square but of size " << first_dim(a) << " x " << second_dim(a);
 }