code: public synchronized int addColumn(double[] column) {
          if (isFinished)
              throw new IllegalStateException(
                  "Cannot add columns to a MatrixBuilder that is finished");
  
          // Update the size of the matrix based on the size of the array
          if (column.length > numRows)
              numRows = column.length;
  
          // Identify how many non-zero values are present in the column
          int nonZero = 0;
          for (int i = 0; i < column.length; ++i) {
              if (column[i] != 0d) 
                  nonZero++;
          }
  
          // Update the total number of non-zero values for the entire matrix
          nonZeroValues += nonZero;
  
          // Write the column to file
          try {
              matrixDos.writeInt(nonZero);
              for (int i = 0; i < column.length; ++i) {
                  if (column[i] != 0d) {
                      matrixDos.writeInt(i); // write the row index
                      matrixDos.writeFloat((float)column[i]);
                  }
              }
          } catch (IOException ioe) {
              throw new IOError(ioe);
          }
  
          return ++curCol;
      }
docs: {@inheritDoc}