Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4410: Sparse/Packed matrix assignment needs type conversion
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-07-08 15:02:39
#4410: Sparse/Packed matrix assignment needs type conversion
--------------------------------------------------------+-------------------
Reporter: Marco Guazzone <marco.guazzone@â¦> | Owner: guwi17
Type: Patches | Status: new
Milestone: To Be Determined | Component: uBLAS
Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:
--------------------------------------------------------+-------------------
Comment (by Marco Guazzone <marco.guazzone@â¦>):
I propose a possible patch (see attachment: ''matrix_assign-
packed_sparse_storage-type_conversion.patch'').
Essentially,
1. Expressions of the first type might be changed by casting an
`E::value_type` to a `M::value_type`, like in this way:
{{{#!c++
if (static_cast<value_type>(v) != value_type/*zero*/())
}}}
Obviously, this does not work when `E::value_type` and `M::value_type` are
not ''castable'' (e.g., `std::complex` and `double`, respectively).
2. Expressions of the second type might be changed in 2 ways:
* Option A (the one used in the proposed patch)
{{{#!c++
typedef typename matrix_traits<E>::value_type expr_value_type;
functor_type::apply(*it, expr_value_type/*zero*/()); // NOTE: use of
E::value_type in place of M::value_type
}}}
* Option B
{{{#!c++
typedef F<typename M::..., value_type> functor_type; // NOTE: use
M::value_type instead of E::value_type
functor_type::apply(*it, value_type/*zero*/()); // unchanged
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4410#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC