Blitz logo

Blitz Support :

From: Todd Veldhuizen (tveldhui_at_[hidden])
Date: 2003-07-21 07:53:11


Hmm. Maybe you can use the (undocument) method
Array<T,N>::constructSlice. It handles up to 11 dimensions, and every
argument can be either an integer or a Range:

template<class P_numtype, int N_rank> template<int N_rank2, class R0,
    class R1, class R2, class R3, class R4, class R5, class R6, class R7,
    class R8, class R9, class R10>
void Array<P_numtype, N_rank>::constructSlice(Array<T_numtype, N_rank2>&
array,
    R0 r0, R1 r1, R2 r2, R3 r3, R4 r4, R5 r5, R6 r6, R7 r7, R8 r8, R9 r9,
    R10 r10);

See blitz/array/slicing.cc for details. If you call it with a
3-dimensional array, all the parameters for dimensions 4, 5, etc.
are ignored.

Cheers,
Todd

-- 
Todd Veldhuizen  /  tveldhui_at_[hidden]  /  Indiana University Computer Science
On Sun, 20 Jul 2003, Dalal, Navneet wrote:
> Thanks Todd,
>
> but as I want to write meta programmes, so this way of specifying slicing
> will be different for different dimensions.
> I am looking for dimension independent function or operator.
>
> thanks
> navneet
>
> > -----Original Message-----
> > From: Todd Veldhuizen [mailto:tveldhui_at_[hidden]]
> > Sent: Sunday, July 20, 2003 1:14 PM
> > To: Support list for Blitz++
> > Subject: Re: [Blitz-support] Sub arrays in blitz meta programming
> >
> >
> > Hi Navneet,
> >
> > Try simply
> >
> >    Array<double,1> b = a(5, Range::all());
> >
> > See the slicing section of the manual for more detail:
> > http://www.oonumerics.org/blitz/manual/blitz02.html#index00087
> >
> > Cheers,
> > Todd
> > --
> > Todd Veldhuizen  /  tveldhui_at_[hidden]  /  Indiana University
> > Computer Science
> >
> > On Thu, 17 Jul 2003, Dalal, Navneet wrote:
> >
> > > Hi,
> > >
> > > I am writing bilinear interpolation code using blitz
> > arrays. I would like to
> > > write this code for general N-d arrays using meta programming.
> > >
> > > However, I am stuck with one problem: how can I get a sub
> > array along one
> > > particular dimension for a blitz array ?
> > >
> > > What I need is something like this:
> > >
> > > Array<double, 2> a (10, 10);
> > > // init a
> > >
> > > int index = 5;
> > > int firstDimension = 0;
> > >
> > > Array<double,1> b = a.subarray(firstDimension, index);
> > >
> > > // now b points to a(5, range::all)
> > >
> > >
> > >
> > > Is there a function or operator already overloaded for this purpose?
> > >
> > > thanks
> > > navneet
> > > _______________________________________________
> > > Blitz-support mailing list
> > > Blitz-support_at_[hidden]
> > > http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
> > >
> > _______________________________________________
> > Blitz-support mailing list
> > Blitz-support_at_[hidden]
> > http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
> >
> _______________________________________________
> Blitz-support mailing list
> Blitz-support_at_[hidden]
> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>