コード例 #1
0
    def __init__(self, filename, verbose=VLog.DEBUG):

        if __debug__:
            assert filename is None or is_str(filename), filename

        logger.level = verbose

        import dig_inv, dig_refine, dig_arrays, dig_polynomials
        for f in [dig_miscs, dig_inv, dig_refine, dig_arrays, dig_polynomials]:
            f.logger.set_level(logger.level)

        from platform import node, system, release, machine
        margs = [
            get_cur_time(time_only=False),
            version(), ' '.join([node(),
                                 system(),
                                 release(),
                                 machine()])
        ]
        logger.info("DIG (Dynamic Invariant Generator)\n"
                    "{}, {}, {}".format(*margs))

        if filename is not None:
            self._setup(filename)
        else:
            logger.warn('No filename given, manual setup')
コード例 #2
0
ファイル: compute.py プロジェクト: fredstro/mfdb
def compute_atkin_lehner(N, k, i):
    filename = filenames.ambient(N, k, i)
    if not os.path.exists(filename):
        print "Ambient (%s,%s,%s) space not computed."%(N,k,i)
        return
        #compute_ambient_space(N, k, i)

    print "computing atkin-lehner for (%s,%s,%s)"%(N,k,i)
    m = filenames.number_of_known_factors(N, k, i)    
    M = load_ambient_space(N, k, i)
    for d in range(m):
        atkin_lehner_file = filenames.factor_atkin_lehner(N, k, i, d, False)
        if os.path.exists(atkin_lehner_file):
            print "skipping computing atkin_lehner for (%s,%s,%s,%s) since it already exists"%(N,k,i,d)
            # already done
            continue
        
        # compute atkin_lehner
        print "computing atkin_lehner for (%s,%s,%s,%s)"%(N,k,i,d)
        t = cputime()
        A = load_factor(N, k, i, d, M)
        al = ' '.join(['+' if a > 0 else '-' for a in atkin_lehner_signs(A)])
        print al
        open(atkin_lehner_file, 'w').write(al)
        tm = cputime(t)
        meta = {'cputime':tm, 'version':version()}
        save(meta, filenames.meta(atkin_lehner_file))
コード例 #3
0
ファイル: compute.py プロジェクト: fredstro/mfdb
def compute_ambient_space(N, k, i):
    if i == 'all':
        G = DirichletGroup(N).galois_orbits()
        sgn = (-1)**k
        for j, g in enumerate(G):
            if g[0](-1) == sgn:
                compute_ambient_space(N,k,j)
        return

    if i == 'quadratic':
        G = DirichletGroup(N).galois_orbits()
        sgn = (-1)**k
        for j, g in enumerate(G):
            if g[0](-1) == sgn and g[0].order()==2:
                compute_ambient_space(N,k,j)
        return

    filename = filenames.ambient(N, k, i)
    if os.path.exists(filename):
        return

    eps = character(N, i)
    t = cputime()
    M = ModularSymbols(eps, weight=k, sign=1)
    tm = cputime(t)
    save(M, filename)
    meta = {'cputime':tm, 'dim':M.dimension(), 'M':str(M), 'version':version()}
    save(meta, filenames.meta(filename))
コード例 #4
0
ファイル: compute.py プロジェクト: fredstro/mfdb
def compute_aplists(N, k, i, *args):
    if i == 'all':
        G = DirichletGroup(N).galois_orbits()
        sgn = (-1)**k
        for j, g in enumerate(G):
            if g[0](-1) == sgn:
                compute_aplists(N,k,j,*args)
        return

    if i == 'quadratic':
        G = DirichletGroup(N).galois_orbits()
        sgn = (-1)**k
        for j, g in enumerate(G):
            if g[0](-1) == sgn and g[0].order()==2:
                compute_aplists(N,k,j,*args)
        return

    if len(args) == 0:
        args = (100, )

    filename = filenames.ambient(N, k, i)
    if not os.path.exists(filename):
        print "Ambient (%s,%s,%s) space not computed."%(N,k,i)
        return
        #compute_ambient_space(N, k, i)

    print "computing aplists for (%s,%s,%s)"%(N,k,i)
        
    m = filenames.number_of_known_factors(N, k, i)

    if m == 0:
        # nothing to do
        return
    
    M = load_ambient_space(N, k, i)
    for d in range(m):
        aplist_file = filenames.factor_aplist(N, k, i, d, False, *args)
        if os.path.exists(aplist_file):
            print "skipping computing aplist(%s) for (%s,%s,%s,%s) since it already exists"%(args, N,k,i,d)
            # already done
            continue
        
        # compute aplist
        print "computing aplist(%s) for (%s,%s,%s,%s)"%(args, N,k,i,d)
        t = cputime()
        A = load_factor(N, k, i, d, M)
        aplist, _ = A.compact_system_of_eigenvalues(prime_range(*args), 'a')
        print aplist, aplist_file
        save(aplist, aplist_file)
        tm = cputime(t)
        meta = {'cputime':tm, 'version':version()}
        save(meta, filenames.meta(aplist_file))
