octave-maintainers
[Top][All Lists]
Advanced

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

Re: 2x2 orthogonal matrix multiplication error


From: Marco Atzeri
Subject: Re: 2x2 orthogonal matrix multiplication error
Date: Mon, 15 Dec 2014 12:12:24 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 12/15/2014 6:04 AM, s.jo wrote:
Hello all,

In octave(3.8.2), 2x2 orthogonal matrix M shows numerical error after
multiplied by own transpose.

Say,
    M*M' is not equal to eye(2)!

There are errors in off-diagonal entries.
But, if we try it with element-wise multiplication, it works well.

Say,
Mt = M';
[Mt(1, :) * M(:, 1), Mt(1, :) * M(:, 2); Mt(2, :) * M(:, 1), Mt(2, :) * M(:,
2)] is equal to eye(2)!!

I check this also with matlab, but it works well.
I suspect that octave has some unreliable routine with
matrix-multiplication.
Or, is this only problem with my cygwin machine?

Hi s.jo,
Is it your own build or my cygwin package ?

I can not replicate with my package.
If is your own build please configure with
  --enable-float-truncate

see also
https://savannah.gnu.org/bugs/?func=detailitem&item_id=35024

I also try it with the complex rotation matrix (say Hermittian 2x2 matrix).
It also fails.
I generate rotation matrix with cos and sin functions:

M = [cs sn; -sn' cs']

The following script shows these result.

the script should be attached.
Copy and past from your output is time wasting to replicate.


Such matrix orthogonality easily fails with large size matrix due to
numerical errors.
But 2x2 matrix is so small. It should work always with such orthogonality
like matlab do, I guess.

Can somebody help this how it figure out?

Many thanks,

jo

attached your test script.
And here below my output on 32bit.
64 bit output is similar

ans = 3.8.2
cs =  0.65235
sn =  0.73407 + 0.18862i
M =

   0.65235 + 0.00000i   0.73407 + 0.18862i
  -0.73407 + 0.18862i   0.65235 + 0.00000i

ans = 0
ans =

   1.00000   0.00000
   0.00000   1.00000

ans =

   1.00000   0.00000
   0.00000   1.00000

ans =

   1.00000   0.00000

ans =

   0.00000   1.00000

ans =

   1.00000
   0.00000

ans =

   0.00000
   1.00000

ans =

   1.00000   0.00000
   0.00000   1.00000

cs =  0.37938
sn = -0.92524
M =

   0.37938  -0.92524
   0.92524   0.37938

ans =  1
ans =

   1   0
   0   1

ans =

   1   0
   0   1

ans =

   1   0

ans =

   0   1

ans =

   1
   0
ans =

   0
   1

ans =

   1   0
   0   1




Attachment: test_complex_mat.m
Description: Text document


reply via email to

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