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

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

[Octave-bug-tracker] [bug #61728] inv: more consistent messages on inval


From: A.R. Burgers
Subject: [Octave-bug-tracker] [bug #61728] inv: more consistent messages on invalid input
Date: Sat, 25 Dec 2021 17:35:56 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62

URL:
  <https://savannah.gnu.org/bugs/?61728>

                 Summary: inv: more consistent messages on invalid input
                 Project: GNU Octave
            Submitted by: arb
            Submitted on: Sat 25 Dec 2021 10:35:54 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

dev's inv function produces this for invalid input:


octave:1> inv({})
ans = [](0x0)
octave:2> inv({2})
error: inv: wrong type argument 'cell'
octave:4> inv('a')
error: invalid conversion from string to real matrix
octave:3> inv([])
ans = [](0x0)


matlab produces this:

inv({})
Error using inv
Invalid data type. Input matrix must be double or single.

inv({2})
Error using inv
Invalid data type. Input matrix must be double or single.
        
inv('a')
Error using inv
Invalid data type. Input matrix must be double or single.
        
inv([])
ans =[]


The different octave messaging happens because invalid input is processed as
numerical data is until an error is encountered, which happens at different
stages for different types of input. The attached patch does a check on
invalid input at the start of the function. Came across this when looking
closer at bug #61689.
All inv tests are passed with this modification. Still allows integral data
(int/uint/bool), which matlab doesn't.

with the attached patch octave produces this:


octave:2> inv({})
error: inv: wrong type argument 'cell'
octave:3> inv({2})
error: inv: wrong type argument 'cell'
octave:4> inv('a')
error: inv: wrong type argument 'sq_string'
octave:5> inv([])
ans = [](0x0)





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sat 25 Dec 2021 10:35:54 PM UTC  Name: inv.txt  Size: 1KiB   By: arb

<http://savannah.gnu.org/bugs/download.php?file_id=52567>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61728>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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