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

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

[Octave-bug-tracker] [bug #54781] Matrix creation functions (eye, rand,


From: Kai Torben Ohlhus
Subject: [Octave-bug-tracker] [bug #54781] Matrix creation functions (eye, rand, zeros, ...) allow invalid non-integer dimensions
Date: Thu, 4 Oct 2018 10:19:32 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36

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

                 Summary: Matrix creation functions (eye, rand, zeros, ...)
allow invalid non-integer dimensions
                 Project: GNU Octave
            Submitted by: siko1056
            Submitted on: Thu 04 Oct 2018 04:19:30 PM CEST
                Category: Interpreter
                Severity: 4 - Important
                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:

While fixing another bug, I received errors, because of potentially erroneous
test cases (maybe copy&paste errors from "sprand")
https://hg.savannah.gnu.org/hgweb/octave/file/20e294a607af/test/diag-perm.tst#l80


A = rand (n-3, n, .5);


Additionally, Octave does not error on the following statements, and silently
creates nonsense:


>> A = eye (0.5), size(A)
A = [](0x0)
ans =
   0   0

>> A = eye ([2, 0.5]), size(A)
A = [](2x0)
ans =
   2   0

>> A = eye (2, 0.5), size(A) # works!
error: eye: conversion of 0.5 to int64_t value failed


Similar for "zeros" and "ones" (only the first as example given below:


>> A = zeros (0.5), size(A)
A = [](0x0)
ans =
   0   0

>> A = zeros (2, 0.5), size(A)
A = [](2x0)
ans =
   2   0

>> A = zeros (2, 0.5, 4), size(A)
A = [](2x0x4)
ans =
   2   0   4






    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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