![]() |
Blitz Support : |
From: Dalal, Navneet (navneet.dalal_at_[hidden])
Date: 2003-07-21 09:48:40
This works.
Array<TinyVector<double,1>, 2> c(2,2);
c = 10, 5, 7, 8;
Array1D b (c, 1, Range::all(), nilArraySection(),
nilArraySection(), nilArraySection(), nilArraySection(),
nilArraySection(),
nilArraySection(), nilArraySection(), nilArraySection(),
nilArraySection());
So I may write some custom functions using constructSlice for my
conversions.
However, few things:
when I try to change this constructor to accept default arguments, and call
the constructor using something like
Array1D b (c, 1, Range::all());
gcc 3.2.3 is unable to resolve the call. Even though, I think that this
construcotr doesnot conflict with any existing constructors. And if I change
the definition to
template<int N_rank2, class R0, class R1, class R2 = nilArraySection,
class R3 = nilArraySection, class R4 = nilArraySection,
class R5 = nilArraySection, class R6 = nilArraySection,
class R7 = nilArraySection, class R8 = nilArraySection,
class R9 = nilArraySection, class R10 = nilArraySection>
Array(Array<T_numtype,N_rank2>& array, R0 r0, R1 r1, R2 r2 =
nilArraySection(),
R3 r3 = nilArraySection(), R4 r4 = nilArraySection(), R5 r5 =
nilArraySection(),
R6 r6 = nilArraySection(), R7 r7 = nilArraySection(), R8 r8 =
nilArraySection(),
R9 r9 = nilArraySection(), R10 r10 = nilArraySection())
{
constructSlice(array, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10);
}
I get this error
blitz/include/blitz/array-impl.h:908: default template arguments may not be
used in function templates
Any comments why?
-navneet
> -----Original Message-----
> From: Todd Veldhuizen [mailto:tveldhui_at_[hidden]]
> Sent: Monday, July 21, 2003 8:53 AM
> To: Support list for Blitz++
> Subject: RE: [Blitz-support] Sub arrays in blitz meta programming
>
>
> 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
> >
> _______________________________________________
> Blitz-support mailing list
> Blitz-support_at_[hidden]
> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>