34 #ifndef __MATRIX_OPS_HPP__
35 #define __MATRIX_OPS_HPP__
63 template<
class V,
class M,
class __memory_layout,
class __index_type>
65 tensor<V,M,__memory_layout> & matrix,
66 __index_type start_rows,
67 __index_type num_rows ,
68 __index_type start_cols,
69 __index_type num_cols);
95 template<
class V,
class M,
class L>
96 void prod( tensor<V,M,L>& C,
97 const tensor<V,M,L>& A,
98 const tensor<V,M,L>& B,
99 char transA=
'n',
char transB=
'n',
const float& factAB=1.f,
const float& factC=0.f);
104 template<
class V,
class M,
class L>
105 void prod(
tensor<V,M,L>& C,
const tensor<V,M,L>& A,
const tensor<V,M,
typename other_memory_layout<L>::type >& B,
const float& factAB=1.f,
const float& factC=0.f){
110 template<
class V,
class M,
class L>
114 const float& factAB=1.f,
const float& factC=0.f){
118 template<
class V,
class M,
class L>
119 void prod(tensor<V,M,L>& C,
const dia_matrix<V,M>& A,
const tensor<V,M,L>& B,
char transA=
'n',
char transB=
'n',
const float& factAB=1.f,
const float& factC=0.f);
128 template<
class V,
class M,
class L>
129 void transpose(tensor<V,M, L>& dst,
const tensor<V,M, L>& src);
141 template<
class V,
class T,
class M>
145 template<
class V,
class T,
class M>
147 return std::auto_ptr<cuv::tensor<V,T,typename other_memory_layout<M>::type > >(
transposed_view_p(src));
151 template<
class V,
class T,
class M>
155 template<
class V,
class T,
class M>
157 return std::auto_ptr<const cuv::tensor<V,T,typename other_memory_layout<M>::type > >(
transposed_view_p(src));
211 template<
class V,
class __value_type2,
class M,
class L>
212 void reduce_to_col(tensor<V, M>& dst,
const tensor<__value_type2, M, L>& src,
reduce_functor rf=RF_ADD,
const __value_type2& factNew=1.f,
const __value_type2& factOld=0.f);
227 template<
class V,
class __value_type2,
class M,
class L>
228 void reduce_to_row(tensor<V, M>& dst,
const tensor<__value_type2, M, L>& src,
reduce_functor rf=RF_ADD,
const __value_type2& factNew=1.f,
const __value_type2& factOld=0.f);
238 template<
class V,
class M,
class L>
241 int tensor_length = 0;
243 tensor_length = src.
shape()[1];
244 }
else if (axis==1) {
245 tensor_length = src.
shape()[0];
251 }
else if (axis==1) {
277 template<
class V,
class M>
278 void spmv(tensor<V, M>& dst,
const dia_matrix<V, M>& A,
const tensor<V, M>& v,
char transA=
'n',
const float& factAv=1.f,
const float& factC=0.f);
294 template<
class V,
class V2,
class M,
class L>
295 void matrix_op_vec(tensor<V,M,L>& Dst,
const tensor<V,M,L>& Src,
const tensor<V2,M>& v,
int axis,
BinaryFunctor bf,
float factNew=1.f,
float factOld=0.f,
int n_params=0,
float param0=0.f,
float param1=0.f);
306 template<
class V,
class M,
class L>
317 template<
class V,
class M,
class L>
328 template<
class V,
class M,
class L>
339 template<
class V,
class M,
class L>
350 template<
class V,
class M,
class L>
361 template<
class V,
class M,
class L>