/** * Build a vector with known the sparseness and zero tolerance setting (for advanced use only). * @param dimension The size of the vector * @param expectedSize The expected number of non-zero entries * @param epsilon The tolerance for having a value considered zero */ public OpenMapRealVector(int dimension, int expectedSize, double epsilon) { virtualSize = dimension; entries = new OpenIntToDoubleHashMap(expectedSize, 0.0); this.epsilon = epsilon; }
/** * Build a vector with known the sparseness and zero tolerance setting (for advanced use only). * @param dimension The size of the vector * @param expectedSize The expected number of non-zero entries * @param epsilon The tolerance for having a value considered zero */ public OpenMapRealVector(int dimension, int expectedSize, double epsilon) { virtualSize = dimension; entries = new OpenIntToDoubleHashMap(expectedSize, 0.0); this.epsilon = epsilon; }
/** * Build a matrix by copying another one. * @param matrix matrix to copy */ public OpenMapRealMatrix(OpenMapRealMatrix matrix) { this.rows = matrix.rows; this.columns = matrix.columns; this.entries = new OpenIntToDoubleHashMap(matrix.entries); }
/** * Build a matrix by copying another one. * @param matrix matrix to copy */ public OpenMapRealMatrix(OpenMapRealMatrix matrix) { this.rows = matrix.rows; this.columns = matrix.columns; this.entries = new OpenIntToDoubleHashMap(matrix.entries); }
/** * Construct a (dimension)-length vector of zeros, specifying zero tolerance. * @param dimension Size of the vector * @param epsilon The tolerance for having a value considered zero */ public OpenMapRealVector(int dimension, double epsilon) { virtualSize = dimension; entries = new OpenIntToDoubleHashMap(0.0); this.epsilon = epsilon; }
/** * Build a sparse matrix with the supplied row and column dimensions. * @param rowDimension number of rows of the matrix * @param columnDimension number of columns of the matrix */ public OpenMapRealMatrix(int rowDimension, int columnDimension) { super(rowDimension, columnDimension); this.rows = rowDimension; this.columns = columnDimension; this.entries = new OpenIntToDoubleHashMap(0.0); }
/** * Construct a (dimension)-length vector of zeros, specifying zero tolerance. * @param dimension Size of the vector * @param epsilon The tolerance for having a value considered zero */ public OpenMapRealVector(int dimension, double epsilon) { virtualSize = dimension; entries = new OpenIntToDoubleHashMap(0.0); this.epsilon = epsilon; }
/** * Build a sparse matrix with the supplied row and column dimensions. * @param rowDimension number of rows of the matrix * @param columnDimension number of columns of the matrix */ public OpenMapRealMatrix(int rowDimension, int columnDimension) { super(rowDimension, columnDimension); this.rows = rowDimension; this.columns = columnDimension; this.entries = new OpenIntToDoubleHashMap(0.0); }
/** * Build a resized vector, for use with append. * @param v The original vector * @param resize The amount to resize it */ protected OpenMapRealVector(OpenMapRealVector v, int resize) { virtualSize = v.getDimension() + resize; entries = new OpenIntToDoubleHashMap(v.entries); epsilon = v.epsilon; }
/** * Build a resized vector, for use with append. * @param v The original vector * @param resize The amount to resize it */ protected OpenMapRealVector(OpenMapRealVector v, int resize) { virtualSize = v.getDimension() + resize; entries = new OpenIntToDoubleHashMap(v.entries); epsilon = v.epsilon; }
/** * Copy constructor. * @param v The instance to copy from */ public OpenMapRealVector(OpenMapRealVector v) { virtualSize = v.getDimension(); entries = new OpenIntToDoubleHashMap(v.getEntries()); epsilon = v.epsilon; }
/** * Create from a Double array. * Only non-zero entries will be stored * @param values The set of values to create from * @param epsilon The tolerance for having a value considered zero */ public OpenMapRealVector(Double[] values, double epsilon) { virtualSize = values.length; entries = new OpenIntToDoubleHashMap(0.0); this.epsilon = epsilon; for (int key = 0; key < values.length; key++) { double value = values[key].doubleValue(); if (!isDefaultValue(value)) { entries.put(key, value); } } }
/** * Copy constructor. * @param v The instance to copy from */ public OpenMapRealVector(OpenMapRealVector v) { virtualSize = v.getDimension(); entries = new OpenIntToDoubleHashMap(v.getEntries()); epsilon = v.epsilon; }
/** * Create from a Double array. * Only non-zero entries will be stored * @param values The set of values to create from * @param epsilon The tolerance for having a value considered zero */ public OpenMapRealVector(Double[] values, double epsilon) { virtualSize = values.length; entries = new OpenIntToDoubleHashMap(0.0); this.epsilon = epsilon; for (int key = 0; key < values.length; key++) { double value = values[key].doubleValue(); if (!isDefaultValue(value)) { entries.put(key, value); } } }
/** * Create from a double array, specifying zero tolerance. * Only non-zero entries will be stored * @param values The set of values to create from * @param epsilon The tolerance for having a value considered zero */ public OpenMapRealVector(double[] values, double epsilon) { virtualSize = values.length; entries = new OpenIntToDoubleHashMap(0.0); this.epsilon = epsilon; for (int key = 0; key < values.length; key++) { double value = values[key]; if (!isDefaultValue(value)) { entries.put(key, value); } } }
/** * Create from a double array, specifying zero tolerance. * Only non-zero entries will be stored * @param values The set of values to create from * @param epsilon The tolerance for having a value considered zero */ public OpenMapRealVector(double[] values, double epsilon) { virtualSize = values.length; entries = new OpenIntToDoubleHashMap(0.0); this.epsilon = epsilon; for (int key = 0; key < values.length; key++) { double value = values[key]; if (!isDefaultValue(value)) { entries.put(key, value); } } }
/** * Generic copy constructor. * @param v The instance to copy from */ public OpenMapRealVector(RealVector v) { virtualSize = v.getDimension(); entries = new OpenIntToDoubleHashMap(0.0); epsilon = DEFAULT_ZERO_TOLERANCE; for (int key = 0; key < virtualSize; key++) { double value = v.getEntry(key); if (!isDefaultValue(value)) { entries.put(key, value); } } }
/** * Generic copy constructor. * @param v The instance to copy from */ public OpenMapRealVector(RealVector v) { virtualSize = v.getDimension(); entries = new OpenIntToDoubleHashMap(0.0); epsilon = DEFAULT_ZERO_TOLERANCE; for (int key = 0; key < virtualSize; key++) { double value = v.getEntry(key); if (!isDefaultValue(value)) { entries.put(key, value); } } }