def test_ops(): src_1 = np.array([[0, 0], [0, 1], [1, 1], [1, 0]], dtype=np.float64) src_2 = src_1 * 4 src_3 = src_1 + 10000 src_4 = np.array([[0, 1], [1, 1], [1, 0], [0, 0]], dtype=np.float64) src_5 = (np.array([[0.6, 0.2], [1.4, 0.3], [-0.1, 1.1], [1.2, 0.8]], dtype=np.float64) / 0.2) - 100 sources = [src_1, src_2, src_3, src_4, src_5] proc = Procrustes(sources) proc.general_alignment() for src in sources: sr, t = proc.scalerotation_translation_for_source(src) new_source = np.dot(src, sr) + t assert (_mag_diff(new_source, proc.aligned_version_of_source(src)) < 0.00000001)