Esempio n. 1
0
  /*
   * simple generic implementation, can take advantage of sparsity structor
   * of this matrix, but not the given one.
   * @see org.genemania.engine.matricks.Matrix#elementMultiplySum(org.genemania.engine.matricks.Matrix)
   */
  public double elementMultiplySum(Matrix m) {
    double sum = 0d;

    MatrixCursor cursor = this.cursor();
    while (cursor.next()) {
      sum += cursor.val() * m.get(cursor.row(), cursor.col());
    }

    return sum;
  }