Exemple #1
0
    def setUp(self):
        HomologyTestData.setUp(self)

        # pre-compute the N1 matrices from the period matrices. note that
        # Homology test data also contains N1 matrices "given" from the
        # Kalla,Klein paper ("given" in quotes since only the H and Q matrices
        # are actually produced)
        R = involution_matrix(self.atrott, self.btrott)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.atrott, self.btrott, S, tol=1e-3)
        self.N1trott_from_periods = N1

        R = involution_matrix(self.aklein, self.bklein, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.aklein, self.bklein, S, tol=1e-3)
        self.N1klein_from_periods = N1

        R = involution_matrix(self.afermat, self.bfermat, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.afermat, self.bfermat, S, tol=1e-3)
        self.N1fermat_from_periods = N1

        R = involution_matrix(self.a6, self.b6)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.a6, self.b6, S)
        self.N16_from_periods = N1
Exemple #2
0
 def test_integral(self):
     # the integrality test is built into the function itself since the
     # return type should be a matrix over ZZ
     R = involution_matrix(self.atrott, self.btrott)
     R = involution_matrix(self.aklein, self.bklein, tol=1e-3)
     R = involution_matrix(self.afermat, self.bfermat, tol=1e-3)
     R = involution_matrix(self.a6, self.b6)
    def setUp(self):
        HomologyTestData.setUp(self)

        # pre-compute the N1 matrices from the period matrices. note that
        # Homology test data also contains N1 matrices "given" from the
        # Kalla,Klein paper ("given" in quotes since only the H and Q matrices
        # are actually produced)
        R = involution_matrix(self.atrott, self.btrott)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.atrott, self.btrott, S, tol=1e-3)
        self.N1trott_from_periods = N1

        R = involution_matrix(self.aklein, self.bklein, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.aklein, self.bklein, S, tol=1e-3)
        self.N1klein_from_periods = N1

        R = involution_matrix(self.afermat, self.bfermat, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.afermat, self.bfermat, S, tol=1e-3)
        self.N1fermat_from_periods = N1

        R = involution_matrix(self.a6, self.b6)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.a6, self.b6, S)
        self.N16_from_periods = N1
 def test_integral(self):
     # the integrality test is built into the function itself since the
     # return type should be a matrix over ZZ
     R = involution_matrix(self.atrott, self.btrott)
     R = involution_matrix(self.aklein, self.bklein, tol=1e-3)
     R = involution_matrix(self.afermat, self.bfermat, tol=1e-3)
     R = involution_matrix(self.a6, self.b6)
Exemple #5
0
    def test_symplectic(self):
        # the symmetric transformation matrix should be symplectic
        Pa = self.atrott
        Pb = self.btrott
        R = involution_matrix(Pa, Pb)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H, Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)
        g, g = Pa.dimensions()
        J = zero_matrix(ZZ, 2 * g, 2 * g)
        Ig = identity_matrix(ZZ, g, g)
        J[:g, g:] = Ig
        J[g:, :g] = -Ig
        self.assertEqual(Gamma.T * J * Gamma, J)

        Pa = self.aklein
        Pb = self.bklein
        R = involution_matrix(Pa, Pb, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H, Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-3)
        g, g = Pa.dimensions()
        J = zero_matrix(ZZ, 2 * g, 2 * g)
        Ig = identity_matrix(ZZ, g, g)
        J[:g, g:] = Ig
        J[g:, :g] = -Ig
        self.assertEqual(Gamma.T * J * Gamma, J)

        Pa = self.afermat
        Pb = self.bfermat
        R = involution_matrix(Pa, Pb, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H, Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-3)
        g, g = Pa.dimensions()
        J = zero_matrix(ZZ, 2 * g, 2 * g)
        Ig = identity_matrix(ZZ, g, g)
        J[:g, g:] = Ig
        J[g:, :g] = -Ig
        self.assertEqual(Gamma.T * J * Gamma, J)

        Pa = self.a6
        Pb = self.b6
        R = involution_matrix(Pa, Pb)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H, Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)
        g, g = Pa.dimensions()
        J = zero_matrix(ZZ, 2 * g, 2 * g)
        Ig = identity_matrix(ZZ, g, g)
        J[:g, g:] = Ig
        J[g:, :g] = -Ig
        self.assertEqual(Gamma.T * J * Gamma, J)
    def test_symplectic(self):
        # the symmetric transformation matrix should be symplectic
        Pa = self.atrott
        Pb = self.btrott
        R = involution_matrix(Pa, Pb)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H,Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)
        g,g = Pa.dimensions()
        J = zero_matrix(ZZ,2*g,2*g)
        Ig = identity_matrix(ZZ, g, g)
        J[:g,g:] = Ig
        J[g:,:g] = -Ig
        self.assertEqual(Gamma.T*J*Gamma,J)

        Pa = self.aklein
        Pb = self.bklein
        R = involution_matrix(Pa, Pb, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H,Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-3)
        g,g = Pa.dimensions()
        J = zero_matrix(ZZ,2*g,2*g)
        Ig = identity_matrix(ZZ, g, g)
        J[:g,g:] = Ig
        J[g:,:g] = -Ig
        self.assertEqual(Gamma.T*J*Gamma,J)

        Pa = self.afermat
        Pb = self.bfermat
        R = involution_matrix(Pa, Pb, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H,Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-3)
        g,g = Pa.dimensions()
        J = zero_matrix(ZZ,2*g,2*g)
        Ig = identity_matrix(ZZ, g, g)
        J[:g,g:] = Ig
        J[g:,:g] = -Ig
        self.assertEqual(Gamma.T*J*Gamma,J)

        Pa = self.a6
        Pb = self.b6
        R = involution_matrix(Pa, Pb)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H,Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)
        g,g = Pa.dimensions()
        J = zero_matrix(ZZ,2*g,2*g)
        Ig = identity_matrix(ZZ, g, g)
        J[:g,g:] = Ig
        J[g:,:g] = -Ig
        self.assertEqual(Gamma.T*J*Gamma,J)
