ViennaCL - The Vienna Computing Library
1.5.0
|
Implementations of dense matrix related operations including matrix-vector products. More...
#include "viennacl/forwards.h"
#include "viennacl/scalar.hpp"
#include "viennacl/vector.hpp"
#include "viennacl/vector_proxy.hpp"
#include "viennacl/tools/tools.hpp"
#include "viennacl/meta/enable_if.hpp"
#include "viennacl/meta/predicate.hpp"
#include "viennacl/meta/result_of.hpp"
#include "viennacl/traits/size.hpp"
#include "viennacl/traits/start.hpp"
#include "viennacl/traits/handle.hpp"
#include "viennacl/traits/stride.hpp"
#include "viennacl/linalg/host_based/matrix_operations.hpp"
Go to the source code of this file.
Namespaces | |
namespace | viennacl |
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them. | |
namespace | viennacl::linalg |
Provides all linear algebra operations which are not covered by operator overloads. | |
Defines | |
#define | VIENNACL_MAKE_BINARY_OP(OPNAME) |
#define | VIENNACL_MAKE_UNARY_ELEMENT_OP(funcname) |
Functions | |
template<typename NumericT , typename F , typename ScalarType1 > | |
void | am (matrix_base< NumericT, F > &mat1, matrix_base< NumericT, F > const &mat2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha) |
template<typename NumericT , typename F , typename ScalarType1 , typename ScalarType2 > | |
void | ambm (matrix_base< NumericT, F > &mat1, matrix_base< NumericT, F > const &mat2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, matrix_base< NumericT, F > const &mat3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta) |
template<typename NumericT , typename F , typename ScalarType1 , typename ScalarType2 > | |
void | ambm_m (matrix_base< NumericT, F > &mat1, matrix_base< NumericT, F > const &mat2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, matrix_base< NumericT, F > const &mat3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta) |
template<typename NumericT , typename F > | |
void | matrix_assign (matrix_base< NumericT, F > &mat, NumericT s, bool clear=false) |
template<typename NumericT , typename F > | |
void | matrix_diagonal_assign (matrix_base< NumericT, F > &mat, NumericT s) |
template<typename NumericT , typename F > | |
void | matrix_diag_from_vector (const vector_base< NumericT > &v, int k, matrix_base< NumericT, F > &A) |
Dispatcher interface for A = diag(v, k) | |
template<typename NumericT , typename F > | |
void | matrix_diag_to_vector (const matrix_base< NumericT, F > &A, int k, vector_base< NumericT > &v) |
Dispatcher interface for v = diag(A, k) | |
template<typename NumericT , typename F > | |
void | matrix_row (const matrix_base< NumericT, F > &A, unsigned int i, vector_base< NumericT > &v) |
template<typename NumericT , typename F > | |
void | matrix_column (const matrix_base< NumericT, F > &A, unsigned int j, vector_base< NumericT > &v) |
template<typename T , typename F > | |
void | norm_frobenius_impl (matrix_base< T, F > const &A, scalar< T > &result) |
Computes the Frobenius norm of a matrix - dispatcher interface. | |
template<typename T , typename F > | |
void | norm_frobenius_cpu (matrix_base< T, F > const &A, T &result) |
Computes the Frobenius norm of a vector with final reduction on the CPU. | |
template<typename NumericT , typename F > | |
void | prod_impl (const matrix_base< NumericT, F > &mat, const vector_base< NumericT > &vec, vector_base< NumericT > &result) |
Carries out matrix-vector multiplication. | |
template<typename NumericT , typename F > | |
void | prod_impl (const matrix_expression< const matrix_base< NumericT, F >, const matrix_base< NumericT, F >, op_trans > &mat_trans, const vector_base< NumericT > &vec, vector_base< NumericT > &result) |
Carries out matrix-vector multiplication with a transposed matrix. | |
template<typename NumericT , typename F1 , typename F2 , typename F3 , typename ScalarType > | |
void | prod_impl (const matrix_base< NumericT, F1 > &A, const matrix_base< NumericT, F2 > &B, matrix_base< NumericT, F3 > &C, ScalarType alpha, ScalarType beta) |
Carries out matrix-matrix multiplication. | |
template<typename NumericT , typename F1 , typename F2 , typename F3 , typename ScalarType > | |
void | prod_impl (const viennacl::matrix_expression< const matrix_base< NumericT, F1 >, const matrix_base< NumericT, F1 >, op_trans > &A, const matrix_base< NumericT, F2 > &B, matrix_base< NumericT, F3 > &C, ScalarType alpha, ScalarType beta) |
Carries out matrix-matrix multiplication. | |
template<typename NumericT , typename F1 , typename F2 , typename F3 , typename ScalarType > | |
void | prod_impl (const matrix_base< NumericT, F1 > &A, const viennacl::matrix_expression< const matrix_base< NumericT, F2 >, const matrix_base< NumericT, F2 >, op_trans > &B, matrix_base< NumericT, F3 > &C, ScalarType alpha, ScalarType beta) |
Carries out matrix-matrix multiplication. | |
template<typename NumericT , typename F1 , typename F2 , typename F3 , typename ScalarType > | |
void | prod_impl (const viennacl::matrix_expression< const matrix_base< NumericT, F1 >, const matrix_base< NumericT, F1 >, op_trans > &A, const viennacl::matrix_expression< const matrix_base< NumericT, F2 >, const matrix_base< NumericT, F2 >, op_trans > &B, matrix_base< NumericT, F3 > &C, ScalarType alpha, ScalarType beta) |
Carries out matrix-matrix multiplication. | |
template<typename T , typename F , typename OP > | |
void | element_op (matrix_base< T, F > &A, matrix_expression< const matrix_base< T, F >, const matrix_base< T, F >, 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(). | |
template<typename NumericT > | |
viennacl::matrix_expression < const vector_base< NumericT > , const vector_base< NumericT > , op_prod > | 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. | |
template<typename NumericT , typename F , typename S1 > | |
void | scaled_rank_1_update (matrix_base< NumericT, F > &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. | |
template<typename NumericT , typename F > | |
vector< NumericT > | operator+= (vector_base< NumericT > &v1, const viennacl::vector_expression< const matrix_base< NumericT, F >, const vector_base< NumericT >, viennacl::op_prod > &proxy) |
Implementation of the operation v1 += A * v2, where A is a matrix. | |
template<typename NumericT , typename F > | |
vector< NumericT > | operator-= (vector_base< NumericT > &v1, const viennacl::vector_expression< const matrix_base< NumericT, F >, const vector_base< NumericT >, viennacl::op_prod > &proxy) |
Implementation of the operation v1 -= A * v2, where A is a matrix. | |
template<typename NumericT , typename F > | |
viennacl::vector< NumericT > | operator+ (const vector_base< NumericT > &v1, const vector_expression< const matrix_base< NumericT, F >, const vector_base< NumericT >, op_prod > &proxy) |
Implementation of the operation 'result = v1 + A * v2', where A is a matrix. | |
template<typename NumericT , typename F > | |
viennacl::vector< NumericT > | operator- (const vector_base< NumericT > &v1, const vector_expression< const matrix_base< NumericT, F >, const vector_base< NumericT >, op_prod > &proxy) |
Implementation of the operation 'result = v1 - A * v2', where A is a matrix. | |
template<typename NumericT , typename F > | |
vector< NumericT > | operator+= (vector_base< NumericT > &v1, const vector_expression< const matrix_expression< const matrix_base< NumericT, F >, const matrix_base< NumericT, F >, op_trans >, const vector_base< NumericT >, op_prod > &proxy) |
Implementation of the operation v1 += A * v2, where A is a matrix. | |
template<typename NumericT , typename F > | |
vector< NumericT > | operator-= (vector_base< NumericT > &v1, const vector_expression< const matrix_expression< const matrix_base< NumericT, F >, const matrix_base< NumericT, F >, op_trans >, const vector_base< NumericT >, op_prod > &proxy) |
Implementation of the operation v1 -= A * v2, where A is a matrix. | |
template<typename NumericT , typename F > | |
vector< NumericT > | operator+ (const vector_base< NumericT > &v1, const vector_expression< const matrix_expression< const matrix_base< NumericT, F >, const matrix_base< NumericT, F >, op_trans >, const vector_base< NumericT >, op_prod > &proxy) |
Implementation of the operation 'result = v1 + A * v2', where A is a matrix. | |
template<typename NumericT , typename F > | |
vector< NumericT > | operator- (const vector_base< NumericT > &v1, const vector_expression< const matrix_expression< const matrix_base< NumericT, F >, const matrix_base< NumericT, F >, op_trans >, const vector_base< NumericT >, op_prod > &proxy) |
Implementation of the operation 'result = v1 - A * v2', where A is a matrix. |
Implementations of dense matrix related operations including matrix-vector products.
#define VIENNACL_MAKE_BINARY_OP | ( | OPNAME | ) |
#define VIENNACL_MAKE_UNARY_ELEMENT_OP | ( | funcname | ) |
template <typename T, typename F> \ viennacl::matrix_expression<const matrix_base<T, F>, const matrix_base<T, F>, op_element_unary<op_##funcname> > \ element_##funcname(matrix_base<T, F> const & A) \ { \ return viennacl::matrix_expression<const matrix_base<T, F>, const matrix_base<T, F>, 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) \ { \ return viennacl::matrix_expression<const matrix_expression<const LHS, const RHS, OP>, \ const matrix_expression<const LHS, const RHS, OP>, \ op_element_unary<op_##funcname> >(proxy, proxy); \ } \