File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33module . exports = abstractMatrix ;
44
5+ var LuDecomposition = require ( './dc/lu' ) ;
56var arrayUtils = require ( 'ml-array-utils' ) ;
67var util = require ( './util' ) ;
78var MatrixTransposeView = require ( './views/transpose' ) ;
@@ -1511,7 +1512,6 @@ function abstractMatrix(superCtor) {
15111512 *
15121513 * @return {number }
15131514 */
1514-
15151515 det ( ) {
15161516 if ( this . isSquare ( ) ) {
15171517 if ( this . columns === 2 ) {
@@ -1539,9 +1539,8 @@ function abstractMatrix(superCtor) {
15391539 return a * subMatrix0 . det ( ) - b * subMatrix1 . det ( ) + c * subMatrix2 . det ( ) ;
15401540
15411541 } else {
1542- // general purpose determinant
1543-
1544- throw Error ( 'Not implemented yet' ) ;
1542+ // general purpose determinant using the LU decomposition
1543+ return new LuDecomposition ( this , { skipCheck :true } ) . determinant ;
15451544 }
15461545
15471546 } else {
Original file line number Diff line number Diff line change 33var Matrix = require ( '../matrix' ) ;
44
55// https://github.com/lutzroeder/Mapack/blob/master/Source/LuDecomposition.cs
6- function LuDecomposition ( matrix ) {
6+ function LuDecomposition ( matrix , options ) {
77 if ( ! ( this instanceof LuDecomposition ) ) {
88 return new LuDecomposition ( matrix ) ;
99 }
10- matrix = Matrix . checkMatrix ( matrix ) ;
10+
11+ options = options || { } ;
12+
13+ if ( ! options . skipCheck ) {
14+ matrix = Matrix . checkMatrix ( matrix ) ;
15+ }
1116
1217 var lu = matrix . clone ( ) ,
1318 rows = lu . rows ,
You can’t perform that action at this time.
0 commit comments