ViennaCL - The Vienna Computing Library  1.7.0
Free open-source GPU-accelerated linear algebra and solver library.
matrix_operations.hpp File Reference

Implementations of dense matrix related operations including matrix-vector products. More...

Go to the source code of this file.

Namespaces

 viennacl
 Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
 
 viennacl::linalg
 Provides all linear algebra operations which are not covered by operator overloads.
 

Macros

#define VIENNACL_MAKE_BINARY_OP(OPNAME)
 
#define VIENNACL_MAKE_UNARY_ELEMENT_OP(funcname)
 

Functions

template<typename DestNumericT , typename SrcNumericT >
void viennacl::linalg::convert (matrix_base< DestNumericT > &dest, matrix_base< SrcNumericT > const &src)
 
template<typename NumericT , typename SizeT , typename DistanceT >
void viennacl::linalg::trans (const matrix_expression< const matrix_base< NumericT, SizeT, DistanceT >, const matrix_base< NumericT, SizeT, DistanceT >, op_trans > &proxy, matrix_base< NumericT > &temp_trans)
 
template<typename NumericT , typename ScalarType1 >
void viennacl::linalg::am (matrix_base< NumericT > &mat1, matrix_base< NumericT > const &mat2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha)
 
template<typename NumericT , typename ScalarType1 , typename ScalarType2 >
void viennacl::linalg::ambm (matrix_base< NumericT > &mat1, matrix_base< NumericT > const &mat2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, matrix_base< NumericT > const &mat3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
 
template<typename NumericT , typename ScalarType1 , typename ScalarType2 >
void viennacl::linalg::ambm_m (matrix_base< NumericT > &mat1, matrix_base< NumericT > const &mat2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, matrix_base< NumericT > const &mat3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
 
template<typename NumericT >
void viennacl::linalg::matrix_assign (matrix_base< NumericT > &mat, NumericT s, bool clear=false)
 
template<typename NumericT >
void viennacl::linalg::matrix_diagonal_assign (matrix_base< NumericT > &mat, NumericT s)
 
template<typename NumericT >
void viennacl::linalg::matrix_diag_from_vector (const vector_base< NumericT > &v, int k, matrix_base< NumericT > &A)
 Dispatcher interface for A = diag(v, k) More...
 
template<typename NumericT >
void viennacl::linalg::matrix_diag_to_vector (const matrix_base< NumericT > &A, int k, vector_base< NumericT > &v)
 Dispatcher interface for v = diag(A, k) More...
 
template<typename NumericT >
void viennacl::linalg::matrix_row (const matrix_base< NumericT > &A, unsigned int i, vector_base< NumericT > &v)
 
template<typename NumericT >
void viennacl::linalg::matrix_column (const matrix_base< NumericT > &A, unsigned int j, vector_base< NumericT > &v)
 
template<typename T >
void viennacl::linalg::norm_frobenius_impl (matrix_base< T > const &A, scalar< T > &result)
 Computes the Frobenius norm of a matrix - dispatcher interface. More...
 
template<typename T >
void viennacl::linalg::norm_frobenius_cpu (matrix_base< T > const &A, T &result)
 Computes the Frobenius norm of a vector with final reduction on the CPU. More...
 
template<typename NumericT >
void viennacl::linalg::prod_impl (const matrix_base< NumericT > &mat, const vector_base< NumericT > &vec, vector_base< NumericT > &result)
 Carries out matrix-vector multiplication. More...
 
template<typename NumericT >
void viennacl::linalg::prod_impl (const matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_trans > &mat_trans, const vector_base< NumericT > &vec, vector_base< NumericT > &result)
 Carries out matrix-vector multiplication with a transposed matrix. More...
 
template<typename NumericT , typename ScalarType >
void viennacl::linalg::prod_impl (const matrix_base< NumericT > &A, const matrix_base< NumericT > &B, matrix_base< NumericT > &C, ScalarType alpha, ScalarType beta)
 Carries out matrix-matrix multiplication. More...
 
template<typename NumericT , typename ScalarType >
void viennacl::linalg::prod_impl (const viennacl::matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_trans > &A, const matrix_base< NumericT > &B, matrix_base< NumericT > &C, ScalarType alpha, ScalarType beta)
 Carries out matrix-matrix multiplication. More...
 
template<typename NumericT , typename ScalarType >
void viennacl::linalg::prod_impl (const matrix_base< NumericT > &A, const viennacl::matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_trans > &B, matrix_base< NumericT > &C, ScalarType alpha, ScalarType beta)
 Carries out matrix-matrix multiplication. More...
 
template<typename NumericT , typename ScalarType >
void viennacl::linalg::prod_impl (const viennacl::matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_trans > &A, const viennacl::matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_trans > &B, matrix_base< NumericT > &C, ScalarType alpha, ScalarType beta)
 Carries out matrix-matrix multiplication. More...
 
template<typename NumericT >
void viennacl::linalg::row_sum_impl (const matrix_base< NumericT > &A, vector_base< NumericT > &result)
 
template<typename NumericT >
void viennacl::linalg::column_sum_impl (const matrix_base< NumericT > &A, vector_base< NumericT > &result)
 
template<typename T , typename OP >
void viennacl::linalg::element_op (matrix_base< T > &A, matrix_expression< const matrix_base< T >, const matrix_base< T >, OP > const &proxy)
 Implementation of the element-wise operation A = B .* C and A = B ./ C for matrices (using MATLAB syntax). Don't use this function directly, use element_prod() and element_div(). More...
 
template<typename NumericT >
viennacl::matrix_expression< const vector_base< NumericT >, const vector_base< NumericT >, op_prod > viennacl::linalg::outer_prod (const vector_base< NumericT > &vec1, const vector_base< NumericT > &vec2)
 Returns a proxy class for the operation mat += vec1 * vec2^T, i.e. a rank 1 update. More...
 
template<typename NumericT , typename S1 >
void viennacl::linalg::scaled_rank_1_update (matrix_base< NumericT > &mat1, S1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, const vector_base< NumericT > &vec1, const vector_base< NumericT > &vec2)
 The implementation of the operation mat += alpha * vec1 * vec2^T, i.e. a scaled rank 1 update. More...
 
template<typename NumericT , typename VectorType >
void viennacl::linalg::bidiag_pack (matrix_base< NumericT > &A, VectorType &dh, VectorType &sh)
 This function stores the diagonal and the superdiagonal of a matrix in two vectors. More...
 
template<typename SCALARTYPE >
void viennacl::linalg::copy_vec (matrix_base< SCALARTYPE > &A, vector_base< SCALARTYPE > &V, vcl_size_t row_start, vcl_size_t col_start, bool copy_col)
 This function copies a row or a column from a matrix to a vector. More...
 
template<typename NumericT >
void viennacl::linalg::house_update_A_left (matrix_base< NumericT > &A, vector_base< NumericT > &D, vcl_size_t start)
 This function applies a householder transformation to a matrix. A <- P * A with a householder reflection P. More...
 
template<typename NumericT >
void viennacl::linalg::house_update_A_right (matrix_base< NumericT > &A, vector_base< NumericT > &D)
 This function applies a householder transformation to a matrix: A <- A * P with a householder reflection P. More...
 
template<typename NumericT >
void viennacl::linalg::house_update_QL (matrix_base< NumericT > &Q, vector_base< NumericT > &D, vcl_size_t A_size1)
 This function updates the matrix Q, which is needed for the computation of the eigenvectors. More...
 
template<typename NumericT >
void viennacl::linalg::givens_next (matrix_base< NumericT > &Q, vector_base< NumericT > &tmp1, vector_base< NumericT > &tmp2, int l, int m)
 This function updates the matrix Q. It is part of the tql2 algorithm. More...
 
template<typename NumericT >
vector< NumericTviennacl::operator+= (vector_base< NumericT > &v1, const viennacl::vector_expression< const matrix_base< NumericT >, const vector_base< NumericT >, viennacl::op_prod > &proxy)
 Implementation of the operation v1 += A * v2, where A is a matrix. More...
 
template<typename NumericT >
vector< NumericTviennacl::operator-= (vector_base< NumericT > &v1, const viennacl::vector_expression< const matrix_base< NumericT >, const vector_base< NumericT >, viennacl::op_prod > &proxy)
 Implementation of the operation v1 -= A * v2, where A is a matrix. More...
 
template<typename NumericT >
viennacl::vector< NumericTviennacl::operator+ (const vector_base< NumericT > &v1, const vector_expression< const matrix_base< NumericT >, const vector_base< NumericT >, op_prod > &proxy)
 Implementation of the operation 'result = v1 + A * v2', where A is a matrix. More...
 
template<typename NumericT >
viennacl::vector< NumericTviennacl::operator- (const vector_base< NumericT > &v1, const vector_expression< const matrix_base< NumericT >, const vector_base< NumericT >, op_prod > &proxy)
 Implementation of the operation 'result = v1 - A * v2', where A is a matrix. More...
 
template<typename NumericT >
vector< NumericTviennacl::operator+= (vector_base< NumericT > &v1, const vector_expression< const matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_trans >, const vector_base< NumericT >, op_prod > &proxy)
 Implementation of the operation v1 += A * v2, where A is a matrix. More...
 
template<typename NumericT >
vector< NumericTviennacl::operator-= (vector_base< NumericT > &v1, const vector_expression< const matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_trans >, const vector_base< NumericT >, op_prod > &proxy)
 Implementation of the operation v1 -= A * v2, where A is a matrix. More...
 
template<typename NumericT >
vector< NumericTviennacl::operator+ (const vector_base< NumericT > &v1, const vector_expression< const matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_trans >, const vector_base< NumericT >, op_prod > &proxy)
 Implementation of the operation 'result = v1 + A * v2', where A is a matrix. More...
 
template<typename NumericT >
vector< NumericTviennacl::operator- (const vector_base< NumericT > &v1, const vector_expression< const matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_trans >, const vector_base< NumericT >, op_prod > &proxy)
 Implementation of the operation 'result = v1 - A * v2', where A is a matrix. More...
 

Detailed Description

Implementations of dense matrix related operations including matrix-vector products.

Definition in file matrix_operations.hpp.

Macro Definition Documentation

#define VIENNACL_MAKE_BINARY_OP (   OPNAME)

Definition at line 731 of file matrix_operations.hpp.

#define VIENNACL_MAKE_UNARY_ELEMENT_OP (   funcname)
Value:
template<typename T> \
viennacl::matrix_expression<const matrix_base<T>, const matrix_base<T>, op_element_unary<op_##funcname> > \
element_##funcname(matrix_base<T> const & A) \
{ \
return viennacl::matrix_expression<const matrix_base<T>, const matrix_base<T>, op_element_unary<op_##funcname> >(A, A); \
} \
template<typename LHS, typename RHS, typename OP> \
viennacl::matrix_expression<const matrix_expression<const LHS, const RHS, OP>, \
const matrix_expression<const LHS, const RHS, OP>, \
op_element_unary<op_##funcname> > \
element_##funcname(matrix_expression<const LHS, const RHS, OP> const & proxy) \
{ \
const matrix_expression<const LHS, const RHS, OP>, \
op_element_unary<op_##funcname> >(proxy, proxy); \
} \
Expression template class for representing a tree of expressions which ultimately result in a matrix...
Definition: forwards.h:341

Definition at line 789 of file matrix_operations.hpp.