Exemple #7
0
    def test_diagonalizable(self):
        # the involution matrix should be diagonalizable
        R = involution_matrix(self.atrott, self.btrott)
        RQQ = R.change_ring(QQ)
        self.assertTrue(RQQ.is_diagonalizable())

        R = involution_matrix(self.aklein, self.bklein, tol=1e-3)
        RQQ = R.change_ring(QQ)
        self.assertTrue(RQQ.is_diagonalizable())

        R = involution_matrix(self.afermat, self.bfermat, tol=1e-3)
        RQQ = R.change_ring(QQ)
        self.assertTrue(RQQ.is_diagonalizable())

        R = involution_matrix(self.a6, self.b6)
        RQQ = R.change_ring(QQ)
        self.assertTrue(RQQ.is_diagonalizable())
Exemple #8
0
    def test_eigenvalues(self):
        # the eigenvalues of the involution matrix should be equal to -1 or 1
        R = involution_matrix(self.atrott, self.btrott)
        evals = R.eigenvalues()
        self.assertSetEqual(set(evals), {1.0, -1.0})

        R = involution_matrix(self.aklein, self.bklein, tol=1e-3)
        evals = R.eigenvalues()
        self.assertSetEqual(set(evals), {1.0, -1.0})

        R = involution_matrix(self.afermat, self.bfermat, tol=1e-3)
        evals = R.eigenvalues()
        self.assertSetEqual(set(evals), {1.0, -1.0})

        R = involution_matrix(self.a6, self.b6)
        evals = R.eigenvalues()
        self.assertSetEqual(set(evals), {1.0, -1.0})
    def test_diagonalizable(self):
        # the involution matrix should be diagonalizable
        R = involution_matrix(self.atrott, self.btrott)
        RQQ = R.change_ring(QQ)
        self.assertTrue(RQQ.is_diagonalizable())

        R = involution_matrix(self.aklein, self.bklein, tol=1e-3)
        RQQ = R.change_ring(QQ)
        self.assertTrue(RQQ.is_diagonalizable())

        R = involution_matrix(self.afermat, self.bfermat, tol=1e-3)
        RQQ = R.change_ring(QQ)
        self.assertTrue(RQQ.is_diagonalizable())

        R = involution_matrix(self.a6, self.b6)
        RQQ = R.change_ring(QQ)
        self.assertTrue(RQQ.is_diagonalizable())
    def test_eigenvalues(self):
        # the eigenvalues of the involution matrix should be equal to -1 or 1
        R = involution_matrix(self.atrott, self.btrott)
        evals = R.eigenvalues()
        self.assertSetEqual(set(evals), {1.0, -1.0})

        R = involution_matrix(self.aklein, self.bklein, tol=1e-3)
        evals = R.eigenvalues()
        self.assertSetEqual(set(evals), {1.0, -1.0})

        R = involution_matrix(self.afermat, self.bfermat, tol=1e-3)
        evals = R.eigenvalues()
        self.assertSetEqual(set(evals), {1.0, -1.0})

        R = involution_matrix(self.a6, self.b6)
        evals = R.eigenvalues()
        self.assertSetEqual(set(evals), {1.0, -1.0})
