Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cholesky-solve

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cholesky-solve - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

37

index.js

@@ -164,15 +164,15 @@ function ldl_symbolic

function ldl_permt(
n, /* size of X, B, and P */
X, /* output of size n. */
B, /* input of size n. */
P /* input permutation array of size n. */
n, /* size of X, B, and P */
X, /* output of size n. */
B, /* input of size n. */
P /* input permutation array of size n. */
) {
var j
for (j = 0; j < n; j++)
{
X [P[j]] = B[j]
}
var j
for (j = 0; j < n; j++)
{
X [P[j]] = B[j]
}
}
function choleskySolve (M, b, n, P) {
function prepare (M, n, P) {
const ANZ = M.length

@@ -273,9 +273,12 @@

if (d === n) {
ldl_perm(n, bp1, b, P);
ldl_lsolve(n, bp1, Lp, Li, Lx)
ldl_dsolve(n, bp1, D)
ldl_ltsolve(n, bp1, Lp, Li, Lx)
ldl_permt(n, x, bp1, P);
return function(b) {
ldl_perm(n, bp1, b, P);
ldl_lsolve(n, bp1, Lp, Li, Lx)
ldl_dsolve(n, bp1, D)
ldl_ltsolve(n, bp1, Lp, Li, Lx)
ldl_permt(n, x, bp1, P);
return x
return x
}
} else {

@@ -286,2 +289,2 @@ return null

module.exports = choleskySolve
module.exports.prepare = prepare
{
"name": "cholesky-solve",
"version": "0.1.0",
"version": "0.2.0",
"description": "This module solves sparse symmetric positive definite linear systems by using the Cholesky decomposition",

@@ -5,0 +5,0 @@ "main": "index.js",

# cholesky-solve[WIP]
This module solves sparse symmetric positive definite linear systems,
by finding the Cholesky decomposition, and then doing forward
substitution and backward substitution. It is basically a Javascript
port of the paper "Algorithm 8xx: a concise sparse Cholesky
factorization package". This kind of solver has many applications in
digital geometry processing.
by finding the Cholesky decomposition(the `LDL^T` decomposition, and not
the `LL^T` decomposition), and then doing forward substitution and
backward substitution. It is basically a Javascript port of the paper
"Algorithm 8xx: a concise sparse Cholesky factorization package". This
kind of solver has many applications in digital geometry processing.

@@ -49,6 +49,11 @@ ## Install

var P = require('cuthill-mckee')(M, n)
// solve the equation
// finally, solve the equation
// Mx = b
// and print x
console.log(choleskySolve(M, b, n, P))
// the `prepare` method returns a function that can be used to solve
// the equation for any value of b.
var solve = choleskySolve.prepare(M, n, P)
console.log(solve(b))
```

@@ -58,7 +63,9 @@

### `require("cholesky-solve")(M, b, n, [P])`
Solves the equation `Mx = b` by using the Cholesky decomposition.
### `require("cholesky-solve").prepare(M, n, [P])`
Decomposes `M` into the Cholesky decomposition of the form `LDL^T`. A
function is returned that can be used to solve the equation `Mx = b`,
for some given value of `b`.
* `M` a list of the matrix coefficients of the sparse matrix `M`.
* `b` the vector on the right-hand side. A regular array of length `n`
* `n` the dimension of the matrix `M`

@@ -70,2 +77,3 @@ * `P` encodes a permutation matrix that preconditions `M` before the Cholesky decomposition is solved for. A possible algorithm for finding a good permutation is

**Returns** An array encoding the solution to the equation `Mx = b`.
**Returns** A function that takes a single argument `b`. The function
returns the solution to the equation `Mx = b`, encoded as a simple array.

@@ -10,4 +10,9 @@ var choleskySolve = require('./')

function choleskySolveHelper(M, b, n, P) {
var solve = choleskySolve.prepare(M, n, P)
return solve(b)
}
function solveAndAssert(t, n, M, b, P, expectedSolution) {
var foundSolution = choleskySolve(M, b, n, P)
var foundSolution = choleskySolveHelper(M, b, n, P)

@@ -159,3 +164,3 @@ for(var i=0; i< n; ++i) {

// solve.
var foundSolution = choleskySolve(M, b, n, P)
var foundSolution = choleskySolveHelper(M, b, n, P)

@@ -162,0 +167,0 @@ // check that the residual vector is 0.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc