📜  没有 numpy 的 python 矩阵行列式 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:12.971000             🧑  作者: Mango

代码示例1
def det(matrix):
    order=len(matrix)
    posdet=0
    for i in range(order):
        posdet+=reduce((lambda x, y: x * y), [matrix[(i+j)%order][j] for j in range(order)])
    negdet=0
    for i in range(order):
        negdet+=reduce((lambda x, y: x * y), [matrix[(order-i-j)%order][j] for j in range(order)])
    return posdet-negdet