Clicky

Fortran Wiki
shape (changes)

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Showing changes from revision #3 to #4: (追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)

Description

Determines the shape of an array.

Standard

Fortran 95 (追記) and later; with (追記ここまで)(追記) kind (追記ここまで)(追記) argument (追記ここまで)(追記) Fortran 2003 (追記ここまで) and later

Class

Inquiry function

Syntax

(削除)

result = shape(source)

(削除ここまで)
(追記)
result = shape(source[, kind])
(追記ここまで)

Arguments

  • source - Shall be an array or scalar of any type. If source is a pointer it must be associated and allocatable arrays must be allocated.
  • (追記) (追記ここまで)(追記)
  • kind - (Optional) An integer initialization expression indicating the kind parameter of the result.
  • (追記ここまで)

Return value

An integer array of rank one with as many elements as source has dimensions. The elements of the resulting array correspond to the extend of source along the respective dimensions. If source is a scalar, the result is the rank one array of size zero.(追記) If (追記ここまで)(追記) kind (追記ここまで)(追記) is absent, the return value has the default integer kind otherwise the specified kind. (追記ここまで)

Example

program test_shape
 integer, dimension(-1:1, -1:2) :: a
 write(*,*) shape(a) ! (/ 3, 4 /)
 write(*,*) size(shape(42)) ! (/ /)
end program

See also

reshape, size

category: intrinsics

Revised on April 4, 2016 17:24:35 by Jason Blevins (128.146.137.52) (1289 characters / 0.0 pages)
Edit | Back in time (3 revisions) | Hide changes | History | Views: Print | TeX | Source | Linked from: Intrinsic procedures, reshape, size, Fortran 2003 status

AltStyle によって変換されたページ (->オリジナル) /