]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
1 | .. |
2 | Copyright 1988-2022 Free Software Foundation, Inc. | |
3 | This is part of the GCC manual. | |
4 | For copying conditions, see the copyright.rst file. | |
5 | ||
6 | .. index:: NORM2, Euclidean vector norm, L2 vector norm, norm, Euclidean | |
7 | ||
8 | .. _norm2: | |
9 | ||
10 | NORM2 --- Euclidean vector norms | |
11 | ******************************** | |
12 | ||
13 | .. function:: NORM2(ARRAY, DIM) | |
14 | ||
15 | Calculates the Euclidean vector norm (L_2 norm) | |
16 | of :samp:`{ARRAY}` along dimension :samp:`{DIM}`. | |
17 | ||
18 | :param ARRAY: | |
19 | Shall be an array of type ``REAL`` | |
20 | ||
21 | :param DIM: | |
22 | (Optional) shall be a scalar of type | |
23 | ``INTEGER`` with a value in the range from 1 to n, where n | |
24 | equals the rank of :samp:`{ARRAY}`. | |
25 | ||
26 | :return: | |
27 | The result is of the same type as :samp:`{ARRAY}`. | |
28 | ||
29 | Standard: | |
30 | Fortran 2008 and later | |
31 | ||
32 | Class: | |
33 | Transformational function | |
34 | ||
35 | Syntax: | |
36 | .. code-block:: fortran | |
37 | ||
38 | RESULT = NORM2(ARRAY[, DIM]) | |
39 | ||
40 | Example: | |
41 | .. code-block:: fortran | |
42 | ||
43 | PROGRAM test_sum | |
44 | REAL :: x(5) = [ real :: 1, 2, 3, 4, 5 ] | |
45 | print *, NORM2(x) ! = sqrt(55.) ~ 7.416 | |
3ed1b4ce | 46 | END PROGRAM |