Skip to content

Commit

Permalink
move get_norm before norm
Browse files Browse the repository at this point in the history
  • Loading branch information
perazz committed Sep 23, 2024
1 parent f271688 commit 9e020a8
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions doc/specs/stdlib_linalg.md
Original file line number Diff line number Diff line change
Expand Up @@ -1382,25 +1382,31 @@ If `err` is not present, exceptions trigger an `error stop`.
{!example/linalg/example_inverse_function.f90!}
```

## `norm` - Computes the vector norm of a generic-rank array.
## `get_norm` - Computes the vector norm of a generic-rank array.

### Status

Experimental

### Description

This function computes one of several vector norms of `real` or `complex` array \( A \), depending on
This `pure subroutine` interface computes one of several vector norms of `real` or `complex` array \( A \), depending on
the value of the `order` input argument. \( A \) may be an array of any rank.

Result `nrm` returns a `real`, scalar norm value for the whole array; if `dim` is specified, `nrm` is a rank n-1
array with the same shape as \(A \) and dimension `dim` dropped, containing all norms evaluated along `dim`.

### Syntax

`x = ` [[stdlib_linalg(module):norm(interface)]] `(a, order, [, dim, err])`
`call ` [[stdlib_linalg(module):get_norm(interface)]] `(a, nrm, order, [, dim, err])`

### Arguments

`a`: Shall be a rank-n `real` or `complex` array containing the data. It is an `intent(in)` argument.

`nrm`: if `dim` is absent, shall be a scalar with the norm evaluated over all the elements of the array. Otherwise, an array of rank `n-1`, and a shape similar
to that of `a` with dimension `dim` dropped.

`order`: Shall be an `integer` value or a `character` flag that specifies the norm type, as follows. It is an `intent(in)` argument.

| Integer input | Character Input | Norm type |
Expand All @@ -1417,9 +1423,9 @@ the value of the `order` input argument. \( A \) may be an array of any rank.

### Return value

By default, the return value `x` is a scalar, and contains the norm as evaluated over all elements of the generic-rank array \( A \).
If the optional `dim` argument is present, `x` is a rank `n-1` array with the same shape as \( A \) except
for dimension `dim`, that is dropped. Each element of `x` contains the 1D norm of the elements of \( A \),
By default, the return value `nrm` is a scalar, and contains the norm as evaluated over all elements of the generic-rank array \( A \).
If the optional `dim` argument is present, `nrm` is a rank `n-1` array with the same shape as \( A \) except
for dimension `dim`, that is collapsed. Each element of `nrm` contains the 1D norm of the elements of \( A \),
evaluated along dimension `dim` only.

Raises `LINALG_ERROR` if the requested norm type is invalid.
Expand All @@ -1429,34 +1435,28 @@ If `err` is not present, exceptions trigger an `error stop`.
### Example

```fortran
{!example/linalg/example_norm.f90!}
{!example/linalg/example_get_norm.f90!}
```

## `get_norm` - Computes the vector norm of a generic-rank array.
## `norm` - Computes the vector norm of a generic-rank array.

### Status

Experimental

### Description

This `pure subroutine` interface computes one of several vector norms of `real` or `complex` array \( A \), depending on
This function computes one of several vector norms of `real` or `complex` array \( A \), depending on
the value of the `order` input argument. \( A \) may be an array of any rank.

Result `nrm` returns a `real`, scalar norm value for the whole array; if `dim` is specified, `nrm` is a rank n-1
array with the same shape as \(A \) and dimension `dim` dropped, containing all norms evaluated along `dim`.

### Syntax

`call ` [[stdlib_linalg(module):get_norm(interface)]] `(a, nrm, order, [, dim, err])`
`x = ` [[stdlib_linalg(module):norm(interface)]] `(a, order, [, dim, err])`

### Arguments

`a`: Shall be a rank-n `real` or `complex` array containing the data. It is an `intent(in)` argument.

`nrm`: if `dim` is absent, shall be a scalar with the norm evaluated over all the elements of the array. Otherwise, an array of rank `n-1`, and a shape similar
to that of `a` with dimension `dim` dropped.

`order`: Shall be an `integer` value or a `character` flag that specifies the norm type, as follows. It is an `intent(in)` argument.

| Integer input | Character Input | Norm type |
Expand All @@ -1473,9 +1473,9 @@ to that of `a` with dimension `dim` dropped.

### Return value

By default, the return value `nrm` is a scalar, and contains the norm as evaluated over all elements of the generic-rank array \( A \).
If the optional `dim` argument is present, `nrm` is a rank `n-1` array with the same shape as \( A \) except
for dimension `dim`, that is collapsed. Each element of `nrm` contains the 1D norm of the elements of \( A \),
By default, the return value `x` is a scalar, and contains the norm as evaluated over all elements of the generic-rank array \( A \).
If the optional `dim` argument is present, `x` is a rank `n-1` array with the same shape as \( A \) except
for dimension `dim`, that is dropped. Each element of `x` contains the 1D norm of the elements of \( A \),
evaluated along dimension `dim` only.

Raises `LINALG_ERROR` if the requested norm type is invalid.
Expand All @@ -1485,5 +1485,7 @@ If `err` is not present, exceptions trigger an `error stop`.
### Example

```fortran
{!example/linalg/example_get_norm.f90!}
{!example/linalg/example_norm.f90!}
```


0 comments on commit 9e020a8

Please sign in to comment.