Skip to content

Commit

Permalink
add JSDOC to eigenvalueDecomposition (see #49)
Browse files Browse the repository at this point in the history
  • Loading branch information
veillette committed Jun 28, 2016
1 parent 60f4f9b commit eae8895
Showing 1 changed file with 50 additions and 12 deletions.
62 changes: 50 additions & 12 deletions js/EigenvalueDecomposition.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,23 @@ define( function( require ) {

// require( 'DOT/Matrix' ); // commented out so Require.js doesn't complain about the circular dependency

/**
*
* @param {Matrix} matrix - must be a square matrix
* @constructor
*/
function EigenvalueDecomposition( matrix ) {
var i;
var j;

var A = matrix.entries;
this.n = matrix.getColumnDimension(); // Row and column dimension (square matrix).
this.n = matrix.getColumnDimension(); // @private Row and column dimension (square matrix).
var n = this.n;
this.V = new ArrayType( n * n ); // Array for internal storage of eigenvectors.
this.V = new ArrayType( n * n ); // @private Array for internal storage of eigenvectors.

// Arrays for internal storage of eigenvalues.
this.d = new ArrayType( n );
this.e = new ArrayType( n );
this.d = new ArrayType( n ); // @private
this.e = new ArrayType( n ); // @private

this.issymmetric = true;
for ( j = 0; (j < n) && this.issymmetric; j++ ) {
Expand Down Expand Up @@ -87,22 +92,38 @@ define( function( require ) {
EigenvalueDecomposition.prototype = {
constructor: EigenvalueDecomposition,

// Return the eigenvector matrix
/**
* Returns a square array of all eigenvectors arranged in a columnar format
* @public
* @returns {ArrayType.<number>} - a n*n matrix
*/
getV: function() {
return this.V.copy();
},

// {Array} Return the real parts of the eigenvalues
/**
* Returns an array that contains the real part of the eigenvalues
* @public
* @returns {ArrayType.<number>} - a one dimensional array
*/
getRealEigenvalues: function() {
return this.d;
},

// {Array} Return the imaginary parts of the eigenvalues
/**
* Returns an array that contains the imaginary parts of the eigenvalues
* @public
* @returns {ArrayType.<number>} - a one dimensional array
*/
getImagEigenvalues: function() {
return this.e;
},

// Return the block diagonal eigenvalue matrix
/**
* Return the block diagonal eigenvalue matrix
* @public
* @returns {Matrix} - a n * n matrix
*/
getD: function() {
var n = this.n;
var d = this.d;
Expand All @@ -125,7 +146,10 @@ define( function( require ) {
return X;
},

// Symmetric Householder reduction to tridiagonal form.
/**
* Symmetric Householder reduction to tridiagonal form.
* @private
*/
tred2: function() {
var n = this.n;
var V = this.V;
Expand Down Expand Up @@ -252,7 +276,10 @@ define( function( require ) {
e[ 0 ] = 0.0;
},

// Symmetric tridiagonal QL algorithm.
/**
* Symmetric tridiagonal QL algorithm.
* @private
*/
tql2: function() {
var n = this.n;
var V = this.V;
Expand Down Expand Up @@ -382,7 +409,10 @@ define( function( require ) {
}
},

// Nonsymmetric reduction to Hessenberg form.
/**
* Nonsymmetric reduction to Hessenberg form.
* @private
*/
orthes: function() {
var n = this.n;
var V = this.V;
Expand Down Expand Up @@ -501,7 +531,15 @@ define( function( require ) {
}
},

// Nonsymmetric reduction from Hessenberg to real Schur form.
/**
* This methods finds the eigenvalues and eigenvectors
* of a real upper hessenberg matrix by the QR algorithm
*
* Nonsymmetric reduction from Hessenberg to real Schur form.
* https://en.wikipedia.org/wiki/QR_algorithm
*
* @private
*/
hqr2: function() {
var n;
var V = this.V;
Expand Down

0 comments on commit eae8895

Please sign in to comment.