Utility functions for numpy.¶
- sage.modules.numpy_util.set_matrix_mod2_from_numpy(a, b)¶
Try to set the entries of a matrix from a numpy array.
INPUT:
a– the destination matrixb– a numpy array, must have dimension 2 and the same shape asa
OUTPUT:
True(when used as bool) if successful,Falseotherwise. May throwValueError.The exact type of the return value is not guaranteed, in the actual current implementation it is
1for success and0for failure.
- sage.modules.numpy_util.set_mzd_from_numpy(entries_addr, degree, x)¶
Set the entries in
<mzd_t*>entries_addrfrom numpy arrayx.INPUT:
entries_addr– must be amzd_t*casted touintptr_t; the casting is necessary to pass it through Python boundary because of lazy import. Do not pass arbitrary integer value here, will crash the program.degree– the length of the arrayx– a numpy array of integers or booleans, or any other object (in which case this function will returnFalse)
OUTPUT:
Trueif successful,Falseotherwise. May throwValueError.