Clicky
Showing changes from revision #2 to #3:
(追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)
Calculates the Euclidean vector norm ( norm) of array
along dimension dim
.
Fortran 2008 and later
(削除) Transformational function? (削除ここまで)(追記) Transformational function (追記ここまで)
(削除) result = norm2(array[, dim]) (削除ここまで)(追記) result (追記ここまで)(追記) (追記ここまで)(追記) = (追記ここまで)(追記) (追記ここまで)(追記) norm2 (追記ここまで)(追記) ( (追記ここまで)(追記) array (追記ここまで)(追記) [, (追記ここまで)(追記) (追記ここまで)(追記) dim (追記ここまで)(追記) ]) (追記ここまで)
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
.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 , where equals the rank of array
, and a shape similar to that of array
with dimension dim
dropped is returned.
program test_norm2
real :: x(5) = [ real :: 1, 2, 3, 4, 5 ]
print *, norm2(x)! = sqrt(55.) ~ 7.416
end program