gaussian-elimination-co
Version:
A library implementing Gauissian Elmination in typescript
66 lines (65 loc) • 1.99 kB
TypeScript
declare type Tuple<T, Length extends number> = [T, ...T[]] & {
length: Length;
};
export declare class Tableau<LHSWidth extends number, RHSWidth extends number> {
private rows;
constructor(rows: Tuple<Row<LHSWidth, RHSWidth>, LHSWidth>);
/**
* Constructs a tableau from nested arrays
*
* @param input
*/
static from<LHSWidth extends number, RHSWidth extends number>(input: Tuple<[Tuple<number, LHSWidth>, Tuple<number, RHSWidth>], LHSWidth>): Tableau<LHSWidth, RHSWidth>;
/**
* Solves the set of equations
*/
solve(): Tuple<Tuple<number, RHSWidth>, LHSWidth>;
/**
* Gets the left-hand side of the tableau
*/
getLHS(): Tuple<Tuple<number, RHSWidth>, LHSWidth>;
/**
* Gets the first elements of the left-hand side of the tableau.
*/
getLHSFirsts(): Tuple<number, LHSWidth>;
/**
* Prints out the Tableau
*/
inspect(): void;
private gauss;
private checkValidity;
private jordan;
private lhsGet;
private lhsSet;
/**
* The LHS matrix needs to have the y=-x entries be non-zero
* @private
*/
private orderRows;
private get lhsWidth();
private get rhsWidth();
private get height();
}
/**
* Is used to build the rows of a Tableau
*/
export declare class Row<LHSWidth extends number, RHSWidth extends number> {
lhs: RowSide<LHSWidth>;
rhs: RowSide<RHSWidth>;
constructor(lhs: RowSide<LHSWidth>, rhs: RowSide<RHSWidth>);
subtractMultiple(row: Row<LHSWidth, RHSWidth>, multiple: number): void;
divideBy(multiple: number): void;
get lhsWidth(): LHSWidth;
get rhsWidth(): RHSWidth;
get validIndices(): number[];
}
/**
* Is used to build a Row
*/
export declare class RowSide<Width extends number> {
values: Tuple<number, Width>;
constructor(values: Tuple<number, Width>);
subtractMultiple(rhs: RowSide<Width>, multiple: number): void;
divideBy(multiple: number): void;
}
export {};