▪ You can make an assignment like
t[[spec]]=value
to modify any part or sequence of parts in an expression.▪ If
expr
is aSparseArray
object,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[...]]
.▪
Part
extracts specified parts of the array represented by aSparseArray
object, rather than parts of theSparseArray
expression 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