Boost logo

Boost :

From: John (EBo) David (ebo_at_[hidden])
Date: 2000-12-08 21:41:40


Randy Roberts wrote:
>
> --- In boost_at_[hidden], Ronald Garcia <rgarcia4_at_c...> wrote:
> > At certain times it is necessary to work with both "C" style and
> > "Fortran" style arrays, especially when interfacing with fortran
> which
> > (IMHO) is unfortunately necessary at times. I think that given the
> > right abstractions, code to support a fortran view of arrays can
> also
> > support arbitrary dimension permutations without greatly affecting
> the
> > complexity of the code.
> >
> > Since not everyone is going to need altered views of arrays, simple
> > abstractions that provide enough hooks to implement an altered view
> > as an extension of the base library would suffice and provide great
> > flexibility at what should be a minimal cost in complexity. This
> > mechanism could also be a way of providing a flattened view of
> arrays
> > if the standard iterators iterate across N-1 dimensional subarrays,
> > which I think is the way to go.
>
> I think the important thing to realize here, is that us poor sm*cks
> who have to work with legacy F77 code not just need a Fortran **view**
> of an array, we need access to a pointer to the contiguous,
> Fortran-ordered array data.
>
> There are two problems with a Fortran view approach to this problem...
>
> First, if the view causes a copy of the data into a Fortran-ordered
> array (it really isn't a view, is it), then we may be faced with large
> copying overheads in both space and time.
>
> Second, if we were only to have a Fortran view of the array with
> iterators that gallop through the strided generalized slices of an
> underlying C-ordered C-style array, then there is no way to obtain
> from this iterator a pointer to a contiguous Fortran-ordered array.
> One would have to use something akin to std::copy(,,) into a temporary
> buffer, and we are right back to the large copying overheads in both
> space and time.

and third, keeping multiple copies of data are just asking for
problems: first you make a copy, do what you need to do, call a couple
of subroutines (that does not use your copy data, or the original
data... so you though) to find out months later that the original data
is referenced through a common block via code that was originally
written in 1976... Last legacy project I worked on was over 250,000
lines of a hodgepodge of FORTRAN 4, 77, and C (both K&R and ANSI). I
think the earliest comment was from 1972 or something. There were at
least 6 different list implementations (because the code was so poorly
commented that you had no idea what was done much less where to find
it)... you get the picture. Keeping multiple copies around is like
leaving open jars of jam around the kitchen for little creepy
critters...

If I may humbly request a Fortran **view** if a FORTRAN anything and not
a simple copy. I know I may be asking for a lot, but I do not think I
am the only one...

  EBo --


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk