[Haskell-cafe] Fwd: Fwd: Re: the state of Yarr?

Dominic Steinitz dominic at steinitz.org
Thu Jan 7 07:51:29 UTC 2016

Hi Petr,

It's not too hard to write an inverse for matrices

> inv :: (KnownNat n, (1 <=? n) ~ 'True) => Sq n -> Sq n
> inv m = fromJust $ linSolve m eye
But since hmatrix is LAPACK this is not going to help you with GF(2).

I wasn't aware of the 'tensor' package either but it does contain some 
interesting ideas and by the looks of it should be able to invert 
matrices even for finite fields. I'd be interested in its performance. 
Perhaps you could write a benchmark and I can try it with Yarr?

Probably one could improve 'tensor' by using type level literals a la 
the static part of hmatrix and maybe base it over Yarr for performance. 
I note it is GPL which I am not a great fan of and has no publicy 
available repository (at least I wasn't able to find one).

Good luck and please report back with anything interesting you discover 
on your journey.


On 06/01/2016 20:12, Petr Pudlák wrote:
> Hi Dominic,
> thank you for the detailed answer! I'm looking for linear algebra over 
> finite fields (in particular GF(2)), and while hmatrix has some 
> support, it doesn't support inverting matrices, which is something I 
> need. So I'll need to look further. Just a moment ago I discovered the 
> 'tensor' package, which is flexible enough to add a new 
> representation. Currently it offers Vector, I'll try it out, and 
> perhaps it'd be possible to include yarr too, if Vector won't perform 
> well enough.
> All the best,
> Petr
> st 6. 1. 2016 v 10:50 odesílatel Dominic Steinitz 
> <dominic at steinitz.org <mailto:dominic at steinitz.org>> napsal:
>     A problem with my email prevented this making it on to the mailing
>     list.
>     Hi Petr,
>     I am not actively developing Yarr but I would very much like to. I
>     keep
>     it from bit-rotting. The problem as always is finding time. On the
>     other
>     hand I don't think repa is very active e.g. upgrading to vector-0.11
>     took a while to happen although clearly more active than me on Yarr!
>     What I'd like is something like Python's numpy but safer and
>     faster. If
>     you look at the static module in the hmatrix package
>     (https://hackage.haskell.org/package/hmatrix-
>     you can see how type level literals can be used to prevent e.g.
>     multiplying two inconsistent matrices together at compile time. I am
>     sure we could do something better with either Yarr or repa (repa will
>     currently give out of bounds errors at runtime).
>     For reasons I don't understand (I think a bug in Haddock) the
>     documentation does not get generated.
>     There are examples of its use here:
>     https://github.com/leventov/yarr/tree/master/tests. I wrote a blog
>     using
>     repa and Yarr here:
>     https://idontgetoutmuch.wordpress.com/2013/08/06/planetary-simulation-with-excursions-in-symplectic-manifolds-6/
>     and compare performance. You can safely ignore the theory and need
>     only
>     look at "Repa Implementation", "Yarr Implementation" and
>     "Performance".
>     I think performance will depend on your application. I believe (but
>     haven't confirmed) that repa will outperform Yarr on e.g grid based
>     problems such as numerical methods for diffusions and Poisson. In the
>     case of planets (or stars or particles) where everything is influenced
>     by everything else then repa is a bad fit and Yarr outperforms.
>     If your application is linear algebra, I would think that hmatrix
>     would
>     have what you want or could be extended to give what you want since it
>     is LAPACK under the covers.
>     I am very excited that you are interested in this area; it often feels
>     very lonely.
>     Best wishes, Dominic.
>     On 06/01/2016 09:10, Petr Pudlák wrote:
>     > Hi Dominic,
>     >
>     > what is the current state of Yarr? Is it being actively
>     developed? Is
>     > there some tutorial or documentation available?
>     >
>     > I'm deciding between repa and yarr for some linear algebra
>     > computations. I found some references that yarr is more performant,
>     > but I couldn't find much documentation and the hackage page [1]
>     hasn't
>     > indexed most modules for some reason, so there seems to be no good
>     > place to start from. And the last commit was 9 months ago.
>     >
>     > [1]https://hackage.haskell.org/package/yarr
>     >
>     > Thank you,
>     > Petr
>     _______________________________________________
>     Haskell-Cafe mailing list
>     Haskell-Cafe at haskell.org <mailto:Haskell-Cafe at haskell.org>
>     http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160107/bca3d9de/attachment.html>

More information about the Haskell-Cafe mailing list