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

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

[Octave-bug-tracker] [bug #58215] sparse multiplication with Inf


From: Guillaume
Subject: [Octave-bug-tracker] [bug #58215] sparse multiplication with Inf
Date: Mon, 20 Apr 2020 11:40:48 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

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

                 Summary: sparse multiplication with Inf
                 Project: GNU Octave
            Submitted by: gyom
            Submitted on: Mon 20 Apr 2020 03:40:47 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Guillaume
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

After being surprised that output would differ because of matrix storage (but
where Matlab and Octave agree), I found a difference with Inf*sparse(0):
Matlab says sparse(NaN) while Octave says sparse(0).


octave:1> diag ([1, Inf]) * sparse ([1; 0])
ans =
Compressed Column Sparse (rows = 2, cols = 1, nnz = 1 [50%])
  (1, 1) -> 1

octave:2> diag ([1, Inf]) * full   ([1; 0])
ans =
     1
   NaN

octave:3> Inf * 0
ans = NaN

octave:4> Inf * sparse (0)
ans = Compressed Column Sparse (rows = 1, cols = 1, nnz = 0 [0%])

octave:5> Inf * sparse ([1; 0])
ans =
Compressed Column Sparse (rows = 2, cols = 1, nnz = 1 [50%])
  (1, 1) -> Inf


In Matlab:


>> diag ([1, Inf]) * sparse ([1; 0])
ans =
     1
     0

>> diag ([1, Inf]) * full   ([1; 0])
ans =
     1
   NaN

>> Inf * 0
ans =
   NaN

>> Inf * sparse (0)
ans =
   (1,1)      NaN

>> Inf * sparse ([1; 0])
ans =
   (1,1)      Inf
   (2,1)      NaN


Another difference highlighted with the first test is that full x sparse is
sparse in Octave and full in Matlab.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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