Re: [uBlas] Fastest way to change sing of matrix

Rhys Ulerich <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <CAKDqugSChYzr4c59_TmFGEQ6-SigYhz42pZaG1e-yWwxG0eF7A@mail.gmail.com>
> I didn't say anything about the type, I would expect a single way to be
> fastest for all matrix types.

The quickest way I can imagine would be to carry around a scalar, e.g.
    double changesign = 1;
and then, if you need to negative your matrix, set
    changesign *= -1;
and then include changesign in some later multiplication or
accumulation operation.  Presumably it could be rolled into some other
scalar multiplicative factor.

In this scheme, you pay exactly one FLOP regardless of the
type/size/anything of A.

- Rhys
_______________________________________________
ublas mailing list
[email protected]
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.