bugGNU Octave - Bugs: bug #51650, Unclear warning issued for left...

 
 

bug #51650: Unclear warning issued for left division of scalar_integer_type \ matrix_data_type

Submitter:  Ernst Reissner <ernstreissner>
Submitted:  Thu 03 Aug 2017 10:12:44 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 07 Aug 2017 03:27:53 PM UTC, comment #5: 

Re-titling bug report.  For this report, the problem is that a very unclear error message is printed for scalar_integer_type \ matrix_data_type operations.

For the other issue I filed a new bug report at bug #51682.

Rik <rik5>
Group administrator
Mon 07 Aug 2017 09:26:47 AM UTC, comment #4: 

yes, you are right, int64 is just an example.
I also agree, that the errors like
binary operator '\' not implemented for 'int8 matrix' by 'scalar' operations

are fully satisfactory.
As you say, the issue is the message for
scalar_integer_type \ matrix_data_type

The second issue is something different,
I think we need another bug report for this.
My point was the first one:
the bad error message "octave_base_value:: wrong type argument"
for scalar_integer_type \ matrix_data_type

Ernst Reissner <ernstreissner>
Fri 04 Aug 2017 11:38:26 PM UTC, comment #3: 

It's not just int64 matrices.  The left-division operator isn't implemented for any of the integer types.  For example,


octave:8> c = int8 ([1 0; 1 1]);
octave:9> c \ 1
error: binary operator '\' not implemented for 'int8 matrix' by 'scalar' operations
octave:9> c \ c
error: binary operator '\' not implemented for 'int8 matrix' by 'int8 matrix' operations


You can see that the error messages are reasonably precise about what is going on.  Of course, for a scalar Octave could actually do this one piece of linear algebra.  But is it worth it?  Most likely not.  In order to implement the operator Octave needs to generate functions and prototypes of each function for the C++ compiler that connect a known data type to every other data type.  So there would be a routine for int8 \ int64, one for uint32 \ int16, another for uint8 \ int16, etc.  This quickly gets out of control.

But there certainly is an issue with this particular operation


scalar_integer_type \ matrix_data_type


Instead of issuing a warning, as above, for "binary operator '\' not implemented", Octave issues the very unhelpful "octave_base_value:: wrong type argument".

The second issue, is that if the initial value is a floating point type such as a single or double then the operation proceeds, but gets the wrong answer (scalar vs. matrix).  Using the matrix c defined above.


octave:23> 2 \ c
ans =  0.50000
octave:24> 2 \ double (c)
ans =

   0.50000   0.00000
   0.50000   0.50000




Rik <rik5>
Group administrator
Fri 04 Aug 2017 08:30:03 AM UTC, comment #2: 

Ceral, this is not the answer to my question:
It is not allowed to divide by something but a scalar.
But if you do that, you may write

b/int64(1) or int64(1)\b

which shall be equivalent.
BUT IT IS NOT!
This is the bug.

What you write about b\int64(1) is another point.

Ernst Reissner <ernstreissner>
Thu 03 Aug 2017 05:17:03 PM UTC, comment #1: 

MATLAB 2016a

>> b/int64(1)
ans =
                    1                    0
                    1                    1
>> b\int64(1)
Error using  \
Linear algebra is not supported for integer data types.
To compute elementwise LDIVIDE, use LDIVIDE (.\) instead.


Ceral Paquet <octavebugs>
Thu 03 Aug 2017 10:12:44 AM UTC, original submission:  

For
b=int64([1 0; 1 1])
the expression b/int64(1) is valid,
whereas int64(1)\b
yields
error: octave_base_value::int64_scalar_value(): wrong type argument 'int64 matrix'


Ernst Reissner <ernstreissner>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by octavebugs (Posted a comment)
  • -email is unavailable- added by ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-07 rik5 Item GroupUnexpected Error or Warning Missed Error or Warning
        Summaryleft-division operator not implemented for integer data types Unclear warning issued for left division of scalar_integer_type \ matrix_data_type
    2017-08-07 rik5 Dependencies- bugs #51682 is dependent
    2017-08-04 rik5 StatusNone Confirmed
        Summaryb\int64(1) vs b/int64(1) left-division operator not implemented for integer data types
    2017-08-03 ernstreissner Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code