1 #ifndef VIENNACL_LINALG_DETAIL_SPAI_SMALL_MATRIX_HPP
2 #define VIENNACL_LINALG_DETAIL_SPAI_SMALL_MATRIX_HPP
35 #include "boost/numeric/ublas/vector.hpp"
36 #include "boost/numeric/ublas/matrix.hpp"
37 #include "boost/numeric/ublas/matrix_proxy.hpp"
38 #include "boost/numeric/ublas/vector_proxy.hpp"
39 #include "boost/numeric/ublas/storage.hpp"
40 #include "boost/numeric/ublas/io.hpp"
41 #include "boost/numeric/ublas/lu.hpp"
42 #include "boost/numeric/ublas/triangular.hpp"
43 #include "boost/numeric/ublas/matrix_expression.hpp"
44 #include "boost/numeric/ublas/detail/matrix_assign.hpp"
60 template <
typename MatrixType>
63 mat.resize(new_size, new_size,
false);
66 double val = 1.0 / std::sqrt(2.0);
71 for (
vcl_size_t i=off_diagonal_distance; i<new_size; ++i)
73 mat(i-off_diagonal_distance, i) = val; mat(i, i-off_diagonal_distance) = -val;
80 template <
typename MatrixType>
81 double determinant(boost::numeric::ublas::matrix_expression<MatrixType>
const& mat_r)
85 MatrixType mLu(mat_r() );
86 boost::numeric::ublas::permutation_matrix<vcl_size_t> pivots(mat_r().
size1() );
88 int is_singular =
static_cast<int>(
lu_factorize(mLu, pivots));
std::size_t vcl_size_t
Definition: forwards.h:58
void make_rotation_matrix(MatrixType &mat, vcl_size_t new_size, vcl_size_t off_diagonal_distance=4)
Definition: small_matrix.hpp:61
vcl_size_t size1(MatrixType const &mat)
Generic routine for obtaining the number of rows of a matrix (ViennaCL, uBLAS, etc.)
Definition: size.hpp:216
void lu_factorize(matrix< SCALARTYPE, viennacl::row_major > &A)
LU factorization of a row-major dense matrix.
Definition: lu.hpp:42
double determinant(boost::numeric::ublas::matrix_expression< MatrixType > const &mat_r)
Definition: small_matrix.hpp:81