hivemall-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From takuti <...@git.apache.org>
Subject [GitHub] incubator-hivemall pull request #121: [HIVEMALL-151] Support Matrix conversi...
Date Thu, 12 Oct 2017 06:16:03 GMT
Github user takuti commented on a diff in the pull request:

    https://github.com/apache/incubator-hivemall/pull/121#discussion_r144195570
  
    --- Diff: core/src/main/java/hivemall/math/matrix/MatrixUtils.java ---
    @@ -70,4 +77,259 @@ public void apply(int i, int value) {
             return which.getValue();
         }
     
    +    /**
    +     * @param data non-zero entries
    +     */
    +    @Nonnull
    +    public static CSRMatrix coo2csr(@Nonnull final int[] rows, @Nonnull final int[] cols,
    +            @Nonnull final double[] data, @Nonnegative final int numRows,
    +            @Nonnegative final int numCols, final boolean sortColumns) {
    +        final int nnz = data.length;
    +        Preconditions.checkArgument(rows.length == nnz);
    +        Preconditions.checkArgument(cols.length == nnz);
    +
    +        final int[] rowPointers = new int[numRows + 1];
    +        final int[] colIndicies = new int[nnz];
    +        final double[] values = new double[nnz];
    +
    +        coo2csr(rows, cols, data, rowPointers, colIndicies, values, numRows, numCols,
nnz);
    +
    +        if (sortColumns) {
    +            sortIndicies(rowPointers, colIndicies, values);
    --- End diff --
    
    I found lots of typos `indicies` in many different classes...it's `indices`


---

Mime
View raw message