Re: problem with DumpSaving SparseArrays in 6.0

*To*: mathgroup at smc.vnet.net*Subject*: [mg75717] Re: [mg75656] problem with DumpSaving SparseArrays in 6.0*From*: DrMajorBob <drmajorbob at bigfoot.com>*Date*: Wed, 9 May 2007 04:29:14 -0400 (EDT)*References*: <5896993.1178622176403.JavaMail.root@m35>*Reply-to*: drmajorbob at bigfoot.com

Here's a slightly more complete demonstration: b = a = SparseArray[{2, 3} -> 7, {5, 5}]; DumpSave["test.mx", b]; << "test.mx" a == b True Dimensions /@ {a, b} {{5, 5}, {}} a & b are equal, but they don't have the same dimensions!! Not only that, but if you highlight and copy the output cell text: b \!\(\* TagBox[ RowBox[{"SparseArray", "[", RowBox[{"Automatic", ",", RowBox[{"{", RowBox[{"5", ",", "5"}], "}"}], ",", "0", ",", RowBox[{"{", RowBox[{"1", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0", ",", "1", ",", "1", ",", "1", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"{", "3", "}"}], "}"}]}], "}"}], ",", RowBox[{"{", "7", "}"}]}], "}"}]}], "]"}], False, Editable->False]\) and paste it in a new cell, SparseArray[Automatic, {5, 5}, 0, {1, {{0, 0, 1, 1, 1, 1}, {{3}}}, {7}}] Dimensions[%] \!\(\* TagBox[ RowBox[{"SparseArray", "[", RowBox[{ InterpretationBox[ RowBox[{"\<\"<\"\>", "", "1", "", "\<\">\"\>"}], SequenceForm["<", 1, ">"], Editable->False], ",", RowBox[{"{", RowBox[{"5", ",", "5"}], "}"}]}], "]"}], False, Editable->False]\) {5, 5} NOW you have the correct matrix. Bizarro. Bobby On Tue, 08 May 2007 04:46:01 -0500, Roman <rschmied at gmail.com> wrote: > Hello all, > There seems to be a problem with DumpSave and SparseArray in 6.0. If > you DumpSave a simple SparseArray like this: > > A = SparseArray[{2, 3} -> 7, {5, 5}]; > DumpSave["test.mx", A]; > > then read it back: > > << "test.mx" > A > > you get the following output: > SparseArray[Automatic, {5, 5}, 0, {1, {{0, 0, 1, 1, 1, 1}, {{3}}}, > {7}}] > > While this is correct in principle, in practice A is now no longer > usable. Try, for example, > MatrixForm[A] > This will complain, just like any other use of A as a matrix will. > > Do you have any idea for a workaround, to convert A back into a usable= > matrix? > > Thanks! > Roman. > > > -- = DrMajorBob at bigfoot.com