![]() |
Blitz Support : |
From: Xianlian Zhou (alex.xl.zhou_at_[hidden])
Date: 2004-12-14 19:26:24
Yes, the example I gave is only for illustration. I used to do this
kind of thing in Mathematica or other similar softwares.
In fact, I get quite big 1D and 2D arrays for a finite element
program, in which I need assemble the small element matrix to a big
global matrix or extract some submatrix(array) from the global
matrix(array). In my problem, it will be quite often used, and
typically the subindices are not uniform spaced.
But if Blitz++ doesn't have such a functionality for nonuniform
subarray, it seems I have to do some extra work.
On Tue, 14 Dec 2004 09:45:46 -0800, David L Goldsmith
<David.L.Goldsmith_at_[hidden]> wrote:
> Maybe because he wants to assemble the array of indices on the fly and
> not have to loop over its dimension(s) to access the elements to assign
> to the receiving array (something I had to do all the time when I was an
> IDL statistical programmer - fortunately, IDL furnished that
> functionality "off the shelf", e.g., one could simply do something like
> A = B((1,2),(2,3),(3,4)) to assign to A the elements B(1,2), B(2,3) &
> B(3,4) or B = A(where(A>0)) to assign to B the positive elements of A).
> However, Xianlian, this is something you MAY have to code yourself
> (I'm sure I'll be corrected if it already exists) - might I suggest
> deriving an array class, adding the required methods, and, when
> debugged, maybe sharing? :-)
>
> DG
>
> blitz-support-request_at_[hidden] wrote:
>
> >Send Blitz-support mailing list submissions to
> > blitz-support_at_[hidden]
> >
> >To subscribe or unsubscribe via the World Wide Web, visit
> > http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
> >or, via email, send a message with subject or body 'help' to
> > blitz-support-request_at_[hidden]
> >
> >You can reach the person managing the list at
> > blitz-support-owner_at_[hidden]
> >
> >When replying, please edit your Subject line so it is more specific
> >than "Re: Contents of Blitz-support digest..."
> >
> >
> >Today's Topics:
> >
> > 1. Nonuniform subarray. (Xianlian Zhou)
> > 2. Re: Nonuniform subarray. (Simon Perreault)
> > 3. Mirko Cambi/MI/IMISIGECOSIM is out of the office.
> > (mirko.cambi_at_[hidden])
> >
> >
> >----------------------------------------------------------------------
> >
> >Message: 1
> >Date: Sat, 11 Dec 2004 14:05:43 -0600
> >From: Xianlian Zhou <alex.xl.zhou_at_[hidden]>
> >Subject: [Blitz-support] Nonuniform subarray.
> >To: blitz-support_at_[hidden]
> >Message-ID: <2967e0ef041211120578645b57_at_[hidden]>
> >Content-Type: text/plain; charset=US-ASCII
> >
> >Hi,
> >
> >Does anyone know how to make a nonuniform subarray?
> >
> >For a simple example:
> > Array<int,1> A(3),B(5);
> > A=0;
> > B=1,2,3,4,5;
> > How could I define a nonuniform idex such as {1,2,4};
> >and make A=B({1,2,4}) ?
> >
> >
> >The Range object only represent a set of uniform indices, and the
> >array indeirction require the lhs and rhs arrays must be the same
> >shape;
> >
> >Alex Zhou
> >
> >
> >------------------------------
> >
> >Message: 2
> >Date: Sat, 11 Dec 2004 15:11:34 -0500
> >From: Simon Perreault <nomis80_at_[hidden]>
> >Subject: Re: [Blitz-support] Nonuniform subarray.
> >To: Xianlian Zhou <alex.xl.zhou_at_[hidden]>, Support list for Blitz++
> > <blitz-support_at_[hidden]>
> >Message-ID: <200412111511.34684.nomis80_at_[hidden]>
> >Content-Type: text/plain; charset="iso-8859-1"
> >
> >On Saturday December 11 2004 15:05, Xianlian Zhou wrote:
> >
> >
> >>For a simple example:
> >> Array<int,1> A(3),B(5);
> >> A=0;
> >> B=1,2,3,4,5;
> >> How could I define a nonuniform idex such as {1,2,4};
> >>and make A=B({1,2,4}) ?
> >>
> >>
> >
> >Why do you want it complicated when you can do:
> >
> >B(0) = A(1);
> >B(1) = A(2);
> >B(2) = A(4);
> >
> >
> >
>
> _______________________________________________
> Blitz-support mailing list
> Blitz-support_at_[hidden]
> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>