/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override final public void identity() { // First get rid of any values already in there for (int i = 0; i < numRows; ++i) { rows[i].clear(); } // Kill compressed representation if there ... update to new values int diagLen = (numRows <= numCols) ? numRows : numCols; values = new double[diagLen]; Arrays.fill(values, 1); firstIndicesForRows = getZeroToNMinusOneArray(numRows + 1); columnIndices = getZeroToNMinusOneArray(diagLen); // We just need to update the first indices for the rows if this is a // tall rectangle matrix for (int i = diagLen; i < numRows + 1; ++i) { firstIndicesForRows[i] = diagLen; } }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override final public void identity() { // First get rid of any values already in there for (int i = 0; i < numRows; ++i) { rows[i].clear(); } // Kill compressed representation if there ... update to new values int diagLen = (numRows <= numCols) ? numRows : numCols; values = new double[diagLen]; Arrays.fill(values, 1); firstIndicesForRows = getZeroToNMinusOneArray(numRows + 1); columnIndices = getZeroToNMinusOneArray(diagLen); // We just need to update the first indices for the rows if this is a // tall rectangle matrix for (int i = diagLen; i < numRows + 1; ++i) { firstIndicesForRows[i] = diagLen; } }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override final public void identity() { // First get rid of any values already in there for (int i = 0; i < numRows; ++i) { rows[i].clear(); } // Kill compressed representation if there ... update to new values int diagLen = (numRows <= numCols) ? numRows : numCols; values = new double[diagLen]; Arrays.fill(values, 1); firstIndicesForRows = getZeroToNMinusOneArray(numRows + 1); columnIndices = getZeroToNMinusOneArray(diagLen); // We just need to update the first indices for the rows if this is a // tall rectangle matrix for (int i = diagLen; i < numRows + 1; ++i) { firstIndicesForRows[i] = diagLen; } }
/** * This method is provided so that the calling programmer can explicitly * declare when a matrix should be decompressed from the compressed Yale * format. Note that the method will be automatically compressed and * decompressed when various methods are called (e.g., decompressed for set* * methods, compressed for times, dotTimes, etc.). */ final public void decompress() { if (!isCompressed()) { return; } for (int i = 0; i < getNumRows(); ++i) { rows[i].clear(); for (int j = firstIndicesForRows[i]; j < firstIndicesForRows[i + 1]; ++j) { rows[i].setElement(columnIndices[j], values[j]); } } values = null; firstIndicesForRows = columnIndices = null; }
/** * This method is provided so that the calling programmer can explicitly * declare when a matrix should be decompressed from the compressed Yale * format. Note that the method will be automatically compressed and * decompressed when various methods are called (e.g., decompressed for set* * methods, compressed for times, dotTimes, etc.). */ final public void decompress() { if (!isCompressed()) { return; } for (int i = 0; i < getNumRows(); ++i) { rows[i].clear(); for (int j = firstIndicesForRows[i]; j < firstIndicesForRows[i + 1]; ++j) { rows[i].setElement(columnIndices[j], values[j]); } } values = null; firstIndicesForRows = columnIndices = null; }
/** * This method is provided so that the calling programmer can explicitly * declare when a matrix should be decompressed from the compressed Yale * format. Note that the method will be automatically compressed and * decompressed when various methods are called (e.g., decompressed for set* * methods, compressed for times, dotTimes, etc.). */ final public void decompress() { if (!isCompressed()) { return; } for (int i = 0; i < getNumRows(); ++i) { rows[i].clear(); for (int j = firstIndicesForRows[i]; j < firstIndicesForRows[i + 1]; ++j) { rows[i].setElement(columnIndices[j], values[j]); } } values = null; firstIndicesForRows = columnIndices = null; }
rows[i].clear(); firstIndicesForRows[i] = idx; for (int j = 0; j < numCols; ++j)
rows[i].clear(); firstIndicesForRows[i] = idx; for (int j = 0; j < numCols; ++j)
rows[i].clear(); firstIndicesForRows[i] = idx; for (int j = 0; j < numCols; ++j)
++curIdx; rows[i].clear();
++curIdx; rows[i].clear();
++curIdx; rows[i].clear();