Re: Allocatable arrays in derived types



Richard Maine wrote:
(snip)

It is common to measure stride in units of the size of an individual
element (because that unit of measurement gives the most direct
relationship of the stride to the Fortran syntax).

(Except for people designing computer memory hardware, where
the actual memory address is important. This is especially
true with interleaved memory systems.)

In the simplest and
most common case, the stride is 1. That means that the distance between
two consecutive elements of the aray is the size of an element; the
elements are contiguous in memory.

Consider starting with a contiguous array x and using a slice such as
x(1:n:2). Recall that this notation means to use every 2nd element of
the array. Then the "used" elements are spaced 2 element sizes apart.
(snip)

Another way to get an array of stride other than 1 is to start with a
rank 2 array and take a slice that is a row. For example, if xx is an n
by n array and you take the slice x(i,:) for some particular value of i,
that slice will have stride n-1. Note that this is a case that
Yugoslav's description doesn't catch.

Won't the stride be n?

Also, if you have N by N array x, with N greater than 3, and
take, for example, x(2:3,:) the element spacing isn't uniform.

-- glen

.



Relevant Pages

  • Re: Conserving memory
    ... Is the memory that was used for that array now freed? ... Is the memory that was used for that anonymous array now freed? ...
    (perl.beginners)
  • Re: non-recursive quicksort for 2-D arrays?
    ... array. ... and will always use exactly the same amount of memory. ... For the last 16 years I've been sorting non-trivial things on disk as ...
    (microsoft.public.vb.general.discussion)
  • Re: why this code shots up memory usage
    ... declaring them ... The worst thing about the program is the array itself. ... > entire file into memory just to process its records ...
    (comp.lang.perl.misc)
  • Re: Find value in matrix
    ... helper wrote: ... <SNIP> ... I don't understand the memory difference you are referring ... array the same size as the original array. ...
    (comp.soft-sys.matlab)
  • Re: Fast string operations
    ... Looping: I thought looping over arrays in managed code was "slow" ... array handling and such. ... The problem with TrimHelper is that it always returns a new string instance. ... The customer perceives this as a memory leak. ...
    (microsoft.public.dotnet.languages.csharp)