コード例 #5
0
def render_web_newform(level, weight, character, label, **kwds):
    r"""
    Renders the webpage for one elliptic modular form.

    """
    citation = ['Sage:' + version()]
    info = set_info_for_web_newform(level, weight, character, label, **kwds)
    emf_logger.debug("info={0}".format(info.keys()))
    err = info.get('error', '')
    ## Check if we want to download either file of the function or Fourier coefficients
    if 'download' in info and 'error' not in info:
        return send_file(info['tempfile'], as_attachment=True, attachment_filename=info['filename'])
    return render_template("emf_web_newform.html", **info)
コード例 #6
0
def render_web_newform(level, weight, character, label, **kwds):
    r"""
    Renders the webpage for one elliptic modular form.

    """
    citation = ['Sage:' + version()]
    info = set_info_for_web_newform(level, weight, character, label, **kwds)
    emf_logger.debug("info={0}".format(info.keys()))
    err = info.get('error', '')
    ## Check if we want to download either file of the function or Fourier coefficients
    if 'download' in info and 'error' not in info:
        return send_file(info['tempfile'], as_attachment=True, attachment_filename=info['filename'])
    return render_template("emf_web_newform.html", **info)
コード例 #7
0
ファイル: compute.py プロジェクト: fredstro/mfdb
def compute_decompositions(N, k, i):
    if i == 'all':
        G = DirichletGroup(N).galois_orbits()
        sgn = (-1)**k
        for j, g in enumerate(G):
            if g[0](-1) == sgn:
                compute_decompositions(N,k,j)
        return

    if i == 'quadratic':
        G = DirichletGroup(N).galois_orbits()
        sgn = (-1)**k
        for j, g in enumerate(G):
            if g[0](-1) == sgn and g[0].order()==2:
                compute_decompositions(N,k,j)
        return

    filename = filenames.ambient(N, k, i)
    if not os.path.exists(filename):
        print "Ambient space (%s,%s,%s) not computed."%(N,k,i)
        return
        #compute_ambient_space(N, k, i)
    if not os.path.exists(filename):
        return 
    
    eps = DirichletGroup(N).galois_orbits()[i][0]

    if os.path.exists(filenames.factor(N, k, i, 0, makedir=False)):
        return
    
    t = cputime()
    M = load_ambient_space(N, k, i)
    D = M.cuspidal_subspace().new_subspace().decomposition()
    for d in range(len(D)):
        f = filenames.factor_basis_matrix(N, k, i, d)
        if os.path.exists(f):
            continue
        A = D[d]
        B  = A.free_module().basis_matrix()
        Bd = A.dual_free_module().basis_matrix()
        v  = A.dual_eigenvector(names='a', lift=False)    # vector over number field
        nz = A._eigen_nonzero()
        
        save(B, filenames.factor_basis_matrix(N, k, i, d))
        save(Bd, filenames.factor_dual_basis_matrix(N, k, i, d))
        save(v, filenames.factor_dual_eigenvector(N, k, i, d))
        save(nz, filenames.factor_eigen_nonzero(N, k, i, d))
        
    tm = cputime(t)
    meta = {'cputime':tm, 'number':len(D), 'version':version()}
    save(meta, filenames.decomp_meta(N, k, i))
