
Ublas : 
Subject: Re: [ublas] [uBlas] Fastest way to change sing of matrix
From: dariomt (dariomt_at_[hidden])
Date: 20130416 06:29:50
oswin krause <oswin.krause <at> ruhrunibochum.de> writes:
> Hi,
> there is unfortunately only little information about A (e.g. is A
> big? is it dense? sparse? is it a matrix, bounded_matrix or
> c_matrixr?).
I didn't say anything about the type, I would expect a single way to be
fastest for all matrix types.
> As i assume A to be a small matrix:
I did say it is very large.
> noalias(A)=A
> fixes everything.
Doesn't that suggestion break the assumptions of noalias? From the docs: "If
you know for sure that the left hand expression and the right hand
expression have no common storage". Well, the lhs and the rhs both reference
the same matrix object!
How is that guaranteed to work?
>
> Hi list,
> I need to change the sign of each element in a (very
> large) matrix.
>
> I know a way that is very slow
>
> A = A;
>
> What is the fastest way to do this?
>
> Thanks in Advance
>