def rotate(self, x, M, boxshift): """ rotates, shift, and separates particle coordinates into distance and xy position x: particle positions M: rotation matrix boxshift: shift vector """ y = linalg.einsum('ij,kj->ki', (M, x)) y = y + self.pm.BoxSize * boxshift d = linalg.take(y, 2, axis=1) xy = linalg.take(y, (0, 1), axis=1) return dict(xy=xy, d=d)
def model(self, x): # testing contraction a = linalg.reshape(x, (10, )) b = linalg.reshape(x, (10)) return linalg.einsum("i, i->", [a, b])
def model(self, x): # testing uncontracted dimensions a = linalg.reshape(x, (10, 1, 1)) b = linalg.reshape(x, (1, 10)) return linalg.einsum("abc, ca->b", [a, b])
def model(self, x): y = linalg.einsum('ij,kj->ki', (self.M, x)) y = y + self.pm.BoxSize * self.boxshift d = linalg.take(y, 2, axis=1) xy = linalg.take(y, (0, 1), axis=1) return xy #d
def model(self, x): M = np.ones((3, 3)) y = linalg.einsum('ij, kj->ki', [M, x]) return y