[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #55249] function ones does not always return a
From: |
Anders Lennartsson |
Subject: |
[Octave-bug-tracker] [bug #55249] function ones does not always return a valid matrix |
Date: |
Wed, 19 Dec 2018 17:40:36 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36 |
URL:
<https://savannah.gnu.org/bugs/?55249>
Summary: function ones does not always return a valid matrix
Project: GNU Octave
Submitted by: andersbertil
Submitted on: Wed 19 Dec 2018 10:40:35 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Unexpected Error
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.1
Operating System: GNU/Linux
_______________________________________________________
Details:
The function ones seems to return an object which is not always a matrix.
With Octave 4.4.1-2~bpo9+1 running on Debian I can recreate the problem as
follows:
a=linspace(-2,2,6)
b=ones(length(a),1)
c=ones(1,length(a))
d=[1 1 1 1 1 1]
ff=zeros(1,length(a))
Everything looks fine, but checking the variables with an extended version of
paramdemo.cc, it turns out that c is not a matrix although a, b, d and ff
passes the test.
The code for paramdemo.cc is attached as a file. It was compiled with gcc
6.3.0 on Debian stretch by mkoctfile paramdemo.cc
Output for the 4 variables that are matrices is
Number of input arguments : 1
Number of output arguments : 0
Argument is of type numeric.
Argument is a matrix.
Argument number of dimensions are : 2
Dimension 0 is : 1
Dimension 1 is : 6
Number of ones : 1
Chopping trailing singletons.
Argument number of dimensions are : 2
Number of ones : 1
Chopping all singletons.
Argument number of dimensions are : 2
Number of ones : 1
Dimension 0 is : 6
Dimension 1 is : 1
vector length is 6.
Argument is vector: 1
Argument length: 2
Argument num_ones: 1
real matrix
vector length is 6.
Argument is vector: 1
Argument length: 2
Argument num_ones: 1
Properties of input array:
includes only int, Inf or NaN values
includes only integers in [-10,10]
while output for the variable c is
Number of input arguments : 1
Number of output arguments : 0
Argument is of type numeric.
Properties of input array:
includes only int, Inf or NaN values
includes only integers in [-10,10]
If c is added to zeros(1,length(a)) the result passes the test.
As I do not see any use case for this behaviour, it seems this is a bug.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Wed 19 Dec 2018 10:40:35 PM UTC Name: paramdemo.cc Size: 4KiB By:
andersbertil
<http://savannah.gnu.org/bugs/download.php?file_id=45701>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?55249>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #55249] function ones does not always return a valid matrix,
Anders Lennartsson <=