diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-06-10 23:31:59 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-06-10 23:32:08 +0200 |
commit | 42b8c69a978b54001aeae62c8c37ce80500d6428 (patch) | |
tree | 2318a443fe2cd659cc432dbc6d7c53e8206ac4e8 /src/Data/Array/Nested/Internal/Shaped.hs | |
parent | 5f6a64660b16d8f188caca5216e55debf4264611 (diff) |
Add (temporary version of) more general mdot
Diffstat (limited to 'src/Data/Array/Nested/Internal/Shaped.hs')
-rw-r--r-- | src/Data/Array/Nested/Internal/Shaped.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs index 1855015..e453e51 100644 --- a/src/Data/Array/Nested/Internal/Shaped.hs +++ b/src/Data/Array/Nested/Internal/Shaped.hs @@ -386,7 +386,12 @@ sminIndexPrim sarr@(Shaped arr) = ixCvtXS (sshape (stoPrimitive sarr)) (mminInde smaxIndexPrim :: (PrimElt a, NumElt a) => Shaped sh a -> IIxS sh smaxIndexPrim sarr@(Shaped arr) = ixCvtXS (sshape (stoPrimitive sarr)) (mmaxIndexPrim arr) -sdot :: (PrimElt a, NumElt a) => Shaped '[n] a -> Shaped '[n] a -> a +sdot1 :: (PrimElt a, NumElt a) => Shaped '[n] a -> Shaped '[n] a -> a +sdot1 = coerce mdot1 + +-- | This has a temporary, suboptimal implementation in terms of 'mflatten'. +-- Prefer 'sdot1' if applicable. +sdot :: (PrimElt a, NumElt a) => Shaped sh a -> Shaped sh a -> a sdot = coerce mdot stoXArrayPrimP :: Shaped sh (Primitive a) -> (ShS sh, XArray (MapJust sh) a) |