Public
Edited
Apr 5, 2023
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
A = {
// size of the squared matrix
const n = 40;
// create csc matrix from column pointers (ia), row indices (ja), and values (a)
return new CompressedColumnStorage(n, n, a, ja, ia);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
sparseLU = {
// size of the squared matrix
let n = 40;
// create csc matrix from column pointers (ia), row indices (ja), and values (a)
let A = new CompressedColumnStorage(n, n, a, ja, ia);
// initialize solver
return SparseLU.Create(A);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
// size of the squared matrix
let n = 40;
// initialize solution
let x = new Float64Array(n);
// solve A.x = b
sparseLU.Solve(b, x);
// check result
return test("Solution is correct", () => {
for (let i = 0; i < n; i++) {
if (assertAlmostEqual(x[i] - xExpected[i], 1e-10)) {
throw `invalid result at position ${i}:\n actual = ${x[i]}\n expected = ${xExpected[i]}\n error = ${x[i] - xExpected[i]}`;
}
}
});
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more