[Trilinos-Users] tuple-indexable matrices?

Nico Schlömer nico.schloemer at ua.ac.be
Wed Feb 3 16:54:42 MST 2010


Hi Ross,

sorry for being so sloppy with the question.
The thing is that I got a bit lost amongst the different array-like types
in Trilinos (Teuchos::Array, Teuchos::SerialDenseMatrix,
Teuchos::ArrayView,...) and what the can and cannot do for me.
Are there any directives saying something like "In case you use an array
as this-and-this way, you want to use Teuchos::xyz"?

One particular situation I run into regularly is that I have
Teuchos::Tuple<int,2> objects which I would like to use as indices in an
array, say, and Teuchos::SerialDenseMatrix. I'd now write something like

==================================== *snip*
====================================
Teuchos::Tuple<int,2> i;
[...]
Teuchos::SerialDenseMatrix<double> A( 100, 100 );

double elementAtI = A( i[0], i[1] );
==================================== *snap*
====================================

It seems a bit silly to ask, but I was asking myself whether there is a
matrix type that could be used like

==================================== *snip*
===================================
double elementAtI = A( i );
==================================== *snap*
===================================

instead.
-- Well, I guess the real problem that I don't know all the array types
after all, so if you could send my links to the Doxygen documentation of
all array-like types, that'd be really helpful.

Cheers,
Nico



On Wed, 3 Feb 2010 10:58:49 -0700, "Bartlett, Roscoe A"
<rabartl at sandia.gov> wrote:
> Nico,
> 
> I am not sure what you are asking.  Is this a class of your own that you
> are writing that represents 'A'?  If you want to accept an array of
> indexes, I would declare this as:
> 
>     someFunc( const ArrayView<dconst int> &indexes );
> 
> You would then call this as:
> 
>     someFunc(i);
> 
> Note that all the Teuchos array types Tuple, Array, and ArrayRCP can all
> be converted into an ArrayView.  You can declare 'i' to be any of these
> Array types and the implicit conversion to ArrayView will take place.
> 
> Does this help?
> 
> - Ross
> 
> 
> 
>> -----Original Message-----
>> From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-
>> users-bounces at software.sandia.gov] On Behalf Of Nico Schlömer
>> Sent: Wednesday, February 03, 2010 10:14 AM
>> To: trilinos-users at software.sandia.gov
>> Subject: [Trilinos-Users] tuple-indexable matrices?
>> 
>> Hi all,
>> 
>> I'm looking at dense vectors which can be indexed by some sort of tuple
>> (e.g., Teuchos::Tuple).
>> Currently I find myself writing something like
>> 
>>    A( i[0], i[1], i[2] )
>> 
>> a lot of times, when it's semantically nothing more than
>> 
>>    A( i )
>> 
>> Any ideas?
>> 
>> Cheers,
>> Nico
>> 
>> _______________________________________________
>> Trilinos-Users mailing list
>> Trilinos-Users at software.sandia.gov
>> http://software.sandia.gov/mailman/listinfo/trilinos-users




More information about the Trilinos-Users mailing list