How to modify the default value of a SparseArray? All of my ideas doesn't work, because of the ReadProtected attribute. Is there a string such that
mat = SparseArray[{}, {100, 100}]
mat["something"] = 1;
is a solution?
How to modify the default value of a SparseArray? All of my ideas doesn't work, because of the ReadProtected attribute. Is there a string such that
mat = SparseArray[{}, {100, 100}]
mat["something"] = 1;
is a solution?
mat = SparseArray[{}, {100, 100}, 1]– corey979 Nov 29 '16 at 18:51SparseArray[Normal[mat], Automatic, 1], which has a non sparse intermediate – Coolwater Nov 29 '16 at 18:54SparseArraysets a background; then e.g.mat[[56, 75]]gives1. You can also check the background withmat["Background"]. – corey979 Nov 29 '16 at 18:57