24#ifndef quantlib_sparse_matrix_hpp
25#define quantlib_sparse_matrix_hpp
30#if defined(QL_PATCH_MSVC)
32#pragma warning(disable:4180)
33#pragma warning(disable:4127)
36#if BOOST_VERSION == 106400
37#include <boost/serialization/array_wrapper.hpp>
40#include <boost/numeric/ublas/matrix_sparse.hpp>
42#if defined(QL_PATCH_MSVC)
48 typedef boost::numeric::ublas::compressed_matrix<Real>
SparseMatrix;
53 "vectors and sparse matrices with different sizes ("
54 << x.
size() <<
", " << A.size1() <<
"x" << A.size2() <<
55 ") cannot be multiplied");
59 for (
Size i=0; i < A.filled1()-1; ++i) {
60 const Size begin = A.index1_data()[i];
61 const Size end = A.index1_data()[i+1];
63 for (
Size j=begin; j < end; ++j) {
64 t += A.value_data()[j]*x[A.index2_data()[j]];
1-D array used in linear algebra.
1-D array used in linear algebra.
Size size() const
dimension of the array
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
ext::function< Real(Real)> b
std::size_t Size
size of a container
Array prod(const SparseMatrix &A, const Array &x)
boost::numeric::ublas::compressed_matrix< Real > SparseMatrix
boost::numeric::ublas::matrix_reference< SparseMatrix > SparseMatrixReference
Global definitions and compiler switches.