35 for(i=0, j=1; j<n_elem; i+=2, j+=2)
61 if( n_elem <= (128/
sizeof(eT)) )
67 #if defined(ARMA_USE_ATLAS) 71 return atlas::cblas_dot(n_elem, A, B);
73 #elif defined(ARMA_USE_BLAS) 97 #if defined(ARMA_USE_ATLAS) 101 return atlas::cx_cblas_dot(n_elem, A, B);
103 #elif defined(ARMA_USE_BLAS) 118 template<
typename eT>
132 template<
typename eT>
143 for(
uword i=0; i<n_elem; ++i)
145 val += A[i] * B[i] * C[i];
153 template<
typename T1,
typename T2>
156 typename T1::elem_type
173 template<
typename T1,
typename T2>
176 typename T1::elem_type
181 typedef typename T1::elem_type eT;
196 template<
typename T1,
typename T2>
199 typename T1::elem_type
204 typedef typename T1::elem_type eT;
213 if(prefer_at_accessor ==
false)
215 arma_debug_check( (A.get_n_elem() != B.get_n_elem()),
"dot(): objects must have the same number of elements" );
217 const uword N = A.get_n_elem();
218 ea_type1 PA = A.get_ea();
219 ea_type2 PB = B.get_ea();
226 for(i=0, j=1; j<N; i+=2, j+=2)
228 val1 += PA[i] * PB[i];
229 val2 += PA[j] * PB[j];
234 val1 += PA[i] * PB[i];
252 template<
typename T1,
typename T2>
255 typename T1::elem_type
260 typedef typename T1::elem_type eT;
266 if(prefer_at_accessor ==
false)
271 arma_debug_check( (A.get_n_elem() != B.get_n_elem()),
"norm_dot(): objects must have the same number of elements" );
273 const uword N = A.get_n_elem();
274 ea_type1 PA = A.get_ea();
275 ea_type2 PB = B.get_ea();
281 for(
uword i=0; i<N; ++i)
283 const eT tmpA = PA[i];
284 const eT tmpB = PB[i];
291 return acc3 / (
std::sqrt(acc1 * acc2) );
301 template<
typename T1,
typename T2>
304 typename T1::elem_type
309 typedef typename T1::elem_type eT;
320 const uword N = A.n_elem;
322 const eT* A_mem = A.memptr();
323 const eT* B_mem = B.
memptr();
329 for(
uword i=0; i<N; ++i)
331 const eT tmpA = A_mem[i];
332 const eT tmpB = B_mem[i];
339 return acc3 / (
std::sqrt(acc1 * acc2) );
349 template<
typename T1,
typename T2>
352 typename T1::elem_type
357 typedef typename T1::elem_type eT;
364 arma_debug_check( (A.get_n_elem() != B.get_n_elem()),
"cdot(): objects must have the same number of elements" );
366 const uword N = A.get_n_elem();
367 ea_type1 PA = A.get_ea();
368 ea_type2 PB = B.get_ea();
374 for(i=0, j=1; j<N; i+=2, j+=2)
static arma_hot T1::elem_type apply(const Base< typename T1::elem_type, T1 > &X, const Base< typename T1::elem_type, T2 > &Y)
arma_inline arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the matrix
static arma_hot T1::elem_type apply_proxy(const Base< typename T1::elem_type, T1 > &X, const Base< typename T1::elem_type, T2 > &Y)
arma_inline arma_warn_unused T1::elem_type dot(const Base< typename T1::elem_type, T1 > &A, const Base< typename T1::elem_type, T2 > &B)
arma_hot static arma_inline T1::elem_type apply(const Base< typename T1::elem_type, T1 > &X, const Base< typename T1::elem_type, T2 > &Y)
arma_inline const derived & get_ref() const
arma_inline const eOp< T1, eop_sqrt > sqrt(const Base< typename T1::elem_type, T1 > &A)
arma_hot static arma_pure arma_float_only< eT >::result direct_dot(const uword n_elem, const eT *const A, const eT *const B)
arma_inline const T1 & conj(const Base< typename T1::pod_type, T1 > &A)
const uword n_elem
number of elements in the matrix (read-only)
#define arma_extra_debug_print
static arma_hot T1::elem_type apply_unwrap(const Base< typename T1::elem_type, T1 > &X, const Base< typename T1::elem_type, T2 > &Y)
#define arma_extra_debug_sigprint
arma_hot static arma_inline T1::elem_type apply(const Base< typename T1::elem_type, T1 > &X, const Base< typename T1::elem_type, T2 > &Y)
arma_aligned const eT *const mem
pointer to the memory used by the matrix (memory is read-only)
arma_hot static arma_pure eT direct_dot_arma(const uword n_elem, const eT *const A, const eT *const B)
static arma_hot T1::elem_type apply_unwrap(const Base< typename T1::elem_type, T1 > &X, const Base< typename T1::elem_type, T2 > &Y)