octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #51401] inv() function gives incorrect results


From: anonymous
Subject: [Octave-bug-tracker] [bug #51401] inv() function gives incorrect results, even for invertible 2x2 matrix
Date: Thu, 6 Jul 2017 06:51:31 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?51401>

                 Summary: inv() function gives incorrect results, even for
invertible 2x2 matrix
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Thu 06 Jul 2017 10:51:30 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: Harry
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.0
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

There is a clear bug in the inv() function, which I particularly see for
Hermitian matrices.

Example:

A = [1,1+1j;1-1j,3];

>> inv(A)
ans =

   3 + 0i  -1 - 1i
  -1 - 1i   1 + 0i

The correct answer should be:
ans =

   3 + 0i  -1 - 1i
  -1 + 1i   1 + 0i

(i.e. ans(2,1) is conjugated). Matlab gives the correct answer. Or for a 2x2
matrix, we can check it as:

detA = A(1,1)*A(2,2) - A(1,2)*A(2,1);
invA = [A(2,2),-A(1,2); -A(2,1),A(1,1)] / detA;




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51401>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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