[UP]


Manual Reference Pages  - spread (3)

NAME

spread(3f) - [FORTRAN:INTRINSIC:ARRAY CONSTRUCTION] Add a dimension to an array

CONTENTS

Syntax
Description
Arguments
Return Value
Example
Standard
Class
See Also

SYNTAX

result = spread(source, dim, ncopies)

DESCRIPTION

Replicates a SOURCE array NCOPIES times along a specified dimension DIM.

ARGUMENTS

SOURCE - Shall be a scalar or an array of any type and a rank less than seven.
DIM - Shall be a scalar of type INTEGER with a value in the range from 1 to n+1, where n equals the rank of SOURCE.
NCOPIES
  - Shall be a scalar of type INTEGER.

RETURN VALUE

The result is an array of the same type as SOURCE and has rank n+1 where n equals the rank of SOURCE.

EXAMPLE

Sample program:

    program demo_spread
      integer :: a = 1, b(2) = (/ 1, 2 /)
      write(*,*) spread(a, 1, 2)            ! "1 1"
      write(*,*) spread(b, 1, 2)            ! "1 1 2 2"
    end program demo_spread

STANDARD

[[Fortran 95]] and later

CLASS

Transformational function

SEE ALSO

[[unpack]]


spread (3) March 19, 2019
Generated by manServer 1.08 from bd55e215-f261-4949-a8ea-8a964773ae14 using man macros.