Re: [racket] performance problem in math/matrix

2013-01-22 Thread Jens Axel Søgaard
2013/1/22 Berthold Bäuml : > On 22.01.2013, at 06:19, Neil Toronto wrote: >> On 01/21/2013 04:33 PM, Berthold Bäuml wrote: >>> For the latter it would be great if one could even change the used library >>> to, >>> e.g., redirect to a installation of the highly efficient MKL library from >>> In

Re: [racket] performance problem in math/matrix

2013-01-22 Thread Berthold Bäuml
On 22.01.2013, at 06:19, Neil Toronto wrote: > On 01/21/2013 04:33 PM, Berthold Bäuml wrote: >> >>> >>> I just did that. Here are the types: >>> >>> real-matrix* : (Array Real) (Array Real) -> (Array Real) >>> >>> flonum-matrix* : (Array Flonum) (Array Flonum) -> (Array Flonum) >>> >>> f

Re: [racket] performance problem in math/matrix

2013-01-21 Thread Neil Toronto
On 01/21/2013 04:33 PM, Berthold Bäuml wrote: I just did that. Here are the types: real-matrix* : (Array Real) (Array Real) -> (Array Real) flonum-matrix* : (Array Flonum) (Array Flonum) -> (Array Flonum) flmatrix* : FlArray FlArray -> FlArray Results so far, measured in DrRacket wit

Re: [racket] performance problem in math/matrix

2013-01-21 Thread Berthold Bäuml
> > I just did that. Here are the types: > > real-matrix* : (Array Real) (Array Real) -> (Array Real) > > flonum-matrix* : (Array Flonum) (Array Flonum) -> (Array Flonum) > > flmatrix* : FlArray FlArray -> FlArray > > Results so far, measured in DrRacket with debugging off: > > Function

Re: [racket] performance problem in math/matrix

2013-01-21 Thread Jens Axel Søgaard
2013/1/21 Tobias Hammer : > The attached patch should fix it. Thanks! /Jens Axel Racket Users list: http://lists.racket-lang.org/users

Re: [racket] performance problem in math/matrix

2013-01-21 Thread Tobias Hammer
The attached patch should fix it. Tobias On Sun, 20 Jan 2013 15:09:42 +0100, Jens Axel Søgaard wrote: Hi Berthold, 2013/1/20 Berthold Bäuml : I tried a little test with mildly large Flonum matrices using math/matrix in Typed Racket. Two 1000x1000 dimensional matrices should be multipli

Re: [racket] performance problem in math/matrix

2013-01-20 Thread Ray Racine
Recall that last. Always measure at the command line . I'm seeing FlVector at 30% faster. #lang typed/racket (provide main) (require racket/unsafe/ops racket/fixnum racket/flonum) (define-type NF Nonnegative-Fixnum) (: matrix* : FlVector FlVector Index Index Index -> FlVector

Re: [racket] performance problem in math/matrix

2013-01-20 Thread Ray Racine
Modification of the above to use FlVector did not show a difference. On Sun, Jan 20, 2013 at 2:35 PM, Jens Axel Søgaard wrote: > 2013/1/20 Berthold Bäuml : > >> Ah! The Numpy example uses floats and not doubles. > > > > On my machine Numpy says it is using float64, hence, double. > > big1.dtype

Re: [racket] performance problem in math/matrix

2013-01-20 Thread Jens Axel Søgaard
2013/1/20 Berthold Bäuml : >> Ah! The Numpy example uses floats and not doubles. > > On my machine Numpy says it is using float64, hence, double. > big1.dtype.name -> float64 Sorry for the confusion. I am used to the Racket documentation were float means single precision, so I misinterpreted the

Re: [racket] performance problem in math/matrix

2013-01-20 Thread Neil Toronto
On 01/20/2013 11:14 AM, Jens Axel Søgaard wrote: 2013/1/20 Berthold Bäuml : With the ffi-binding example from Jens (thank you!) I get for the 1000x1000 multiply 450ms -- only 2x slower than Mathematica or Numpy. So integrating such a binding in math/matrix looks promising. Huh? I am surprised

Re: [racket] performance problem in math/matrix

2013-01-20 Thread Berthold Bäuml
On 20.01.2013, at 19:14, Jens Axel Søgaard wrote: > 2013/1/20 Berthold Bäuml : > >> With the ffi-binding example from Jens (thank you!) I get for the 1000x1000 >> multiply 450ms -- only 2x slower than Mathematica or Numpy. So integrating >> such a binding in math/matrix looks promising. > > Hu

Re: [racket] performance problem in math/matrix

2013-01-20 Thread Jens Axel Søgaard
2013/1/20 Berthold Bäuml : > With the ffi-binding example from Jens (thank you!) I get for the 1000x1000 > multiply 450ms -- only 2x slower than Mathematica or Numpy. So integrating > such a binding in math/matrix looks promising. Huh? I am surprised it is twice as slow. Ah! The Numpy example us

Re: [racket] performance problem in math/matrix

2013-01-20 Thread Matthias Felleisen
On Jan 20, 2013, at 12:48 PM, Berthold Bäuml wrote: > Nevertheless, my original motivation for the little test was to get an > impression of what performance could be achieved in purely Typed Racket for > numerical algorithms. Would it in principle be possible to come close to pure > C-code pe

Re: [racket] performance problem in math/matrix

2013-01-20 Thread Berthold Bäuml
On 20.01.2013, at 18:09, Neil Toronto wrote: > On 01/20/2013 07:09 AM, Jens Axel Søgaard wrote: >> Hi Berthold, >> >> 2013/1/20 Berthold Bäuml : >>> I tried a little test with mildly large Flonum matrices using math/matrix >>> in Typed >>> Racket. Two 1000x1000 dimensional matrices should be m

Re: [racket] performance problem in math/matrix

2013-01-20 Thread Neil Toronto
On 01/20/2013 07:09 AM, Jens Axel Søgaard wrote: Hi Berthold, 2013/1/20 Berthold Bäuml : I tried a little test with mildly large Flonum matrices using math/matrix in Typed Racket. Two 1000x1000 dimensional matrices should be multiplied with (array- strictness #t). Running this in DrRacket resu

Re: [racket] performance problem in math/matrix

2013-01-20 Thread Tobias Hammer
On Sun, 20 Jan 2013 15:09:42 +0100, Jens Axel Søgaard wrote: Note: Disable "Populate "compiled" directories (for faster loading)" to run it in DrRacket. To disable: Choose the language menu. Choose the menu item "Choose language". Click the button "advanced". The