def __call__(self, pt): """ """ pt = _matrix([[pt.x], [pt.y], [1]]) pt = _dot(self.matrix, pt) x, y, w = pt[0, 0], pt[1, 0], pt[2, 0] return Point(x / w, y / w)
def __call__(self, pt): """ """ pt = _matrix([[pt.x], [pt.y], [1]]) pt = _dot(self.matrix, pt) x, y, w = pt[0,0], pt[1,0], pt[2,0] return Point(x/w, y/w)
def __init__(self, a, b, c, d, e, f, g=0, h=0, i=1): self.a = a self.b = b self.c = c self.d = d self.e = e self.f = f self.g = g self.h = h self.i = i self.matrix = _matrix([[a, b, c], [d, e, f], [g, h, i]], dtype=float)
def Matrix(data, typecode=None, copy=1, savespace=0): return _matrix(data, typecode, copy=copy)
def hill_cipher(self, matrix, key): a = _matrix(matrix) k = _matrix(key) a_k = a * k a_k = a_k.tolist() return a_k[0]
def encrypt(self, plain_text): a = _matrix(plain_text) k = _matrix(self.key) a_k = a*k a_k = a_k.tolist() return a_k[0]
def decrypt(self, cipher_text): a = _matrix(cipher_text) k = _matrix(self.ikey) a_k = a*k a_k = a_k.tolist() return a_k[0]