import { GaussianElimination, Matrix, RawMatrix } from "./matrix"; export class Vector extends Matrix { constructor(...coords: number[]) { let rm: RawMatrix = coords.map(c => [c]); super(...rm); } coords() { return this.matrix.map(row => row[0]); } } export class LinearIndependence { vectors: Vector[]; constructor(...v: Vector[]) { this.vectors = v; } check(): [boolean, (number[] | Matrix)] { let rows = this.vectors.map(v => [...v.coords(), 0]); let result = GaussianElimination.solve(new Matrix(...rows)); return [!(result instanceof Matrix), result]; } }