[Trilinos-Users] Trilinos-Users Digest, Vol 60, Issue 1

Nico Schlömer nico.schloemer at ua.ac.be
Mon Aug 2 14:40:43 MDT 2010


Thanks Mark for the clarifications.

I'll guess for the time being I'll just go right ahead and implement
operator{+,-,*} for myself and have the code clean. Should that turn out to
significantly impair the speed, I'll look into expressions myself.

Cheers,
Nico



On Mon, 2 Aug 2010 12:25:20 -0600, "Mark Hoemmen" <mhoemme at sandia.gov>
wrote:
> On Aug 1, 2010, at 10:08 PM, trilinos-users-request at software.sandia.gov
> wrote:
>> Message: 4
>> Date: Mon, 02 Aug 2010 02:46:31 +0200
>> From: Nico Schl?mer <nico.schloemer at ua.ac.be>
>> Subject: Re: [Trilinos-Users] Epetra_SerialDenseVector vs.
>>        Teuchos::SerialDenseVector
>> To: "Bartlett, Roscoe A" <rabartl at sandia.gov>
>> Cc: "Heroux, Michael A" <maherou at sandia.gov>, "Thornquist,      Heidi
K"
>>        <hkthorn at sandia.gov>, trilinos-users at software.sandia.gov
>> Message-ID: <5a5040fba02ffca0981ca1e5c125a8d0 at ua.ac.be>
>> Content-Type: text/plain; charset=utf-8
>> 
>>> It is very hard to make operator+, operator-, operator* efficient.
>> 
>> I see.
>> Would you have any recommendation for me what to do with expression
like
>> 
>>   y = alpha * x1 + beta * x2 + ...
>> 
>> ?
> 
> "Efficient" here means "not creating temporary vectors."  Each of those
> "alpha*x1" terms will have to create a new temporary vector, and each
> operator+ invocation will have to do so as well.  The temporaries will
go
> away, but you'll still have to spend time in memory allocation.
> 
> If you're not worried about that, then you could define non-member
> operator+, operator*, ... methods.  They don't need to belong to or be
> friends of Teuchos::SerialDenseVector, because SerialDenseVector has an
> operator[].  Each of these methods should create and return a new
> SerialDenseVector.
> 
> If you are worried about the cost of creating temporary vectors in such
> expressions, but still want to write expressions in this way, you may
wish
> to investigate the uBLAS, which is in the Boost collection of C++
> libraries.  See e.g., the overview at 
> 
> http://www.boost.org/doc/libs/1_43_0/libs/numeric/ublas/doc/overview.htm
> 
> mfh
> 
> 
> 
> 
> _______________________________________________
> 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