▪ You can make an assignment like
t[[spec]]=valueto modify any part or sequence of parts in an expression.▪ If
expris aSparseArrayobject,expr[[...]]gives the parts in the corresponding ordinary array.
▪ List and matrix operations are typically set up to work as they do on
Normal[SparseArray[...]].▪
Partextracts specified parts of the array represented by aSparseArrayobject, rather than parts of theSparseArrayexpression itself.
array = Range[10]
(* {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} *)
array[[2]] = Sequence[0, 0, 0];
array
(* {1, 0, 0, 0, 3, 4, 5, 6, 7, 8, 9, 10} *)
sparse = SparseArray[Range[10]];
sparse[[2]] = Sequence[0, 0, 0];
sparse[[2]]
(* {10} *)
ArrayRules[sparse]
(* ArrayRules::rect: Nonrectangular array encountered. >> *)
(* ArrayRules[SparseArray[Automatic, {10}, 0,
{1, {{0, 10}, {{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}}},
{1, 0, 0, 0, 3, 4, 5, 6, 7, 8, 9, 10}}]] *)
Is it a bug?
Comments
Post a Comment