Version française
Home     About     Download     Resources     Contact us    
Browse thread
Multiplication of matrix in C and OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: ls-ocaml-developer-2006@m...
Subject: Re: [Caml-list] Multiplication of matrix in C and OCaml


Andrej Bauer <Andrej.Bauer@fmf.uni-lj.si> writes:

> I hate to add to this long discussion, but since when is floating
> point multiplication associative?
>
> # 1.3 *. (0.7 *. 2.1) = (1.3 *. 0.7) *. 2.1 ;;
> - : bool = false

Which just means, that "testing assoicativity" wouldn't work as a
benchmark. Still I think the compiler (GCC) might take the license to
optimize (a * b) *c == a * (b * c) to false with -O3. Gcc 4.1 is
optimizing pretty aggressivly (yes even to the extend of doubtful,
sometimes simply wrong semantics) AFAIK.

> The suggestion that the results be tested for validity by checking the
> associative law of multipliciation won't worky very well, and neither
> will commutativity. In this case, instead of checking that A = B
> holds, it's better to output the difference between A and B (in case A
> and B are matrices, output the sup norm of the difference to keep it
> down to a single number).

:-) But wasn't I/O what Maxim wanted to avoid in a benchmark?

Regards -- Markus