我在这里定义了计算矩阵行列式的函数.但有时我会得到错误的信号.我从这个答案中建模了我的功能.
from scipy.linalg.cython_lapack cimport dgetrf
cpdef double det_c(double[:, ::1] A, double[:, ::1] work, double[::1] ipiv):
'''obtain determinant of float type square matrix A
Notes
-----
As is, this function is not yet computing the sign of the determinant
correctly, help!
Parameters
----------
A : memoryview (numpy array)
n x n array to compute determinant of
work : memoryview (numpy array)
n x n array to use within function
ipiv : memoryview (numpy array)
length n vector use within …Run Code Online (Sandbox Code Playgroud)