Skip to content

Commit 03b2dc3

Browse files
committed
Added specs documentation.
1 parent 58abf5f commit 03b2dc3

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

doc/specs/stdlib_linalg.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,41 @@ program demo_trace
168168
print *, trace(A) ! 1 + 5 + 9
169169
end program demo_trace
170170
```
171+
172+
## `outer_product` - Computes the outer product of two vectors
173+
174+
### Status
175+
176+
Experimental
177+
178+
### Description
179+
180+
Create a diagonal array or extract the diagonal elements of an array
181+
182+
### Syntax
183+
184+
`d = [[stdlib_linalg(module):outer_product(interface)]](u, v)`
185+
186+
### Arguments
187+
188+
`u`: Shall be a rank-1 array
189+
190+
`v`: Shall be a rank-1 array
191+
192+
### Return value
193+
194+
Returns a rank-2 array equal to `u v^T` (assuming `u, v` are column vectors). The dimensions of the returned array are `[size(u), size(v)]`
195+
196+
### Example
197+
198+
```fortran
199+
program demo_outer_product
200+
use stdlib_linalg, only: outer_product
201+
implicit none
202+
real, allocatable :: A(:,:), u(:), v(:)
203+
u = [1.,2.,3.]
204+
v = [3., 4.]
205+
A=outer_product(u,v)
206+
!A = transpose(reshape([3., 4., 6., 8., 9., 12.], [3,2]))
207+
end program demo_outer_product
208+
```

0 commit comments

Comments
 (0)