Clicky

Fortran Wiki
unpack (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

Store the elements of vector in an array of higher rank.

Standard

Fortran 95 and later

Class

Transformational function

Syntax

result = unpack(vector, mask, field)

Arguments

  • vector - Shall be an array of any type and rank one. It shall have at least as many elements as mask has true values.
  • mask - Shall be an array of type logical.
  • field - Shall be of the same type as vector and have the same shape as mask.

Return value

The resulting array corresponds to field with true elements of mask replaced by values from vector in array element order.

Example

program test_unpack
 integer :: vector(2) = (/1,1/)
 logical :: mask(4) = (/ .true., .false., .false., .true. /)
 integer :: field(2,2) = 0, unity(2,2)
 ! result: unity matrix
 unity = unpack(vector, reshape(mask, (/2,2/)), field)
end program

See also

pack, spread

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

Revised on April 30, 2009 17:30:57 by Jason Blevins (71.70.142.190) (1000 characters / 0.0 pages)
Edit | Back in time (1 revision) | Hide changes | History | Views: Print | TeX | Source | Linked from: Intrinsic procedures, pack, spread

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