コード例 #8
0
ファイル: kamiennys_criterion.py プロジェクト: koffie/mdsage
def run_criterion(result_table,iterator,congruence_type,algorithm="default",verbose=False):
    """
    The iterator should spit out things of the form (torsion_order,degree,t1n,t1mod,t2q)
    """
    insert_point=result_table.insert()
    old_torsion=None
    for torsion_order,degree,t1n,t1mod,t2q in iterator:
        if not old_torsion==torsion_order:
            old_torsion=torsion_order
            C=KamiennyCriterion(torsion_order,congruence_type=congruence_type,algorithm=algorithm,verbose=verbose)
        verified,message=C.verify_criterion(degree,n=t1n,p=t1mod,q=t2q,verbose=verbose)
        insert_point.execute(torsion_order=int(torsion_order), extension_degree=int(degree), 
                             t1n=int(t1n), t1mod=int(t1mod), t2q=int(t2q),
                             congruence_type=int(congruence_type), result=verified, 
                             kamienny_version=Kamienny_Version,sage_version=version())
コード例 #9
0
def run_criterion(result_table,iterator,congruence_type,algorithm="default",verbose=False):
    """
    The iterator should spit out things of the form (torsion_order,degree,t1n,t1mod,t2q)
    """
    insert_point=result_table.insert()
    old_torsion=None
    for torsion_order,degree,t1n,t1mod,t2q in iterator:
        if not old_torsion==torsion_order:
            old_torsion=torsion_order
            C=KamiennyCriterion(torsion_order,congruence_type=congruence_type,algorithm=algorithm,verbose=verbose)
        verified,message=C.verify_criterion(degree,n=t1n,p=t1mod,q=t2q,verbose=verbose)
        insert_point.execute(torsion_order=int(torsion_order), extension_degree=int(degree), 
                             t1n=int(t1n), t1mod=int(t1mod), t2q=int(t2q),
                             congruence_type=int(congruence_type), result=verified, 
                             kamienny_version=Kamienny_Version,sage_version=version())
コード例 #10
0
ファイル: dig.py プロジェクト: REMath/implementations
    def __init__(self,filename,verbose=VLog.DEBUG):
    
        if __debug__:
            assert filename is None or is_str(filename), filename

        logger.level = verbose

        import dig_inv, refine, dig_arrays, dig_polynomials
        for f in [dig_inv, refine, dig_arrays, dig_polynomials, dig_miscs]:
            f.logger.set_level(logger.level)
        
        from platform import node, system, release, machine
        margs = [get_cur_time(time_only=False),version(),
                 ' '.join([node(),system(),release(),machine()])]
        logger.info("{}, {}, {}".format(*margs))
        
        if filename is not None:
            self._setup(filename)
        else:
            logger.warn('No filename given, manual setup')
コード例 #11
0
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""

modules = []
try:
    from sage import all as sage
    from mathics.optional import calculus, numerical_optimization
    
    modules += [calculus, numerical_optimization]
    
    sage_version = sage.version()
except ImportError:
    # silently ignore when Sage cannot be imported
    sage_version = None

from mathics.builtin import add_builtins, builtins_by_module, is_builtin
from mathics.builtin.base import Builtin

optional_builtins = []
optional_builtins_by_module = {}

for module in modules:
    optional_builtins_by_module[module.__name__] = []
    vars = dir(module)
    for name in vars:
        var = getattr(module, name)
