GithubHelp home page GithubHelp logo

nvdnkpr / ndarray-lu-solve Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mikolalysenko/ndarray-lu-solve

0.0 2.0 0.0 73 KB

solve a system of linear equations from an LU decomposition

License: Other

ndarray-lu-solve's Introduction

ndarray-lu-solve

solve a system of linear equations from an LU decomposition

testling badge

build status

example

var solve = require('ndarray-lu-solve');
var show = require('ndarray-show');
var crout = require('ndarray-crout-decomposition');
var ndarray = require('ndarray');
var zeros = require('zeros');

var A = ndarray(
    [ 2, 1, -1, 8, -3, -1, 2, -11, -2, 1, 2, -3 ],
    [ 4, 3 ], [ 1, 4 ]
);
var L = zeros([ 3, 3 ]);
var U = zeros([ 3, 3 ]);
crout(A.hi(3,3), L, U);

var X = ndarray(new Float64Array(3));
var Y = ndarray(new Float64Array(3));
var solution = solve(L, U, A.lo(3,0).pick(0), X, Y);

console.log('input:\n' + show(A), '\n');
console.log('solution:\n' + show(solution));

output:

input:
   2.000    1.000   -1.000    8.000
  -3.000   -1.000    2.000  -11.000
  -2.000    1.000    2.000   -3.000 

solution:
   2.000    3.000   -1.000

methods

var solve = require('ndarray-lu-solve')

var solution = solve(L, U, B, X, Y)

Given an L and U ndarrays from a decomposition and a vector B, solve the system LY = B for Y and UX = Y for X.

The solution is written to X as the computation procedes but is also the return value.

Optional X and Y parameters are modified in-place and contain elements of the result. If not given, X and Y will be allocated.

install

With npm do:

npm install ndarray-lu-solve

license

MIT

ndarray-lu-solve's People

Contributors

mikolalysenko avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.