Identity matrix [1, 0, 0, 1, 0, 0]
| 8870 | |
| 8871 | |
| 8872 | class IdentityMatrix(Matrix): |
| 8873 | """Identity matrix [1, 0, 0, 1, 0, 0]""" |
| 8874 | |
| 8875 | def __hash__(self): |
| 8876 | return hash((1,0,0,1,0,0)) |
| 8877 | |
| 8878 | def __init__(self): |
| 8879 | Matrix.__init__(self, 1.0, 1.0) |
| 8880 | |
| 8881 | def __repr__(self): |
| 8882 | return "IdentityMatrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)" |
| 8883 | |
| 8884 | def __setattr__(self, name, value): |
| 8885 | if name in "ad": |
| 8886 | self.__dict__[name] = 1.0 |
| 8887 | elif name in "bcef": |
| 8888 | self.__dict__[name] = 0.0 |
| 8889 | else: |
| 8890 | self.__dict__[name] = value |
| 8891 | |
| 8892 | def checkargs(*args): |
| 8893 | raise NotImplementedError("Identity is readonly") |
| 8894 | |
| 8895 | Identity = IdentityMatrix() |
| 8896 |
no outgoing calls
no test coverage detected
searching dependent graphs…