Skip to content

Commit

Permalink
Merge branch 'activations' of https://github.com/jalvesz/stdlib into …
Browse files Browse the repository at this point in the history
…activations
  • Loading branch information
jalvesz committed Dec 22, 2024
2 parents 21851d0 + 35e7146 commit ef6e3e6
Show file tree
Hide file tree
Showing 50 changed files with 3,801 additions and 74 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12]
os: [ubuntu-latest, macos-13]
toolchain:
- {compiler: gcc, version: 10}
- {compiler: gcc, version: 11}
Expand All @@ -34,9 +34,11 @@ jobs:
toolchain:
- {compiler: gcc, version: 10}
exclude:
- os: macos-12
- os: macos-13
toolchain: {compiler: intel-classic, version: '2021.9'}
- os: macos-13
toolchain: {compiler: intel, version: '2024.1'}
- os: macos-12
- os: macos-13
toolchain: {compiler: gcc, version: 13}
env:
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}
Expand Down
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,29 @@ python config/fypp_deployment.py --help
git checkout stdlib-fpm
fpm build --profile release
```
#### Runing the examples


#### Installing with fpm

Either option you chose for building the `stdlib`, you can install it with:
```sh
fpm install --profile release
```
The command above will install the following files:
- `libstdlib.a` into `~/.local/lib/` (Unix) or `C:\Users\<username>\AppData\Roaming\local\lib\` (Windows)
- all the `.[s]mod` files produced by the compiler into `~/.local/include/` (Unix) or `C:\Users\<username>\AppData\Roaming\local\include\` (Windows)

You can change the installation path by setting the prefix option to `fpm`:
```sh
fpm install --profile release --prefix /my/custom/installation/path/
```

You can use the `stdlib` by adding the `-lstdlib` flag to your compiler.
If your prefix is a non standard path, add also:
- `-L/my/custom/installation/path/lib`
- `-I/my/custom/installation/path/include`

#### Running the examples
You can run the examples with `fpm` as:

```sh
Expand Down
10 changes: 5 additions & 5 deletions doc/specs/stdlib_ascii.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Converts input character variable to all lowercase.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down Expand Up @@ -70,7 +70,7 @@ Converts input character variable to all uppercase.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down Expand Up @@ -107,7 +107,7 @@ or numeral present next to either of its 2 ends.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down Expand Up @@ -142,7 +142,7 @@ transformed to lowercase.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down Expand Up @@ -174,7 +174,7 @@ Reverses the order of all characters in the input character type.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down
49 changes: 49 additions & 0 deletions doc/specs/stdlib_linalg.md
Original file line number Diff line number Diff line change
Expand Up @@ -1565,4 +1565,53 @@ If `err` is not present, exceptions trigger an `error stop`.
{!example/linalg/example_norm.f90!}
```

## `mnorm` - Computes the matrix norm of a generic-rank array.

### Status

Experimental

### Description

This function computes one of several matrix norms of `real` or `complex` array \( A \), depending on
the value of the `order` input argument. \( A \) must be an array of rank 2 or higher. For arrays of rank > 2,
matrix norms are computed over specified dimensions.

### Syntax

`x = ` [[stdlib_linalg(module):mnorm(interface)]] `(a [, order, dim, err])`

### Arguments

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

`order` (optional): 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 |
|------------------|---------------------------------|-----------------------------------------------------------------------------|
| `1` | `'1'` | 1-norm (maximum column sum) \( \max_j \sum_i{ \left|a_{i,j}\right| } \) |
| `2` | `'2'` | 2-norm (largest singular value) |
| (not prov.) | `'Euclidean','Frobenius','Fro'` | Frobenius norm \( \sqrt{\sum_{i,j}{ \left|a_{i,j}\right|^2 }} \) |
| `huge(0)` | `'inf', 'Inf', 'INF'` | Infinity norm (maximum row sum) \( \max_i \sum_j{ \left|a_{i,j}\right| } \) |

`dim` (optional): For arrays of rank > 2, shall be an integer array of size 2 specifying the dimensions over which to compute the matrix norm. Default value is `[1,2]`. It is an `intent(in)` argument.

`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.

### Return value

For rank-2 input arrays, the return value `x` is a scalar containing the matrix norm.
For arrays of rank > 2, if the optional `dim` argument is present, `x` is a rank `n-2` array with the same shape as \( A \) except
for dimensions `dim(1)` and `dim(2)`, which are dropped. Each element of `x` contains the matrix norm of the corresponding submatrix of \( A \),
evaluated over the specified dimensions only, with the given order.

If an invalid norm type is provided, defaults to 1-norm and raises `LINALG_ERROR`.
Raises `LINALG_VALUE_ERROR` if any of the arguments has an invalid size.
If `err` is not present, exceptions trigger an `error stop`.

### Example

```fortran
{!example/linalg/example_mnorm.f90!}
```

Loading

0 comments on commit ef6e3e6

Please sign in to comment.