UNPKG

alzebra

Version:

An All-In-One Herd of Linear Algebra Functions

46 lines (45 loc) 1.36 kB
import { BigNumberMatrix, NumberMatrix, NumberVector } from "./types"; export declare type EliminassianResult = { matrix: NumberMatrix; vector: NumberVector; }; export declare class Alzebra { /** * Big Number matrix to which operations are applied */ matrix: BigNumberMatrix; constructor(matrix: NumberMatrix); /** * Gaussian Elimination (Solving Systems of Linear Equations) * @param solutions - The solutions vector (b in Ax = b) * @returns An object with the reduced matrix and reduced vector (x in Ax = b if there is a solution) * @example * ```javascript * const matrix = [ * [1, 1, 0], * [0, 1, 1], * [2, 1, 1], * ]; * * const solutions = [10, 15, 25]; * const resultObj = new Alzebra(matrix).eliminassian(solutions); * * // This is what the `resultObj` variable is * const equivalentResultsObj = { * matrix: [ * [1, 0, 0], * [0, 1, 0], * [0, 0, 1], * ], * vector: [5, 5, 10] * } * ``` */ eliminassian(solutions: NumberVector): EliminassianResult; private static checkMatrixRows; private static bigNumVector; private static bigNumMatrix; static copyBigMatrix: (matrix: BigNumberMatrix) => BigNumberMatrix; } export * from "./types"; export default Alzebra;