Patch applied!
I will also make the recommended changes in the Matrix type and prepare
some benchmarks for this kind of Haskell loops.
In fact, such excellent performance will also be very useful in image
processing algorithms which must read and write a large number of C
array elements. I n
Problem solved. The Haskell loop now wins.
> > After reading don's blog, I tried to make a test with both
> > methods. The code is very simple, as following
> >
> > module Main where
> > import System
> > import Numeric.LinearAlgebra
> >
> > vsum1 :: Vector Double -> Double
> > vsum1 v = const
Below are some notes on this for Simon PJ and Alberto.
In general, GHC is doing very well here, with only one small wibble preventing
the
recursive version running as fast as the C version.
xj2106:
> Alberto Ruiz <[EMAIL PROTECTED]> writes:
>
> > My experience is that Haskell allocation time i
Alberto Ruiz <[EMAIL PROTECTED]> writes:
> My experience is that Haskell allocation time is very fast and usually
> negligible in most non trivial matrix computations.
>
> A good thing about
>
> sum v = constant 1 (dim v) <.> v
>
> is that a constant vector is efficiently created internally (not f
Xiao-Yong Jin wrote:
Tomas Andersson <[EMAIL PROTECTED]> writes:
You can never go wrong with a good old fashioned hand written tail recursion
when you're in doubt, they are pretty much the closest thing to for-loops
there is in haskell and should be easy to grok for Imperative programmers and
xj2106:
> Tomas Andersson <[EMAIL PROTECTED]> writes:
>
> > You can never go wrong with a good old fashioned hand written tail
> > recursion
> > when you're in doubt, they are pretty much the closest thing to for-loops
> > there is in haskell and should be easy to grok for Imperative programme
Tomas Andersson <[EMAIL PROTECTED]> writes:
> You can never go wrong with a good old fashioned hand written tail recursion
> when you're in doubt, they are pretty much the closest thing to for-loops
> there is in haskell and should be easy to grok for Imperative programmers and
> usually produ
Den Sunday 08 June 2008 00.45.01 skrev Xiao-Yong Jin:
> Any delightful idea to convert my mind from a C shaped one
> to a Haskell shaped one?
>
You can never go wrong with a good old fashioned hand written tail recursion
when you're in doubt, they are pretty much the closest thing to for-loops
Hi, probably I am just being dumb, but what is the most
efficient way to do a sum of every elements in a Vector of
either hmatrix or blas? I know there is sum of absolute
values from BLAS. So what about I want a plain "sum"?
I can only think of the following two ways.
1. Using Data.List.foldl'