[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #46533] numel() returns negative values for la
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #46533] numel() returns negative values for large diagonal matrices |
Date: |
Wed, 25 Nov 2015 20:00:13 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0 |
URL:
<http://savannah.gnu.org/bugs/?46533>
Summary: numel() returns negative values for large diagonal
matrices
Project: GNU Octave
Submitted by: rik5
Submitted on: Wed 25 Nov 2015 12:00:05 PM PST
Category: Libraries
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
Sample code:
octave:2> x = eye (1e6, 1e6);
octave:3> typeinfo (x)
ans = diagonal matrix
octave:4> numel (x)
ans = -727379968
The problem is that the simple calculation of the number of elements is
rows*columns which is 1e12 in this example. The ordinary octave_idx_type is
2^31, or ~2e9, so the value rolls over into negative numbers.
Diagonal matrices are a sort of compressed, sparse implementation of a matrix.
Perhaps they should do what the existing sparse code does which is return an
error message.
octave:1> x = speye (1e6,1e6);
octave:2> numel (x)
error: out of memory or dimension too large for Octave's index type
See the related bug #42425.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?46533>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #46533] numel() returns negative values for large diagonal matrices,
Rik <=