Closed shoooe closed 8 years ago
Applicative I can see, although it would have to be a partial function because it will only work on matricies of the same dimensions.
I don't see a monad instance because how would one concatenate matricies in a sane way.
I'd say >> ~ Tensor Product,
As far as concatenation
Monoid a => Monoid (Matrix a) Pointwise mappend
I'd say >> ~ Tensor Product,
I'm not familiar with that operation so I can't really say if that makes sense or not.
Monoid a => Monoid (Matrix a) Pointwise mappend
makes sense, for different sized matrices we could just <> mempty.
http://www.sharetechnote.com/image/EngMath_TensorProduct_01.png
Similar to how list does >>, but makes sense in 2D
What happens if the matrices are differently sized? Would they just be mempty?
I plan to at least write the monoid instance in a few minutes and the tensor product if I can figure it out.
its a_ii * B, dimensions dont matter for tensor
On Wed, Jan 20, 2016 at 3:52 PM, Chris Denniston notifications@github.com wrote:
I plan to at least write the monoid instance in a few minutes and the tensor product if I can figure it out.
— Reply to this email directly or view it on GitHub https://github.com/Daniel-Diaz/matrix/issues/17#issuecomment-173372513.
ohh i see that now
The problem being that applicative is a requirement for monad. Maybe we can work backwards from <*> being ap?
would applicative just be tensor multiplication but instead of multiplication be function application?
I guess we can close this now, right?
I suppose once the PR gets merged but we should probably take our commentary there.
Closing this. See https://github.com/Daniel-Diaz/matrix/pull/27
Sounds like a
Matrix a
is a perfect fit for anApplicative
(and possibly evenMonad
) instance.Data.Vector
also has such instances, and given that the former is implemented in terms of the latter, the actual implementation of these instances should be trivial.What am I missing?