apl: outer product ∘.f (+12 tests, 151/151)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 53s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 53s
This commit is contained in:
@@ -996,3 +996,23 @@
|
||||
(get a :ravel)
|
||||
(get b :ravel)))
|
||||
(error "length error: shape mismatch"))))))
|
||||
|
||||
(define
|
||||
apl-outer
|
||||
(fn
|
||||
(f a b)
|
||||
(let
|
||||
((a-shape (get a :shape))
|
||||
(b-shape (get b :shape))
|
||||
(a-ravel (get a :ravel))
|
||||
(b-ravel (get b :ravel)))
|
||||
(make-array
|
||||
(append a-shape b-shape)
|
||||
(flatten
|
||||
(map
|
||||
(fn
|
||||
(x)
|
||||
(map
|
||||
(fn (y) (disclose (f (apl-scalar x) (apl-scalar y))))
|
||||
b-ravel))
|
||||
a-ravel))))))
|
||||
|
||||
Reference in New Issue
Block a user