Re: Allocatable arrays in derived types
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Tue, 29 Apr 2008 08:41:18 -0800
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(snip)
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.
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
.
- Follow-Ups:
- Re: Allocatable arrays in derived types
- From: Richard Maine
- Re: Allocatable arrays in derived types
- References:
- Allocatable arrays in derived types
- From: Gib Bogle
- Re: Allocatable arrays in derived types
- From: Arjen Markus
- Re: Allocatable arrays in derived types
- From: relaxmike
- Re: Allocatable arrays in derived types
- From: Richard Maine
- Re: Allocatable arrays in derived types
- From: relaxmike
- Re: Allocatable arrays in derived types
- From: Jugoslav Dujic
- Re: Allocatable arrays in derived types
- From: relaxmike
- Re: Allocatable arrays in derived types
- From: Richard Maine
- Allocatable arrays in derived types
- Prev by Date: Re: variable length of integer
- Next by Date: Re: Allocatable arrays in derived types
- Previous by thread: Re: Allocatable arrays in derived types
- Next by thread: Re: Allocatable arrays in derived types
- Index(es):
Relevant Pages
|