Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Making a dictionary of matrices, and save the session

Some time ago I made a dictionary of matrices with your help.

Now I like to save the session by save_session() but somehow I fail. The terminal goes as follows

sage: A=matrix(GF(2),[[1,0],[0,1]])
sage: A.set_immutable()
sage: dictA={A:1}
sage: save_session(verbose=true)
Saving A
Not saving dictA: mutable matrices are unhashable

On the other hand

sage: A=matrix([[1,0],[0,1]])
sage: A.set_immutable()
sage: dictA={A:1}
sage: save_session(verbose=true)
Saving A
Saving dictA

I have no idea why specifying GF(2) fails save_session(). Does anyone know a fix?

Making a dictionary of matrices, and save the session

Some time ago I made a dictionary of matrices with your help.

Now I like to save the session by save_session() but somehow I fail. The terminal goes as follows

sage: A=matrix(GF(2),[[1,0],[0,1]])
sage: A.set_immutable()
sage: dictA={A:1}
sage: save_session(verbose=true)
Saving A
Not saving dictA: mutable matrices are unhashable

On the other hand

sage: A=matrix([[1,0],[0,1]])
sage: A.set_immutable()
sage: dictA={A:1}
sage: save_session(verbose=true)
Saving A
Saving dictA

I have no idea why specifying GF(2) fails save_session(). Does anyone know a fix?

Making a dictionary of matrices, and save the session

Some time ago I made a dictionary of matrices with your help.

Now I like to save the session by save_session() but somehow I fail. The terminal goes as follows

sage: A=matrix(GF(2),[[1,0],[0,1]])
sage: A.set_immutable()
sage: dictA={A:1}
sage: save_session(verbose=true)
Saving A
Not saving dictA: mutable matrices are unhashable

On the other hand

sage: A=matrix([[1,0],[0,1]])
sage: A.set_immutable()
sage: dictA={A:1}
sage: save_session(verbose=true)
Saving A
Saving dictA

I have no idea why specifying GF(2) fails save_session(). Does anyone know a fix?