Blitz logo

Blitz Devel :

From: Julian Cummings (cummings_at_[hidden])
Date: 2004-04-13 13:05:47


Hi Chris,

Many people have raised this issue from time to time. I personally
would have no problem with making the blitz Array iterators
STL-compliant. The only issues I am aware of regarding such a change
are the following:

1) There's a code comment in <blitz/array/iter.h> explaining that both
the prefix and postfix operator++ have been defined to return void
because the Array iterator type has a lot of state data and is
relatively expensive to copy. Of course, one can avoid the copy by only
using the postfix version when it is truly necessary.

2) In general, iterators are an inefficient mechanism for
multidimensional containers because of the need to check for the end of
the row in each dimension. That's why it makes a lot of sense to write
Array expressions and let blitz construct efficient loops for you or to
create your own functors that will apply some function to each element
of an Array. This is not an argument for iterators that don't comply
with the STL, but rather a general argument against using iterators with
multidimensional containers.

Blitz users: are there any other issues regarding blitz Array iterators?

Please do roll your modifications into a patch for the current version
of blitz and submit it via the sourceforge website. If there are no
performance issues or violent objections from other users, we can apply
this patch to blitz.

Regards, Julian C.

Chris Hennes wrote:

> I am writing with regard to this (rather old) message to this list:
>
> http://www.oonumerics.org/MailArchives/blitz-dev/msg00387.php
>
> The message describes the changes necessary to make blitz array
> iterators compliant with the STL algorithms.
>
> The original message received no replies, and I was curious as to the
> reason. I've made the changes suggested and they work perfectly, at
> least with gcc 3.3. If there is interest, I can roll them into a patch
> for the current version and submit it for consideration, but before I
> do so I wanted to make sure that I'm not missing some obvious flaw.
>
> Thanks,
> Chris
>
> _______________________________________________
> Blitz-dev mailing list
> Blitz-dev_at_[hidden]
> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-dev

-- 
Dr. Julian C. Cummings                       E-mail: cummings_at_[hidden]
California Institute of Technology           Phone:  626-395-2543
1200 E. California Blvd., Mail Code 158-79   Fax:    626-584-5917
Pasadena, CA 91125