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

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

[Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions
Date: Thu, 27 Oct 2022 14:42:12 -0400 (EDT)

Follow-up Comment #6, bug #63281 (project octave):

r2022b

>> A = sprand (10, 10, 0.1)

A =

   (2,1)       0.6551
   (1,2)       0.7547
   (1,4)       0.2760
   (7,5)       0.4984
   (8,5)       0.9597
   (9,5)       0.3404
   (4,7)       0.1190
   (1,8)       0.6797
   (3,8)       0.1626
  (10,8)       0.5853

>> x = 1

x =

     1

>> A + x

ans =

  Columns 1 through 9

    1.0000    1.7547    1.0000    1.2760    1.0000    1.0000    1.0000   
1.6797    1.0000
    1.6551    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000   
1.0000    1.0000
    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000   
1.1626    1.0000
    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.1190   
1.0000    1.0000
    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000   
1.0000    1.0000
    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000   
1.0000    1.0000
    1.0000    1.0000    1.0000    1.0000    1.4984    1.0000    1.0000   
1.0000    1.0000
    1.0000    1.0000    1.0000    1.0000    1.9597    1.0000    1.0000   
1.0000    1.0000
    1.0000    1.0000    1.0000    1.0000    1.3404    1.0000    1.0000   
1.0000    1.0000
    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000   
1.5853    1.0000

  Column 10

    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000

>> sx = sparse (x)

sx =

   (1,1)        1

>> A + sx

ans =

   (1,1)       1.0000
   (2,1)       1.6551
   (3,1)       1.0000
   (4,1)       1.0000
   (5,1)       1.0000
   (6,1)       1.0000
   (7,1)       1.0000
   (8,1)       1.0000
   (9,1)       1.0000
  (10,1)       1.0000
   (1,2)       1.7547
   (2,2)       1.0000
   (3,2)       1.0000
   (4,2)       1.0000
   (5,2)       1.0000
   (6,2)       1.0000
   (7,2)       1.0000
   (8,2)       1.0000
   (9,2)       1.0000
  (10,2)       1.0000
   (1,3)       1.0000
   (2,3)       1.0000
   (3,3)       1.0000
   (4,3)       1.0000
   (5,3)       1.0000
   (6,3)       1.0000
   (7,3)       1.0000
   (8,3)       1.0000
   (9,3)       1.0000
  (10,3)       1.0000
   (1,4)       1.2760
   (2,4)       1.0000
   (3,4)       1.0000
   (4,4)       1.0000
   (5,4)       1.0000
   (6,4)       1.0000
   (7,4)       1.0000
   (8,4)       1.0000
   (9,4)       1.0000
  (10,4)       1.0000
   (1,5)       1.0000
   (2,5)       1.0000
   (3,5)       1.0000
   (4,5)       1.0000
   (5,5)       1.0000
   (6,5)       1.0000
   (7,5)       1.4984
   (8,5)       1.9597
   (9,5)       1.3404
  (10,5)       1.0000
   (1,6)       1.0000
   (2,6)       1.0000
   (3,6)       1.0000
   (4,6)       1.0000
   (5,6)       1.0000
   (6,6)       1.0000
   (7,6)       1.0000
   (8,6)       1.0000
   (9,6)       1.0000
  (10,6)       1.0000
   (1,7)       1.0000
   (2,7)       1.0000
   (3,7)       1.0000
   (4,7)       1.1190
   (5,7)       1.0000
   (6,7)       1.0000
   (7,7)       1.0000
   (8,7)       1.0000
   (9,7)       1.0000
  (10,7)       1.0000
   (1,8)       1.6797
   (2,8)       1.0000
   (3,8)       1.1626
   (4,8)       1.0000
   (5,8)       1.0000
   (6,8)       1.0000
   (7,8)       1.0000
   (8,8)       1.0000
   (9,8)       1.0000
  (10,8)       1.5853
   (1,9)       1.0000
   (2,9)       1.0000
   (3,9)       1.0000
   (4,9)       1.0000
   (5,9)       1.0000
   (6,9)       1.0000
   (7,9)       1.0000
   (8,9)       1.0000
   (9,9)       1.0000
  (10,9)       1.0000
   (1,10)      1.0000
   (2,10)      1.0000
   (3,10)      1.0000
   (4,10)      1.0000
   (5,10)      1.0000
   (6,10)      1.0000
   (7,10)      1.0000
   (8,10)      1.0000
   (9,10)      1.0000
  (10,10)      1.0000

>> r = 1:10

r =

     1     2     3     4     5     6     7     8     9    10

>> A + r

ans =

  Columns 1 through 9

    1.0000    2.7547    3.0000    4.2760    5.0000    6.0000    7.0000   
8.6797    9.0000
    1.6551    2.0000    3.0000    4.0000    5.0000    6.0000    7.0000   
8.0000    9.0000
    1.0000    2.0000    3.0000    4.0000    5.0000    6.0000    7.0000   
8.1626    9.0000
    1.0000    2.0000    3.0000    4.0000    5.0000    6.0000    7.1190   
8.0000    9.0000
    1.0000    2.0000    3.0000    4.0000    5.0000    6.0000    7.0000   
8.0000    9.0000
    1.0000    2.0000    3.0000    4.0000    5.0000    6.0000    7.0000   
8.0000    9.0000
    1.0000    2.0000    3.0000    4.0000    5.4984    6.0000    7.0000   
8.0000    9.0000
    1.0000    2.0000    3.0000    4.0000    5.9597    6.0000    7.0000   
8.0000    9.0000
    1.0000    2.0000    3.0000    4.0000    5.3404    6.0000    7.0000   
8.0000    9.0000
    1.0000    2.0000    3.0000    4.0000    5.0000    6.0000    7.0000   
8.5853    9.0000

  Column 10

   10.0000
   10.0000
   10.0000
   10.0000
   10.0000
   10.0000
   10.0000
   10.0000
   10.0000
   10.0000

>> sr = sparse (r)

sr =

   (1,1)        1
   (1,2)        2
   (1,3)        3
   (1,4)        4
   (1,5)        5
   (1,6)        6
   (1,7)        7
   (1,8)        8
   (1,9)        9
   (1,10)      10

>> A + sr

ans =

   (1,1)       1.0000
   (2,1)       1.6551
   (3,1)       1.0000
   (4,1)       1.0000
   (5,1)       1.0000
   (6,1)       1.0000
   (7,1)       1.0000
   (8,1)       1.0000
   (9,1)       1.0000
  (10,1)       1.0000
   (1,2)       2.7547
   (2,2)       2.0000
   (3,2)       2.0000
   (4,2)       2.0000
   (5,2)       2.0000
   (6,2)       2.0000
   (7,2)       2.0000
   (8,2)       2.0000
   (9,2)       2.0000
  (10,2)       2.0000
   (1,3)       3.0000
   (2,3)       3.0000
   (3,3)       3.0000
   (4,3)       3.0000
   (5,3)       3.0000
   (6,3)       3.0000
   (7,3)       3.0000
   (8,3)       3.0000
   (9,3)       3.0000
  (10,3)       3.0000
   (1,4)       4.2760
   (2,4)       4.0000
   (3,4)       4.0000
   (4,4)       4.0000
   (5,4)       4.0000
   (6,4)       4.0000
   (7,4)       4.0000
   (8,4)       4.0000
   (9,4)       4.0000
  (10,4)       4.0000
   (1,5)       5.0000
   (2,5)       5.0000
   (3,5)       5.0000
   (4,5)       5.0000
   (5,5)       5.0000
   (6,5)       5.0000
   (7,5)       5.4984
   (8,5)       5.9597
   (9,5)       5.3404
  (10,5)       5.0000
   (1,6)       6.0000
   (2,6)       6.0000
   (3,6)       6.0000
   (4,6)       6.0000
   (5,6)       6.0000
   (6,6)       6.0000
   (7,6)       6.0000
   (8,6)       6.0000
   (9,6)       6.0000
  (10,6)       6.0000
   (1,7)       7.0000
   (2,7)       7.0000
   (3,7)       7.0000
   (4,7)       7.1190
   (5,7)       7.0000
   (6,7)       7.0000
   (7,7)       7.0000
   (8,7)       7.0000
   (9,7)       7.0000
  (10,7)       7.0000
   (1,8)       8.6797
   (2,8)       8.0000
   (3,8)       8.1626
   (4,8)       8.0000
   (5,8)       8.0000
   (6,8)       8.0000
   (7,8)       8.0000
   (8,8)       8.0000
   (9,8)       8.0000
  (10,8)       8.5853
   (1,9)       9.0000
   (2,9)       9.0000
   (3,9)       9.0000
   (4,9)       9.0000
   (5,9)       9.0000
   (6,9)       9.0000
   (7,9)       9.0000
   (8,9)       9.0000
   (9,9)       9.0000
  (10,9)       9.0000
   (1,10)     10.0000
   (2,10)     10.0000
   (3,10)     10.0000
   (4,10)     10.0000
   (5,10)     10.0000
   (6,10)     10.0000
   (7,10)     10.0000
   (8,10)     10.0000
   (9,10)     10.0000
  (10,10)     10.0000



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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