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

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

[Octave-bug-tracker] [bug #66514] spdiags does not "broadcast" elements


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #66514] spdiags does not "broadcast" elements over selected diagonals
Date: Tue, 3 Dec 2024 07:35:41 -0500 (EST)

Update of bug #66514 (group octave):

                  Status:                    None => Confirmed
        Operating System:       Microsoft Windows => Any
                 Summary: spdiags does not match one matlab on-line help
example => spdiags does not "broadcast" elements over selected diagonals

    _______________________________________________________

Follow-up Comment #1:

The output of the original code snippet in Matlab R2024a:

>> n=9; A = spdiags ([1 2 3], -1:1, n, n); full (A)

ans =

     2     3     0     0     0     0     0     0     0
     1     2     3     0     0     0     0     0     0
     0     1     2     3     0     0     0     0     0
     0     0     1     2     3     0     0     0     0
     0     0     0     1     2     3     0     0     0
     0     0     0     0     1     2     3     0     0
     0     0     0     0     0     1     2     3     0
     0     0     0     0     0     0     1     2     3
     0     0     0     0     0     0     0     1     2

>> 



To put it in words: Matlab seems to "broadcast" elements of a row vector in
the first argument to the diagonals that are selected in the second argument
of `spdiag` if it is called with four input arguments.

Same for the three-input-argument form of `spdiag`.
In Matlab R2024a:

>> n=9; Z = sparse (n, n); A = spdiags ([1 2 3], -1:1, Z); full (A)

ans =

     2     3     0     0     0     0     0     0     0
     1     2     3     0     0     0     0     0     0
     0     1     2     3     0     0     0     0     0
     0     0     1     2     3     0     0     0     0
     0     0     0     1     2     3     0     0     0
     0     0     0     0     1     2     3     0     0
     0     0     0     0     0     1     2     3     0
     0     0     0     0     0     0     1     2     3
     0     0     0     0     0     0     0     1     2

>> 


Since this would change behavior of Octave, any change should go to the
default branch.



    _______________________________________________________

Reply to this item at:

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

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

Attachment: signature.asc
Description: PGP signature


reply via email to

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