public SparseRealMatrix()

in src/main/java/com/twitter/sbf/core/SparseRealMatrix.java [34:55]


  public SparseRealMatrix(SparseBinaryMatrix nonZeroStructure, double[][] realValues) {
    this.nonZeroStructure = nonZeroStructure;
    this.realValues = realValues;
    //Initialize column and row norms
    this.columnNorms = new double[nonZeroStructure.getNumCols()];
    this.rowNorms = new double[nonZeroStructure.getNumRows()];
    for (int i = 0; i < nonZeroStructure.getNumRows(); i++) {
      int[] rowWithColIds = nonZeroStructure.getRow(i);
      double[] rowWithValues = realValues[i];
      for (int j = 0; j < rowWithColIds.length; j++) {
        this.columnNorms[rowWithColIds[j]] += rowWithValues[j] * rowWithValues[j];
        this.rowNorms[i] += rowWithValues[j] * rowWithValues[j];
      }
    }
    //Apply square root function to each entry of rowNorms and columnNorms
    for (int row = 0; row < rowNorms.length; row++) {
      rowNorms[row] = Math.sqrt(rowNorms[row]);
    }
    for (int col = 0; col < columnNorms.length; col++) {
      columnNorms[col] = Math.sqrt(columnNorms[col]);
    }
  }