public static DMatrixRMaj sumRows(DMatrixSparseCSC input , @Nullable DMatrixRMaj output ) {
        if( output == null ) {
            output = new DMatrixRMaj(input.numRows,1);
        } else {
            output.reshape(input.numRows,1);
        }

        Arrays.fill(output.data,0,input.numRows,0);

        for (int col = 0; col < input.numCols; col++) {
            int idx0 = input.col_idx[col];
            int idx1 = input.col_idx[col + 1];

            for (int i = idx0; i < idx1; i++) {
                output.data[input.nz_rows[i]] += input.nz_values[i];
            }
        }

        return output;
    }
public static DMatrixRMaj sumRows ( DMatrixSparseCSC input , @ Nullable DMatrixRMaj output ) { if ( output == null ) { output = new DMatrixRMaj ( input . numRows , 1 ) ; } else { output . reshape ( input . numRows , 1 ) ; } Arrays . fill ( output . data , 0 , input . numRows , 0 ) ; for ( int col = 0 ; col < input . numCols ; col ++ ) { int idx0 = input . col_idx [ col ] ; int idx1 = input . col_idx [ col + 1 ] ; for ( int i = idx0 ; i < idx1 ; i ++ ) { output . data [ input . nz_rows [ i ] ] += input . nz_values [ i ] ; } } return output ; }
<p>
Computes the sum of each row in the input matrix and returns the results in a vector:<br>
<br>
b<sub>j</sub> = sum(i=1:n ; a<sub>ji</sub>)
</p>

@param input Input matrix
@param output Optional storage for output. Reshaped into a column vector. Modified.
@return Vector containing the sum of each row