POV-Ray : Newsgroups : povray.off-topic : Delphi : Re: Delphi Server Time
6 Sep 2024 23:20:03 EDT (-0400)
  Re: Delphi  
From: Orchid XP v8
Date: 21 Sep 2008 07:14:41
Message: <48d62ca1$1@news.povray.org>
>> If you want to write complex mathematical algorithms, or just something 
>> that involves lots of complex processing, Haskell is probably a good fit.
> 
>   One of the most demanding programming tasks in mathematical software is
> matrix handling.

That wasn't precisely what I meant by "complex processing". (I was 
thinking about tasks like parsing text files, chasing dependencies, 
implementing complex wire protocols, reading binary formats, etc.)

But sure, your statement seems valid to me.

> We are talking about *huge* matrices and their operations
> (such as multiplication or inverting) which the math program should handle
> as efficiently as possible (both memorywise and speedwise). Quite many
> mathematical tasks and other algorithms can be reduced to handling
> enormous matrices and their operations.
>   If I'm not mistaken, a more or less standard benchmark for math software
> is to measure how fast it can multiply and invert humongous matrices.
> 
>   How well does Haskell fit this? Can it be used to handle enormous
> matrices efficiently and perform operations to them as fast as possible?

Depends how you implement it.

There is a standard package called hmatrix that gives you a 
Haskell-style interface to the external LAPACK and GSL libraries. (By 
"Haskell-style", I mean the interface works in the customary style of 
Haskell, so it's more than just a thin veneer over the underlying C or 
whatever it is, and it plays nice with the rest of the language.) 
Presumably the speed of this is roughly the speed of the underlying 
libraries.

Haskell will soon be getting the so-called "Data Parallel Arrays" 
extension, that provides a trivial syntax for processing arrays in 
parallel. (Not in-place though.)

Haskell already has the ability to construct C-like arrays of basic 
types which are mutable in-place - although I doubt anything you or I 
could code by hand is going to compare to something like LAPACK which 
must have been optimised by half the PhDs on Earth by now.

If extreme numerical performance is your goal, 3rd party libraries are 
probably your best bet. (Presumably this goes for any programming 
language - other people are way smarter!) But it could be interesting to 
see how fast native Haskell is or isn't.

I had a look at the Great Language Shootout. The most math-heavy 
benchmark I could see is spectural-norm, which appears to use lots of 
matrix/vector multiplication. Fortran is fastest, C++ is 2.8% slower, 
and Haskell is 7.0% slower. Haskell also uses 64 KB more than C++ (=1% 
more).

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.