コード例 #12
0
ファイル: kamiennys_criterion.py プロジェクト: koffie/mdsage
    def verify_criterion(self, d, t=None, n=5, p=65521, q=3, v=None, use_rand_vec=False, verbose=False):
        """
        Attempt to verify the criterion at p using the input t. If t is not
        given compute it using n, p and q

        INPUT:
            
            - `t` -- hecke operator (optional default=None)
            - `n` -- integer (optional default=5), used in computing t1
            - `p` -- prime (optional default=46337), used in computing t1
            - `q` -- prime (optional default=3), used in computing t2
            - `verbose` -- bool (default: True); if true, print to
              stdout as the computation is performed.

        OUTPUT:

            - bool -- True if criterion satisfied; otherwise, False
            - string -- message about what happened or went wrong

        EXAMPLES:

        We can't get p=29 to work no matter what I try, which nicely illustrates
        the various ways the criterion can fail::

            sage: from mdsage import *
            sage: C = KamiennyCriterion(29)
            sage: C.verify_criterion(4,n=5)
            dependency dimension to large to search through
            (False,
             'There is a dependency of weigt 2 in dependencies(3,1)',
             [Vector space of degree 4 and dimension 0 over Finite Field of size 2
              Basis matrix:
              [], Vector space of degree 16 and dimension 8 over Finite Field of size 2
              Basis matrix:
              [1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]
              [0 1 0 0 0 0 1 0 1 1 0 1 1 1 0 0]
              [0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0]
              [0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0]
              [0 0 0 0 1 0 1 0 1 1 0 1 1 1 0 0]
              [0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0]
              [0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0], Vector space of degree 28 and dimension 19 over Finite Field of size 2
              Basis matrix:
              [1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1]
              [0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1 0]
              [0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0]
              [0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
              [0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1 0]
              [0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
              [0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0]
              [0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 1 1]
              [0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 1 1]
              [0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 1]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 1 1 1]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0]])
        
        With p=43 the criterion is satisfied for d=4, thus proving that 43 is
        not the order of a torsion point on any elliptic curve over
        a quartic field::

            sage: C = KamiennyCriterion(43); C
            Kamienny's Criterion for p=43
            sage: C.verify_criterion(4)
            (True,
             'All conditions are satified for Gamma1 d=4 p=43. Using n=5, modp=65521, q=3 in Kamienny Version 1.5 and SageMath version ...',
             [Vector space of degree 4 and dimension 0 over Finite Field of size 2
              Basis matrix:
              [], Vector space of degree 23 and dimension 2 over Finite Field of size 2
              Basis matrix:
              [1 1 0 1 0 0 1 1 1 0 1 0 1 1 1 1 1 1 0 0 1 0 0]
              [0 0 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 0 0 0], Vector space of degree 42 and dimension 11 over Finite Field of size 2
              Basis matrix:
              [1 0 0 0 0 0 0 1 0 1 1 1 0 1 1 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1 1 1 1 1]
              [0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 0]
              [0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0]
              [0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 0 1 0 0]
              [0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0]
              [0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1 1 1 1 1 0 1 0 0 1 1 0 0 1 1 1 0 0 1 0 0 0 1 1 0 1]
              [0 0 0 0 0 0 1 0 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1 0 0 0 1 0 1 0 1 0 0 1 1 0 0 0 1 1 1 1]
              [0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 1 0 1 1 0 0 0]])
        """
        if self.verbose: tm = cputime(); mem = get_memory_usage(); print "verif start"
        if self.p < (1 + 2 ** (d / 2)) ** 2 and self.verbose:
            print "WARNING: p must be at least (1+2^(d/2))^2 for the criterion to work."
        if t == None:
            t = self.t(n, p, q)
        if self.verbose: print "time and mem", cputime(tm), get_memory_usage(mem), "t"
        if v==None:
            if use_rand_vec:
                v=self.v
            else:
                v=t.parent()(1)
        if self.congruence_type==0:
            verified,message,dependencies=self.verify_gamma0(d,t,v)
        else:
            verified,message,dependencies=self.verify_gamma1(d,t,v)
        if self.verbose: print "time and mem", cputime(tm), get_memory_usage(mem), "total verif time"
        if not verified:
            return verified,message,dependencies
        return True, "All conditions are satified for Gamma%s d=%s p=%s. Using n=%s, modp=%s, q=%s in Kamienny Version %s and %s" % (self.congruence_type,d, self.p, n, p, q, Kamienny_Version, version()),dependencies
