Example #1
0
 def sumOfSubmodules(self, other):
     """
     Return module which is sum of self and other.
     """
     if self.row != other.row:
         raise matrix.MatrixSizeError()
     N = self.copy()
     N.extendColumn(other)
     module = Submodule.fromMatrix(N)
     module.toHNF()
     return module
Example #2
0
 def intersectionOfSubmodules(self, other):
     """
     Return module which is intersection of self and other.
     """
     if self.row != other.row:
         raise matrix.MatrixSizeError()
     M1 = self.copy()
     M1.extendColumn(other)
     N = M1.kernelAsModule()
     if N == None: # zero kernel
         N = matrix.zeroMatrix(self.row, 1, self.coeff_ring)
     N1 = N.getBlock(1, 1, self.column, N.column) # N.column is dim(ker(M1))
     module = Submodule.fromMatrix(self * N1)
     module.toHNF()
     return module