[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bit equivalent matrix multiplication in oct/mex files

From: Jordi Gutiérrez Hermoso
Subject: Re: Bit equivalent matrix multiplication in oct/mex files
Date: Thu, 16 Feb 2012 08:40:27 -0500

On 16 February 2012 08:19, Henry Gomersall <address@hidden> wrote:
> I'm writing an optimised inner loop in C++ using the oct interface.
> As part of the loop I need to do a small 2x2 matrix-vector
> multiplication.
> Initially I hand coded this matrix-vector multiplication as a series of
> multiplication and additions. What I noticed was that this was not
> bit-equivalent to Octave performing the same operation, which is not
> wholly unexpected.

As you have surmised, Octave does not perform this computation, but
instead uses DGEMV from BLAS:

So whatever result you are seeing depends on whatever the BLAS
implementation you're using does. Likewise, Matlab also does whatever
the BLAS implementation does. If you want to know more, you will have
to inspect the source code for both of those. Hopefully it's available
to you.

> Pulling in a BLAS library to do a 2x2 matrix multiplication seems like
> overkill to me.

If you're using either Octave or Matlab, you're already using a BLAS,
so the overkill has already been done.

- Jordi G. H.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]