[Numpy-discussion] type of matrixmultiply result

Rick White rlw at stsci.edu
Thu Jun 24 07:32:10 EDT 2004


On 24 Jun 2004, Todd Miller wrote:

> On Thu, 2004-06-24 at 06:14, Curzio Basso wrote:
>
> > I noticed that when multiplying two matrices of type Float32, the result
> > is Float64:
>
> I modified dot() and innerproduct() this morning to return Float32 and
> Complex32 for like inputs.

I wonder whether it would be worth providing an option to accumulate
the sums using Float64 and to convert to Float32 before storing them in
an array.  I suspect that one reason this returned Float64 is that it
is very easy to run into precision/roundoff problems in
single-precision matrix multiplies.  You could avoid that by using
doubles for the sum while still returning the result as a single.
				Rick





More information about the NumPy-Discussion mailing list