26 #define VIENNACL_WITH_UBLAS
34 #include <boost/numeric/ublas/triangular.hpp>
35 #include <boost/numeric/ublas/vector.hpp>
36 #include <boost/numeric/ublas/vector_proxy.hpp>
37 #include <boost/numeric/ublas/matrix.hpp>
38 #include <boost/numeric/ublas/matrix_proxy.hpp>
39 #include <boost/numeric/ublas/lu.hpp>
40 #include <boost/numeric/ublas/io.hpp>
59 int main (
int,
const char **)
63 typedef boost::numeric::ublas::matrix<ScalarType> MatrixType;
64 typedef boost::numeric::ublas::vector<ScalarType> VectorType;
71 VectorType ublas_b(4);
77 MatrixType ublas_A(4, 3);
79 ublas_A(0, 0) = 2; ublas_A(0, 1) = -1; ublas_A(0, 2) = 1;
80 ublas_A(1, 0) = 1; ublas_A(1, 1) = -5; ublas_A(1, 2) = 2;
81 ublas_A(2, 0) = -3; ublas_A(2, 1) = 1; ublas_A(2, 2) = -4;
82 ublas_A(3, 0) = 1; ublas_A(3, 1) = -1; ublas_A(3, 2) = 1;
87 VCLVectorType
vcl_b(ublas_b.size());
88 VCLMatrixType vcl_A(ublas_A.size1(), ublas_A.size2());
101 std::cout <<
"--- Boost.uBLAS ---" << std::endl;
120 boost::numeric::ublas::matrix_range<MatrixType> ublas_R(ublas_A, ublas_range, ublas_range);
121 boost::numeric::ublas::vector_range<VectorType> ublas_b2(ublas_b, ublas_range);
124 std::cout <<
"Result: " << ublas_b2 << std::endl;
133 std::cout <<
"--- ViennaCL (hybrid implementation) ---" << std::endl;
150 std::cout <<
"Result: " <<
vcl_b2 << std::endl;
155 std::cout <<
"!!!! TUTORIAL COMPLETED SUCCESSFULLY !!!!" << std::endl;
endcode *compute modified RHS of the minimization vcl_b
void inplace_solve(matrix_base< NumericT > const &A, matrix_base< NumericT > &B, SolverTagT tag)
Direct inplace solver for triangular systems with multiple right hand sides, i.e. A \ B (MATLAB notat...
void inplace_solve(const matrix_base< NumericT > &A, matrix_base< NumericT > &B, SolverTagT)
Direct inplace solver for triangular systems with multiple right hand sides, i.e. A \ B (MATLAB notat...
std::vector< T > inplace_qr(viennacl::matrix< T, F, ALIGNMENT > &A, vcl_size_t block_size=16)
Overload of inplace-QR factorization of a ViennaCL matrix A.
Implementation of the dense matrix class.
endcode *Final viennacl::matrix_range< VCLMatrixType > vcl_R(vcl_A, vcl_range, vcl_range)
std::cout<< "--- ViennaCL (hybrid implementation) ---"<< std::endl;std::vector< ScalarType > hybrid_betas
Class for representing non-strided subvectors of a bigger vector x.
A tag class representing an upper triangular matrix.
Provides a QR factorization using a block-based approach.
viennacl::vector_range< VCLVectorType > vcl_b2(vcl_b, vcl_range)
Implementations of LU factorization for row-major and column-major dense matrices.
Implementations of dense direct solvers are found here.
Proxy classes for matrices.
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
void copy(std::vector< NumericT > &cpu_vec, circulant_matrix< NumericT, AlignmentV > &gpu_mat)
Copies a circulant matrix from the std::vector to the OpenCL device (either GPU or multi-core CPU) ...
A range class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
Class for representing non-strided submatrices of a bigger matrix A.
void inplace_qr_apply_trans_Q(MatrixType const &A, VectorType1 const &betas, VectorType2 &b)
Computes Q^T b, where Q is an implicit orthogonal matrix defined via its Householder reflectors store...