Skip to content

Commit 5e4490b

Browse files
author
Symbolics
committed
Document aops:outer
1 parent 3083425 commit 5e4490b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

content/en/docs/Manuals/array-operations.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,33 @@ finally, rotate it three times (270°):
510510
```
511511

512512

513+
### outer
514+
515+
**`outer`** is generalized outer product of arrays using a provided function.
516+
517+
Lambda list: `(function &rest arrays)`
518+
519+
The resulting array has the concatenated dimensions of arrays
520+
521+
The examples below return the [outer
522+
product](https://en.wikipedia.org/wiki/Outer_product) of vectors or arrays. This is the outer product you get in most linear algebra packages.
523+
524+
```lisp
525+
(defparameter a #(2 3 5))
526+
(defparameter b #(7 11))
527+
(defparameter c #2A((7 11)
528+
(13 17)))
529+
530+
(outer #'* a b)
531+
;#2A((14 22)
532+
; (21 33)
533+
; (35 55))
534+
535+
(outer #'* c a)
536+
;#3A(((14 21 35) (22 33 55))
537+
; ((26 39 65) (34 51 85)))
538+
```
539+
513540
## Indexing operations
514541

515542
### nested-loop

0 commit comments

Comments
 (0)