# [Trilinos-Users] [EXTERNAL] Re: Tpetra and boost::interval

Sensei senseiwa at gmail.com
Thu Jul 23 09:39:49 EDT 2015

```On 7/22/15 7:58pm, Phipps, Eric T wrote:
> Well, you need to write down mathematically what it means to solve the
> problem with an interval scalar type.  For example, what does it mean for
> an interval linear system solved by an iterative solver method to have
> converged.  That will tell you what the magnitude type should be (since
> tolerances are magnitudes).

So, to be clear, am I right in identifying these functions as returning
a double?

eps, sfmin, base, prec, rnd, emin, rmin, rmax, rmax,

Now, if magnitude is what I think it is, it's a double and it should
return the size of the interval, so that upon convergence, the interval
is almost empty.

> Related to this is what comparison operators mean, e.g., a < b when a
> and or b are intervals.

Ok, this is solved (intervals are comparable).

> You can see examples of implementing scalar traits in the Stokhos package,
> which defines several scalar types for use within uncertainty
> quantification, e.g.,
>
> pp
>
>
> Note, for Tpetra to work out-of-the-box with any scalar type, it needs to
> be a POD type.  It can be made to work with non-POD scalar types (there
> are examples of this in Stokhos), but it requires further specialization
> that requires expert knowledge of the internals of Tpetra and Kokkos.

I've seen the Sacado_MP_VectorTraits header, and I've written the
ScalarTraits specialization.

I don't know much (almost nothing) about the inner workings of Tpetra
and Kokkos, but I'd really like to make this work.

My project now has this error:

/usr/local/include/trilinos/Tpetra_MultiVector_def.hpp:2520:25: Call to
function 'operator<<' that is neither visible in the template definition
nor found by argument-dependent lookup

/usr/local/include/trilinos/Teuchos_SerializationTraits.hpp:67:43: No
member named 'this_type_is_missing_a_specialization' in
'boost::numeric::interval<double,
boost::numeric::interval_lib::policies<boost::numeric::interval_lib::rounded_math<double>,
boost::numeric::interval_lib::checking_strict<double> > >'

/usr/local/include/trilinos/Tpetra_Vector_def.hpp:259:23: Call to
function 'operator<<' that is neither visible in the template definition
nor found by argument-dependent lookup

I believe there is some other traits class to specialize, but I don't
know where to find that for sure. I'm starting with a specialization as
follows:

template <typename Ordinal>
class SerializationTraits<Ordinal, scalar> {
public:
...

But I'm not sure about some functions.

What do convertToCharPtr, convertToCharPtr, convertFromCharPtr, and
convertFromCharPtr mean? They're parametrized with one single array with
no additional info about the size. So I'm not sure what they're supposed
to do.

On the other hand, serialize and deserialize will convert to/from an
array of chars. For this, I suppose I can simply dump two doubles
to/from the array. On the same track are fromCountToIndirectBytes and
fromIndirectBytesToCount, they should be easy.

Am I right in this?

Thanks!

```