File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,7 +64,6 @@ from flint.flintlib.ulong_extras cimport n_is_prime
6464
6565from cpython.object cimport Py_EQ, Py_NE
6666cimport libc.stdlib
67- import numpy as np
6867
6968cdef dict _nmod_mpoly_ctx_cache = {}
7069
@@ -578,8 +577,20 @@ cdef class nmod_mpoly(flint_mpoly):
578577 elif nargs > nvars:
579578 raise ValueError("more arguments provided than variables")
580579
581- cdef ulong[::1] V = np.asarray(args, dtype = np.uint)
582- return nmod_mpoly_evaluate_all_ui(self.val , &(V[0]), self.ctx.val )
580+ cdef:
581+ ulong res
582+ ulong *V = < ulong * > libc.stdlib.malloc(len (args) * sizeof(ulong))
583+ if V is NULL:
584+ raise MemoryError("malloc returned a null pointer") # pragma: no cover
585+
586+ try:
587+ for i in range(len(args )):
588+ V[i] = args[i]
589+ res = nmod_mpoly_evaluate_all_ui(self .val, V, self .ctx.val)
590+ finally :
591+ libc.stdlib.free(V)
592+
593+ return res
583594
584595 def iadd (self , other ):
585596 """
You can’t perform that action at this time.
0 commit comments