Skip to content

Determinant function raises TypeError on simple matrix #542

Description

@sonntagsgesicht

determinant function det(A) on matrix A = matrix([[0, 0, 4], [2, 0, 3], [0, 0, -3]]) raises
TypeError: '>=' not supported between instances of 'NoneType' and 'int'.

Due to issue in LU_decomp line 143 at ctx.swap_row(A, j, p[j]) according p[j]being none, since A has a zero column.

Many be det should check first if there is any zero column. If so det is zero and LU_decomp is not required any more.

   if any(all(almosteq(0,x) for x in A[:,c]) for c in range(A.cols)):
       return 0*A[0,0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions