Skip to content

Commit ef6e3e6

Browse files
committed
Merge branch 'activations' of https://github.com/jalvesz/stdlib into activations
2 parents 21851d0 + 35e7146 commit ef6e3e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3801
-74
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
os: [ubuntu-latest, macos-12]
22+
os: [ubuntu-latest, macos-13]
2323
toolchain:
2424
- {compiler: gcc, version: 10}
2525
- {compiler: gcc, version: 11}
@@ -34,9 +34,11 @@ jobs:
3434
toolchain:
3535
- {compiler: gcc, version: 10}
3636
exclude:
37-
- os: macos-12
37+
- os: macos-13
38+
toolchain: {compiler: intel-classic, version: '2021.9'}
39+
- os: macos-13
3840
toolchain: {compiler: intel, version: '2024.1'}
39-
- os: macos-12
41+
- os: macos-13
4042
toolchain: {compiler: gcc, version: 13}
4143
env:
4244
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,29 @@ python config/fypp_deployment.py --help
219219
git checkout stdlib-fpm
220220
fpm build --profile release
221221
```
222-
#### Runing the examples
222+
223+
224+
#### Installing with fpm
225+
226+
Either option you chose for building the `stdlib`, you can install it with:
227+
```sh
228+
fpm install --profile release
229+
```
230+
The command above will install the following files:
231+
- `libstdlib.a` into `~/.local/lib/` (Unix) or `C:\Users\<username>\AppData\Roaming\local\lib\` (Windows)
232+
- all the `.[s]mod` files produced by the compiler into `~/.local/include/` (Unix) or `C:\Users\<username>\AppData\Roaming\local\include\` (Windows)
233+
234+
You can change the installation path by setting the prefix option to `fpm`:
235+
```sh
236+
fpm install --profile release --prefix /my/custom/installation/path/
237+
```
238+
239+
You can use the `stdlib` by adding the `-lstdlib` flag to your compiler.
240+
If your prefix is a non standard path, add also:
241+
- `-L/my/custom/installation/path/lib`
242+
- `-I/my/custom/installation/path/include`
243+
244+
#### Running the examples
223245
You can run the examples with `fpm` as:
224246

225247
```sh

doc/specs/stdlib_ascii.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Converts input character variable to all lowercase.
3838

3939
#### Class
4040

41-
Pure function.
41+
Elemental function.
4242

4343
#### Argument
4444

@@ -70,7 +70,7 @@ Converts input character variable to all uppercase.
7070

7171
#### Class
7272

73-
Pure function.
73+
Elemental function.
7474

7575
#### Argument
7676

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

108108
#### Class
109109

110-
Pure function.
110+
Elemental function.
111111

112112
#### Argument
113113

@@ -142,7 +142,7 @@ transformed to lowercase.
142142

143143
#### Class
144144

145-
Pure function.
145+
Elemental function.
146146

147147
#### Argument
148148

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

175175
#### Class
176176

177-
Pure function.
177+
Elemental function.
178178

179179
#### Argument
180180

doc/specs/stdlib_linalg.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,4 +1565,53 @@ If `err` is not present, exceptions trigger an `error stop`.
15651565
{!example/linalg/example_norm.f90!}
15661566
```
15671567

1568+
## `mnorm` - Computes the matrix norm of a generic-rank array.
1569+
1570+
### Status
1571+
1572+
Experimental
1573+
1574+
### Description
1575+
1576+
This function computes one of several matrix norms of `real` or `complex` array \( A \), depending on
1577+
the value of the `order` input argument. \( A \) must be an array of rank 2 or higher. For arrays of rank > 2,
1578+
matrix norms are computed over specified dimensions.
1579+
1580+
### Syntax
1581+
1582+
`x = ` [[stdlib_linalg(module):mnorm(interface)]] `(a [, order, dim, err])`
1583+
1584+
### Arguments
1585+
1586+
`a`: Shall be a rank-n `real` or `complex` array containing the data, where n >= 2. It is an `intent(in)` argument.
1587+
1588+
`order` (optional): Shall be an `integer` value or a `character` flag that specifies the norm type, as follows. It is an `intent(in)` argument.
1589+
1590+
| Integer input | Character Input | Norm type |
1591+
|------------------|---------------------------------|-----------------------------------------------------------------------------|
1592+
| `1` | `'1'` | 1-norm (maximum column sum) \( \max_j \sum_i{ \left|a_{i,j}\right| } \) |
1593+
| `2` | `'2'` | 2-norm (largest singular value) |
1594+
| (not prov.) | `'Euclidean','Frobenius','Fro'` | Frobenius norm \( \sqrt{\sum_{i,j}{ \left|a_{i,j}\right|^2 }} \) |
1595+
| `huge(0)` | `'inf', 'Inf', 'INF'` | Infinity norm (maximum row sum) \( \max_i \sum_j{ \left|a_{i,j}\right| } \) |
1596+
1597+
`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.
1598+
1599+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
1600+
1601+
### Return value
1602+
1603+
For rank-2 input arrays, the return value `x` is a scalar containing the matrix norm.
1604+
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
1605+
for dimensions `dim(1)` and `dim(2)`, which are dropped. Each element of `x` contains the matrix norm of the corresponding submatrix of \( A \),
1606+
evaluated over the specified dimensions only, with the given order.
1607+
1608+
If an invalid norm type is provided, defaults to 1-norm and raises `LINALG_ERROR`.
1609+
Raises `LINALG_VALUE_ERROR` if any of the arguments has an invalid size.
1610+
If `err` is not present, exceptions trigger an `error stop`.
1611+
1612+
### Example
1613+
1614+
```fortran
1615+
{!example/linalg/example_mnorm.f90!}
1616+
```
15681617

0 commit comments

Comments
 (0)