Clicky

Fortran Wiki
count (Rev #2, changes)

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

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

Description

count(mask [, dim [, kind]]) counts the number of .true. elements of mask along the dimension of dim. If dim is omitted it is taken to be 1. dim is a scaler of type integer in the range of 1 \\leq \\text{DIM} \\leq n) where n1 \\n is the rank of mask.

Standard

(削除) Fortran 95 and later, with (削除ここまで)(追記) Fortran 95 (追記ここまで)(追記) and later, with (追記ここまで)kind argument(削除) Fortran (削除ここまで)(削除) 2003 (削除ここまで)(削除) and (削除ここまで)(削除) later (削除ここまで)(追記) Fortran 2003 (追記ここまで)(追記) and later (追記ここまで)

Class

Transformational function

Syntax

result = count(mask [, dim [, kind]])

Arguments

  • mask - The type shall be logical.
  • dim - (Optional) The type shall be integer.
  • kind - (Optional) An integer initialization expression indicating the kind parameter of the result.

Return value

The return value is of type integer and of kind kind. If kind is absent, the return value is of default integer kind. The result has a rank equal to that of mask.

Example

program test_count
 integer, dimension(2,3) :: a, b
 logical, dimension(2,3) :: mask
 a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
 b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
 print '(3i3)', a(1,:)
 print '(3i3)', a(2,:)
 print *
 print '(3i3)', b(1,:)
 print '(3i3)', b(2,:)
 print *
 mask = a.ne.b
 print '(3l3)', mask(1,:)
 print '(3l3)', mask(2,:)
 print *
 print '(3i3)', count(mask)
 print *
 print '(3i3)', count(mask, 1)
 print *
 print '(3i3)', count(mask, 2)
end program test_count

category: (削除) Intrinsics (削除ここまで)(追記) intrinsics (追記ここまで)

Revision from April 30, 2009 22:39:16 by Jason Blevins
Forward in time (2 more) | Back in time (1 more) | See current | Hide changes | History | Rollback | View: Source | Linked from: Intrinsic procedures

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