Topic: multdimensional arrays in C++


Author: beliavsky@aol.com
Date: Mon, 7 Jun 2004 17:26:26 +0000 (UTC)
Raw View
Will a multidimensional array container be added to C++, with
functionality similar to that found in Fortran 90/95, Matlab, or the
Numeric Python module? Some desirable features would be

(1) the ability to query the shape, analogous to .size() for vector's
(2) array operations, such scaling all elements by a factor
(3) better notation -- I think a[1,2,3] is much better than a[1][2][3]
(4) array slices -- the ability to write something like a[1:3,:,3:5]
is very nice.

Many people, including most authors of "numerical methods in c++"
books, have implemented array classes, usually covering (1-3) but not
often (4). Having numerical libraries written with several
incompatible array classes is suboptimal IMO.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: hattons@globalsymmetry.com ("Steven T. Hatton")
Date: Mon, 7 Jun 2004 20:44:42 +0000 (UTC)
Raw View
beliavsky@aol.com wrote:

> Will a multidimensional array container be added to C++, with
> functionality similar to that found in Fortran 90/95, Matlab, or the
> Numeric Python module? Some desirable features would be
>
> (1) the ability to query the shape, analogous to .size() for vector's
> (2) array operations, such scaling all elements by a factor
> (3) better notation -- I think a[1,2,3] is much better than a[1][2][3]
> (4) array slices -- the ability to write something like a[1:3,:,3:5]
> is very nice.
>
> Many people, including most authors of "numerical methods in c++"
> books, have implemented array classes, usually covering (1-3) but not
> often (4). Having numerical libraries written with several
> incompatible array classes is suboptimal IMO.

I would be overjoyed if I could have item 1.

One thing that seems important to this topic is whether this is to fall into
the category of valarray, with a specific focus on numerical computation.
Should this array also support elements of user defined types?

--
STH
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: pderocco@ix.netcom.com ("Paul D. DeRocco")
Date: Tue, 8 Jun 2004 06:41:21 +0000 (UTC)
Raw View
> <beliavsky@aol.com> wrote
>
> Will a multidimensional array container be added to C++, with
> functionality similar to that found in Fortran 90/95, Matlab, or the
> Numeric Python module? Some desirable features would be
>
> (1) the ability to query the shape, analogous to .size() for vector's
> (2) array operations, such scaling all elements by a factor
> (3) better notation -- I think a[1,2,3] is much better than a[1][2][3]
> (4) array slices -- the ability to write something like a[1:3,:,3:5]
> is very nice.
>
> Many people, including most authors of "numerical methods in c++"
> books, have implemented array classes, usually covering (1-3) but not
> often (4). Having numerical libraries written with several
> incompatible array classes is suboptimal IMO.

I'd die of shock if they ever implemented it using new syntaxes like that. I
could imagine conventional C++ish extensions to valarray that would do what
you want.

--

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco@ix.netcom.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: honkaonka.belitz@fz-juelich.de (Hendrik Belitz)
Date: Tue, 8 Jun 2004 17:50:18 +0000 (UTC)
Raw View
Paul D. DeRocco wrote:

>> <beliavsky@aol.com> wrote
>>
>> Will a multidimensional array container be added to C++, with
>> functionality similar to that found in Fortran 90/95, Matlab, or the
>> Numeric Python module? Some desirable features would be
>>
>> (1) the ability to query the shape, analogous to .size() for vector's
>> (2) array operations, such scaling all elements by a factor
>> (3) better notation -- I think a[1,2,3] is much better than a[1][2][3]
>> (4) array slices -- the ability to write something like a[1:3,:,3:5]
>> is very nice.

All these features are found in Libraries like Blitz++ or POOMA. Since
performance of specific operations vary between certain application, there
cannot be an optimal multidimensional array, so why it should be added to
the standard. The partly desastrous valarray container is a pretty example
of trying so.

--
To get my real email adress, remove the two onkas
--
Hendrik Belitz
- Abort, Retry, Fthagn? -

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]