Skip to content

Commit 72dc641

Browse files
committed
added specs
1 parent 79113da commit 72dc641

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

doc/specs/stdlib_intrinsics.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,42 @@ The output is a scalar of the same type and kind as to that of `x` and `y`.
155155

156156
```fortran
157157
{!example/intrinsics/example_dot_product.f90!}
158-
```
158+
```
159+
160+
### `stdlib_matmul` function
161+
162+
#### Description
163+
164+
The extension of the intrinsic function `matmul` to handle more than 2 and less than or equal to 5 matrices, with error handling using `linalg_state_type`.
165+
The optimal parenthesization to minimize the number of scalar multiplications is done using the Algorithm as outlined in Cormen, "Introduction to Algorithms", 4ed, ch-14, section-2.
166+
The actual matrix multiplication is performed using the `gemm` interfaces.
167+
It supports only `real` and `complex` matrices.
168+
169+
#### Syntax
170+
171+
`res = ` [[stdlib_intrinsics(module):stdlib_matmul(interface)]] ` (m1, m2, m3, m4, m5, err)`
172+
173+
#### Status
174+
175+
Experimental
176+
177+
#### Class
178+
179+
Function.
180+
181+
#### Argument(s)
182+
183+
`m1`, `m2`: 2D arrays of the same kind and type. `intent(in)` arguments.
184+
`m3`,`m4`,`m5`: 2D arrays of the same kind and type as the other matrices. `intent(in), optional` arguments.
185+
`err`: `type(linalg_state_type), intent(out), optional` argument. Can be used for elegant error handling. It is assigned `LINALG_VALUE_ERROR`
186+
in case the matrices are not of compatible sizes.
187+
188+
#### Result
189+
190+
The output is a matrix of the appropriate size.
191+
192+
#### Example
193+
194+
```fortran
195+
{!example/intrinsics/example_matmul.f90!}
196+
```

0 commit comments

Comments
 (0)