コード例 #13
0
    def verify_criterion(self, d, t=None, n=5, p=65521, q=3, v=None, use_rand_vec=False, verbose=False):
        """
        Attempt to verify the criterion at p using the input t. If t is not
        given compute it using n, p and q

        INPUT:
            
            - `t` -- hecke operator (optional default=None)
            - `n` -- integer (optional default=5), used in computing t1
            - `p` -- prime (optional default=46337), used in computing t1
            - `q` -- prime (optional default=3), used in computing t2
            - `verbose` -- bool (default: True); if true, print to
              stdout as the computation is performed.

        OUTPUT:

            - bool -- True if criterion satisfied; otherwise, False
            - string -- message about what happened or went wrong

        EXAMPLES:

        We can't get p=29 to work no matter what I try, which nicely illustrates
        the various ways the criterion can fail::

            sage: from mdsage import *
            sage: C = KamiennyCriterion(29)
            sage: C.verify_criterion(4,n=5)
            dependency dimension to large to search through
            (False,
             'There is a dependency of weigt 2 in dependencies(3,1)',
             [Vector space of degree 4 and dimension 0 over Finite Field of size 2
              Basis matrix:
              [], Vector space of degree 16 and dimension 8 over Finite Field of size 2
              Basis matrix:
              [1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]
              [0 1 0 0 0 0 1 0 1 1 0 1 1 1 0 0]
              [0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0]
              [0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0]
              [0 0 0 0 1 0 1 0 1 1 0 1 1 1 0 0]
              [0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0]
              [0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0], Vector space of degree 28 and dimension 19 over Finite Field of size 2
              Basis matrix:
              [1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1]
              [0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1 0]
              [0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0]
              [0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
              [0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1 0]
              [0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
              [0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0]
              [0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 1 1]
              [0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 1 1]
              [0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 1]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 1 1 1]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0]])
        
        With p=43 the criterion is satisfied for d=4, thus proving that 43 is
        not the order of a torsion point on any elliptic curve over
        a quartic field::

            sage: C = KamiennyCriterion(43); C
            Kamienny's Criterion for p=43
            sage: C.verify_criterion(4)
            (True,
             'All conditions are satified for Gamma1 d=4 p=43. Using n=5, modp=65521, q=3 in Kamienny Version 1.5 and SageMath version ...',
             [Vector space of degree 4 and dimension 0 over Finite Field of size 2
              Basis matrix:
              [], Vector space of degree 23 and dimension 2 over Finite Field of size 2
              Basis matrix:
              [1 1 0 1 0 0 1 1 1 0 1 0 1 1 1 1 1 1 0 0 1 0 0]
              [0 0 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 0 0 0], Vector space of degree 42 and dimension 11 over Finite Field of size 2
              Basis matrix:
              [1 0 0 0 0 0 0 1 0 1 1 1 0 1 1 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1 1 1 1 1]
              [0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 0]
              [0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0]
              [0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 0 1 0 0]
              [0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0]
              [0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1 1 1 1 1 0 1 0 0 1 1 0 0 1 1 1 0 0 1 0 0 0 1 1 0 1]
              [0 0 0 0 0 0 1 0 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1 0 0 0 1 0 1 0 1 0 0 1 1 0 0 0 1 1 1 1]
              [0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0]
              [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 1 0 1 1 0 0 0]])
        """
        if self.verbose: tm = cputime(); mem = get_memory_usage(); print("verif start")
        if self.p < (1 + 2 ** (d / 2)) ** 2 and self.verbose:
            print("WARNING: p must be at least (1+2^(d/2))^2 for the criterion to work.")
        if t == None:
            t = self.t(n, p, q)
        if self.verbose: print("time and mem", cputime(tm), get_memory_usage(mem), "t")
        if v==None:
            if use_rand_vec:
                v=self.v
            else:
                v=t.parent()(1)
        if self.congruence_type==0:
            verified,message,dependencies=self.verify_gamma0(d,t,v)
        else:
            verified,message,dependencies=self.verify_gamma1(d,t,v)
        if self.verbose: print("time and mem", cputime(tm), get_memory_usage(mem), "total verif time")
        if not verified:
            return verified,message,dependencies
        return True, "All conditions are satified for Gamma%s d=%s p=%s. Using n=%s, modp=%s, q=%s in Kamienny Version %s and %s" % (self.congruence_type,d, self.p, n, p, q, Kamienny_Version, version()),dependencies