How to use the ml-matrix.EigenvalueDecomposition function in ml-matrix

To help you get started, we’ve selected a few ml-matrix examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HelikarLab / ccNetViz / src / layout / spectral.js View on Github external
apply () {
      let A = create2dArray(this._nodes.length, this._nodes.length);
      // build the adjacency matrix
      for (let i=0; i a+b, 0);
      }
      let foo = new EigenvalueDecomposition(A);
      const iii = twoSmallest(foo.realEigenvalues);
      const foo_ = foo.eigenvectorMatrix.transpose();
      const x = foo_[iii[0]];
      const y = foo_[iii[1]];
      const xy = normalize(x, y);
      // var fooo = new Matrix.EigenvalueDecomposition(A);
      // var fooo = new Matrix.EigenvalueDecomposition(A);
      // recipe from http://www.sfu.ca/personal/archives/richards/Pages/NAS.AJS-WDR.pdf
      // and implemented in networkx/drawing/layout.py
      this._nodes.forEach(function(node, i){
          node.x = xy[0][i];
          node.y = xy[1][i];
      }); 
  }
};