Exemple #11
0
    def test_symmetric(self):
        # the N1 matrix should be symmetric
        R = involution_matrix(self.atrott, self.btrott)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.atrott, self.btrott, S)
        self.assertEqual(N1, N1.T)

        R = involution_matrix(self.aklein, self.bklein, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.aklein, self.bklein, S, tol=1e-3)
        self.assertEqual(N1, N1.T)

        R = involution_matrix(self.afermat, self.bfermat, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.afermat, self.bfermat, S, tol=1e-3)
        self.assertEqual(N1, N1.T)

        R = involution_matrix(self.a6, self.b6)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.a6, self.b6, S)
        self.assertEqual(N1, N1.T)
    def test_symmetric(self):
        # the N1 matrix should be symmetric
        R = involution_matrix(self.atrott, self.btrott)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.atrott, self.btrott, S)
        self.assertEqual(N1, N1.T)

        R = involution_matrix(self.aklein, self.bklein, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.aklein, self.bklein, S, tol=1e-3)
        self.assertEqual(N1, N1.T)

        R = involution_matrix(self.afermat, self.bfermat, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.afermat, self.bfermat, S, tol=1e-3)
        self.assertEqual(N1, N1.T)

        R = involution_matrix(self.a6, self.b6)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(self.a6, self.b6, S)
        self.assertEqual(N1, N1.T)
Exemple #13
0
    def test_recover_action(self):
        # see equation (28) of Kalla,Klein
        def compute_R(Gamma, H):
            H = H.change_ring(ZZ)
            g, g = H.dimensions()
            A = Gamma[:g, :g]
            B = Gamma[:g, g:]
            C = Gamma[g:, :g]
            D = Gamma[g:, g:]
            Ig = identity_matrix(ZZ, g)

            R = zero_matrix(ZZ, 2 * g, 2 * g)
            R[:g, :g] = (2 * C.T * B - A.T * H * B + Ig).T
            R[:g, g:] = 2 * D.T * B - B.T * H * B
            R[g:, :g] = -2 * C.T * A + A.T * H * A
            R[g:, g:] = -(2 * C.T * B - A.T * H * B + Ig)
            return R

        # trott curve
        Pa = self.atrott
        Pb = self.btrott
        R = involution_matrix(Pa, Pb)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H, Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)

        Ralt = compute_R(Gamma, H)
        self.assertEqual(R, Ralt)

        # klein curve
        Pa = self.aklein
        Pb = self.bklein
        R = involution_matrix(Pa, Pb, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S, tol=1e-3)
        H, Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)

        Ralt = compute_R(Gamma, H)
        self.assertEqual(R, Ralt)

        # fermat curve
        Pa = self.afermat
        Pb = self.bfermat
        R = involution_matrix(Pa, Pb, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S, tol=1e-3)
        H, Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)

        Ralt = compute_R(Gamma, H)
        self.assertEqual(R, Ralt)

        # genus 6 curve
        Pa = self.a6
        Pb = self.b6
        R = involution_matrix(Pa, Pb)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H, Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)

        Ralt = compute_R(Gamma, H)
        self.assertEqual(R, Ralt)
    def test_recover_action(self):
        # see equation (28) of Kalla,Klein
        def compute_R(Gamma, H):
            H = H.change_ring(ZZ)
            g,g = H.dimensions()
            A = Gamma[:g,:g]
            B = Gamma[:g,g:]
            C = Gamma[g:,:g]
            D = Gamma[g:,g:]
            Ig = identity_matrix(ZZ,g)

            R = zero_matrix(ZZ,2*g,2*g)
            R[:g,:g] = (2*C.T*B - A.T*H*B + Ig).T
            R[:g,g:] = 2*D.T*B - B.T*H*B
            R[g:,:g] = -2*C.T*A + A.T*H*A
            R[g:,g:] = -(2*C.T*B - A.T*H*B + Ig)
            return R

        # trott curve
        Pa = self.atrott
        Pb = self.btrott
        R = involution_matrix(Pa, Pb)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H,Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)

        Ralt = compute_R(Gamma, H)
        self.assertEqual(R, Ralt)

        # klein curve
        Pa = self.aklein
        Pb = self.bklein
        R = involution_matrix(Pa, Pb, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S, tol=1e-3)
        H,Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)

        Ralt = compute_R(Gamma, H)
        self.assertEqual(R, Ralt)

        # fermat curve
        Pa = self.afermat
        Pb = self.bfermat
        R = involution_matrix(Pa, Pb, tol=1e-3)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S, tol=1e-3)
        H,Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)

        Ralt = compute_R(Gamma, H)
        self.assertEqual(R, Ralt)

        # genus 6 curve
        Pa = self.a6
        Pb = self.b6
        R = involution_matrix(Pa, Pb)
        S = integer_kernel_basis(R)
        N1 = N1_matrix(Pa, Pb, S)
        H,Q = symmetric_block_diagonalize(N1)
        Gamma = symmetric_transformation_matrix(Pa, Pb, S, H, Q, tol=1e-4)

        Ralt = compute_R(Gamma, H)
        self.assertEqual(R, Ralt)