Blitz logo

Blitz Support :

From: William Gallafent (william_at_[hidden])
Date: 2003-08-26 13:55:27


On Tue, 26 Aug 2003, Patrik wrote:

> i even grepped through all the sources and I can't see a definition for a
> unary minus operator anywhere... this is weird. And unless i'm completely
> spacing now, I am using the current cvs code. so, this operator should
> exist?

Seems you're right. On closer inspection I too failed to find it!

I suppose one is expected simply to subtract from 0 to change the sign of each
element of a TinyVector. This compiles for me:

#include <iostream>
#include <blitz/tinyvec-et.h>

int
main (int argc, char* argv[])
{
        blitz::TinyVector<float, 3> myTV = 1;
        blitz::TinyVector<float, 3> anotherTV = 0 - myTV;
        std::cout << anotherTV << std::endl;
}

and produces the output

3 [ -1 -1 -1 ]

Hope I haven't misunderstood, and you're actually trying to do something
cleverer or more subtle than that!

-- 
Bill Gallafent.