Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Calculate SVD using NumericJS for now
- Loading branch information
1 parent
6044fb7
commit abc1673
Showing
14 changed files
with
120 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
QUnit.module("SVD tests"); | ||
QUnit.test("SVD of 3x3 matrix", function (assert) { | ||
|
||
// test matrix | ||
let mat = [ | ||
[1, 3, 4], | ||
[6, 9, 8], | ||
[6, 7, 9] | ||
]; | ||
|
||
let expectedU = [[-0.25545925, -0.60219924, 0.75637071], | ||
[-0.69818735, 0.65607252, 0.28653669], | ||
[-0.66878622, -0.45489001, -0.58804768]]; | ||
|
||
let expectedD = [19.19848638, 1.66555095, 1.28220936]; | ||
|
||
let expectedVtranspose = [[-0.44051914, 0.36318063, -0.82100105], | ||
[-0.61106731, 0.54866225, 0.57058434], | ||
[-0.65767746, -0.75304022, 0.01976841]]; | ||
|
||
let result = wpd.svd(mat); | ||
|
||
assert.equal(wpdtest.matCompare(result.U, expectedU, 1e-5), true, "U"); | ||
assert.equal(wpdtest.vecCompare(result.D, expectedD, 1e-5), true, "D"); | ||
assert.equal(wpdtest.matCompare(result.V, expectedVtranspose, 1e-5), true, "V"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.