Clicky

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

Calculates the Euclidean vector norm (L 2L_2 norm) of array along dimension dim.

Standard

Fortran 2008 and later

Class

Transformational function?

Syntax

result = norm2(array[, dim])

Arguments

  • array - Shall be an array of type real.
  • dim - (Optional) shall be a scalar of type integer with a value in the range from 1 to n, where n equals the rank of array.

Return value

The result is of the same type as array.

If dim is absent, a scalar with the square root of the sum of squares of the elements of array is returned. Otherwise, an array of rank n1n-1, where nn equals the rank of array, and a shape similar to that of array with dimension dim dropped is returned.

Example

program test_norm2
 real :: x(5) = [ real :: 1, 2, 3, 4, 5 ]
 print *, norm2(x) ! = sqrt(55.) ~ 7.416
end program

See also

product, sum (追記) , (追記ここまで)(追記) hypot (追記ここまで)

category: intrinsics

Revision from August 22, 2013 08:16:47 by Maximilien Levesque?
Forward in time (to current) | Back in time (1 more) | See current | Hide changes | History | Rollback | View: Source | Linked from: Intrinsic procedures, Fortran 2008

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