This project has moved. For the latest updates, please go here.

Linear dependent vectors

Jan 21, 2014 at 1:17 PM
We probably should add a method for that. In the meantime you can, for example, check whether the determinant of the 2x2 matrix of the vector's scalar products is zero:
var a = Vector<double>.Build.Dense(new[] {1.0,2,3,4});
var b = Vector<double>.Build.Dense(new[] {-2.0,-4,-6,-8});
var c = Vector<double>.Build.Dense(new[] {-2.0,-4,-6,-7});

Matrix<double>.Build.Dense(2, 2, new[] {a*a, b*a, a*b, b*b}).Determinant() // = 0, hence linearly dependent
Matrix<double>.Build.Dense(2, 2, new[] {a*c, c*a, a*c, c*c}).Determinant() // = -9016, hence linearly independent
PS: yes, either here or StackOverflow with "mathdotnet" tag