Blitz logo

Blitz Support :

From: Einar Otnes (einar.otnes_at_[hidden])
Date: 2003-04-27 13:11:03


Thank you for your answer. I see what you mean, I have recompiled it and
it works. It appears that I have a problem with kDevelop 2.1.5 which I
use for development. It still won't work when I'm compiling the same
code within kDevelop. Then it complains about
"/usr/local/Blitz++/gcc/include/blitz/array-impl.h:2001: invalid use of
member ` " when it comes to the definition
Array<float,1> junk1(junk2(allRange,3));

...but now I think that this is not an issue related to Blitz but to
kDevelop and its compiler options...

Regards,
Einar Otnes

Julian Cummings wrote:

> Hello Einar,
>
> I think you may have misunderstood the blitz documentation on slicing
> (section 2.4.4).
> A combination of Range and integer operands with Array indexing
> produces a slice,
> and each *integer* operand reduces the Array rank by one. The partial
> ordering feature,
> which the current gcc compiler has, is required to use Range and
> integer operands in
> combination like this. If you didn't have partial ordering, you would
> have to use a
> Range argument with length 1 as you did in your example below. The
> problem is,
> that does not reduce the Array rank by one. You still have a 2d
> Array, which you cannot
> use to initialize a 1d Array. The solution is to replace your
> "threeRange" argument with
> the integer value 3.
>
> Regards, Julian C.
>
>
> Einar Otnes wrote:
>
>> I have just installed blitz-20021003 on my computer with RH9.0 and it
>> appears that my installation of Blitz does not support
>> BZ_PARTIAL_ORDERING even if its defined in config.h. I'm not allowed
>> to slice an array down a dimension like the code below. It won't
>> compile.
>> For compilation I use g++ -o main main.cpp
>> -I/usr/local/Blitz++/gcc/include -L/usr/local/Blitz++/gcc/lib -lblitz
>>
>> If I change the dimension of junk1 from 1 to 2, everything works ok.
>>
>> If I recall correctly I haven't experienced these problems before
>> with earlier versions of gcc, am I right?
>>
>> thanks, Einar Otnes
>>
>>
>> #include <blitz/array.h>
>> #include <iostream>
>>
>> using namespace std;
>> using namespace blitz;
>>
>> int main()
>> {
>> Array<float,2> junk2(5,5);
>> junk2 = 1.0f;
>>
>> Range threeRange = Range(3,3);
>> Range allRange = Range::all();
>>
>> Array<float,1> junk1(junk2(allRange,threeRange));
>>
>> cerr << " junk2 = " << junk2 << endl;
>> cerr << " junk1 = " << junk1 << endl;
>>
>> return EXIT_SUCCESS;
>> }
>>
>>
>> _______________________________________________
>> Blitz-support mailing list
>> Blitz-support_at_[hidden]
>> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>
>
>