#ifndef _sparse_inner_prod_h_ #define _sparse_inner_prod_h_ #include #include template BOOST_UBLAS_INLINE T sparse_vector_inner_prod(const ublas::compressed_vector &lhs, const ublas::compressed_vector &rhs) { typedef T result_type; typedef ublas::compressed_vector vector_type; typedef IA index_array_type; typedef TA value_array_type; const index_array_type &index1 = lhs.index_data(); const value_array_type &value1 = lhs.value_data(); size_t nnz1(lhs.nnz()); const index_array_type &index2 = rhs.index_data(); const value_array_type &value2 = rhs.value_data(); size_t nnz2(rhs.nnz()); result_type retval(0); if((nnz1 != 0) && (nnz2 != 0)) { // // Multiply the existing elements in the first vector by any common elements // in the second vector. // size_t last_pos(0); for(size_t i(0); i BOOST_UBLAS_INLINE void gvov_ata_prod(const ublas::generalized_vector_of_vector &A, ublas::matrix_expression &result) { typedef T value_type; value_type val; for(size_t i(0); i 1.0e-07) { (result())(i, j) = val; (result())(j, i) = val; } } } } #endif