Skip to content

Why is the determinant of the zero matrix NaN? #453

Open
@neomaru

Description

@neomaru

Matrix m1=new DenseMatrix(3,3,new double[]{
0,0,0,
0,0,0,
0,0,0
});
Console.WriteLine(m1);
Console.WriteLine("det={0}",m1.Determinant()); //det=NaN

//OR

Matrix m2=new DenseMatrix(3,3,new double[]{
0,0,0,
1,1,1,
1,1,1
});
Console.WriteLine(m2);
Console.WriteLine("det={0}",m2.Determinant()); //det=NaN

//However, the following result is correct

Matrix m3=new DenseMatrix(3,3,new double[]{
0.5,0,0,
0 ,1,0,
0 ,0,1
});
Console.WriteLine(m3);
Console.WriteLine("det={0}",m3.Determinant());//det=0.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions