我需要一些结构,如:
from numpy import *
myDict = {
matrix([ 0,0,0 ]): matrix([ 0,0,0 ]),
matrix([ 0,0,1 ]): matrix([ 0,1,0 ]),
matrix([ 0,1,0 ]): matrix([ 0,1,1 ]),
matrix([ 0,1,1 ]): matrix([ 1,0,0 ]),
matrix([ 1,0,0 ]): matrix([ 1,0,1 ]),
matrix([ 1,0,1 ]): matrix([ 1,1,0 ]),
matrix([ 1,1,0 ]): matrix([ 0,0,1 ]),
matrix([ 1,1,1 ]): matrix([ 1,1,1 ]),
}
但是,当我调用 myDict [matrix([0,1,1])] 时,它会引发KeyError。 那么,如何在Python中实现矩阵到矩阵的映射?