Blitz logo

Blitz Support :

From: Frank Schimmel (frs_at_[hidden])
Date: 2004-04-15 02:58:02


>>>>> Julian Cummings writes:

> Hi Lee,
> I played around a bit with the example code you submitted. The main
> thing you are doing wrong with repsect to the blitz part of your test is
> that you are using square bracket indexing notation instead of using the
> standard blitz indexing notation with parentheses. Thus,

> // Variable Array test using Blitz++: Array<int,2>
> int test_six(int M, int N, Array<int,2> thisarray)
                                         ^^^
                                         Shouldn't this be a reference?
> {
> // NOTE: Switching iteration order or subscript order for C++ optimization

> for (int i=0; i < M; i++)
> {
> for (int j=0; j < N; j++)
> {
> thisarray(i,j)=(i*N)+j;
> }
> }

> }

If I understand this correctly, the call to test_six() copy constructs
a new blitz array on the stack (which still represents the same data,
though). That's done 10000 times! (As opposed to just passing a
pointer in the other cases.)

What would a reference change?

Regards
-Frank Schimmel