/** * Sets the matrix cell at coordinate <tt>[row,column]</tt> to the specified value. * * <p>Provided with invalid parameters this method may access illegal indexes without throwing any exception. * <b>You should only use this method when you are absolutely sure that the coordinate is within bounds.</b> * Precondition (unchecked): <tt>0 <= column < columns() && 0 <= row < rows()</tt>. * * @param row the index of the row-coordinate. * @param column the index of the column-coordinate. * @param value the value to be filled into the specified cell. */ public void setQuick(int row, int column, double value) { int k = indexes.binarySearchFromTo(column,starts[row],starts[row+1]-1); if (k>=0) { // found if (value==0) remove(row,k); else values.setQuick(k,value); return; } if (value!=0) { k = -k-1; insert(row,column,k,value); } } public void trimToSize() {
/** * Sets the matrix cell at coordinate <tt>[row,column]</tt> to the specified value. * * <p>Provided with invalid parameters this method may access illegal indexes without throwing any exception. * <b>You should only use this method when you are absolutely sure that the coordinate is within bounds.</b> * Precondition (unchecked): <tt>0 <= column < columns() && 0 <= row < rows()</tt>. * * @param row the index of the row-coordinate. * @param column the index of the column-coordinate. * @param value the value to be filled into the specified cell. */ public void setQuick(int row, int column, double value) { int k = indexes.binarySearchFromTo(column,starts[row],starts[row+1]-1); if (k>=0) { // found if (value==0) remove(row,k); else values.setQuick(k,value); return; } if (value!=0) { k = -k-1; insert(row,column,k,value); } } public void trimToSize() {
/** * Fills all keys and values <i>sorted ascending by key</i> into the specified lists. * Fills into the lists, starting at index 0. * After this call returns the specified lists both have a new size that equals <tt>this.size()</tt>. * <p> * <b>Example:</b> * <br> * <tt>keys = (8,7,6), values = (1,2,2) --> keyList = (6,7,8), valueList = (2,2,1)</tt> * * @param keyList the list to be filled with keys, can have any size. * @param valueList the list to be filled with values, can have any size. */ public void pairsSortedByKey(final IntArrayList keyList, final DoubleArrayList valueList) { keys(keyList); keyList.sort(); valueList.setSize(keyList.size()); for (int i=keyList.size(); --i >= 0; ) { valueList.setQuick(i,get(keyList.getQuick(i))); } } /**
/** * Fills all keys and values <i>sorted ascending by key</i> into the specified lists. * Fills into the lists, starting at index 0. * After this call returns the specified lists both have a new size that equals <tt>this.size()</tt>. * <p> * <b>Example:</b> * <br> * <tt>keys = (8,7,6), values = (1,2,2) --> keyList = (6,7,8), valueList = (2,2,1)</tt> * * @param keyList the list to be filled with keys, can have any size. * @param valueList the list to be filled with values, can have any size. */ public void pairsSortedByKey(final IntArrayList keyList, final DoubleArrayList valueList) { keys(keyList); keyList.sort(); valueList.setSize(keyList.size()); for (int i=keyList.size(); --i >= 0; ) { valueList.setQuick(i,get(keyList.getQuick(i))); } } /**
/** * Fills all keys and values <i>sorted ascending by key</i> into the * specified lists. Fills into the lists, starting at index 0. After this * call returns the specified lists both have a new size that equals * <tt>this.size()</tt>. * <p> * <b>Example:</b> <br> * <tt>keys = (8,7,6), values = (1,2,2) --> keyList = (6,7,8), valueList = (2,2,1)</tt> * * @param keyList * the list to be filled with keys, can have any size. * @param valueList * the list to be filled with values, can have any size. */ public void pairsSortedByKey(final IntArrayList keyList, final DoubleArrayList valueList) { keys(keyList); keyList.sort(); valueList.setSize(keyList.size()); for (int i = keyList.size(); --i >= 0;) { valueList.setQuick(i, get(keyList.getQuick(i))); } }
values[i].setQuick(k,value);
values[i].setQuick(k,value);