Append the vectors array with the given vector. The iid of this vector will be equal to the current
value of the loadCounter.

@param vector
The vector to be indexed
@throws Exception
If the vector's dimensionality is different from vectorLength
439165
protected void indexVectorInternal(double[] vector) throws Exception {
		if (vector.length != vectorLength) {
			throw new Exception("The dimensionality of the vector is wrong!");
		}
		// append the persistent index
		appendPersistentIndex(vector);
		// append the ram-based index
		if (loadIndexInMemory) {
			vectorsList.add(vector);
		}
	}
23048
public void add(IntDoubleVector other) {
        if (other instanceof IntDoubleUnsortedVector) {
            IntDoubleUnsortedVector vec = (IntDoubleUnsortedVector) other;
            for (int i=0; i<vec.top; i++) {
                this.add(vec.idx[i], vec.vals[i]);
            }
        } else {
            //  TODO: Add special case for IntDoubleDenseVector.
            other.iterate(new SparseBinaryOpApplier(this, new Lambda.DoubleAdd()));
        }
    }
917555
public static double sum (double[] vector) {
        // Declare and initialize the accumulator:
        double total = 0.0;

        // Iterate over the vector:
        for (int i = 0; i < vector.length; i++) {
            total += vector[i];
        }

        // Done, return:
        return total;
    }
337495
def append_vector(self, name, vector, _left=False):
        """"""
        if np.issubdtype(vector.dtype, np.integer):
            # determine the length we need
            largest = str(max(vector.max(), vector.min(), key=abs))
            length = max(len(largest), min(7, len(name)))  # how many spaces we need to represent

            if len(name) > length:
                header = name[:length-1] + '.'
            else:
                header = name.rjust(length)

            def f(datum):
                return str(getattr(datum, name)).rjust(length)
        elif np.issubdtype(vector.dtype, np.floating):
            largest = np.format_float_positional(max(vector.max(), vector.min(), key=abs),
                                                 precision=6, trim='0')
            length = max(len(largest), min(7, len(name)))  # how many spaces we need to represent
            if len(name) > length:
                header = name[:length-1] + '.'
            else:
                header = name.rjust(length)

            def f(datum):
                return np.format_float_positional(getattr(datum, name),
                                                  precision=6, trim='0',
                                                  ).rjust(length)
        else:
            length = 7
            if len(name) > length:
                header = name[:length-1] + '.'
            else:
                header = name.rjust(length)

            def f(datum):
                r = repr(getattr(datum, name))
                if len(r) > length:
                    r = r[:length-3] + '...'
                return r.rjust(length)

        self.append(header, f, _left=_left)
449793
public void add(IntIntVector other) {
        if (other instanceof IntIntUnsortedVector) {
            IntIntUnsortedVector vec = (IntIntUnsortedVector) other;
            for (int i=0; i<vec.top; i++) {
                this.add(vec.idx[i], vec.vals[i]);
            }
        } else {
            //  TODO: Add special case for IntIntDenseVector.
            other.iterate(new SparseBinaryOpApplier(this, new Lambda.IntAdd()));
        }
    }
30244
public Matrix insertRow(int i, Vector row) {
        if (i > rows || i < 0) {
            throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + rows);
        }

        Matrix result;
        if (columns == 0) {
            result = blankOfShape(rows + 1, row.length());
        } else {
            result = blankOfShape(rows + 1, columns);
        }

        for (int ii = 0; ii < i; ii++) {
            result.setRow(ii, getRow(ii));
        }

        result.setRow(i, row);

        for (int ii = i; ii < rows; ii++) {
            result.setRow(ii + 1, getRow(ii));
        }

        return result;
    }
1282805
public static Vector createVector(int dimension) {
		if (dimension<=0) throw new IllegalArgumentException();
		switch (dimension) {
			case 2: return createVector2();
			case 3: return createVector3();
			case 4: return createVector4();
			default: return new VectorImpl(dimension);
		}
	}
848646
private static void add(IntegerVector semantics, TernaryVector index) {
        // Lock on the semantic vector to avoid a race condition with another
        // thread updating its semantics.  Use the vector to avoid a class-level
        // lock, which would limit the concurrency.
        synchronized(semantics) {
            for (int p : index.positiveDimensions())
                semantics.add(p, 1);
            for (int n : index.negativeDimensions())
                semantics.add(n, -1);
        }
    }
868744
public Vector add(double value) {
        VectorIterator it = iterator();
        Vector result = blank();

        while (it.hasNext()) {
            double x = it.next();
            int i = it.index();
            result.set(i, x + value);
        }

        return result;
    }
1179487
public void merge(final Vector other) {
	for(int i =0; i<other.size(); i++) {
	    this.merge((ByteRange)other.elementAt(i));
	}
    }
1336789
public static Vector add(Vector vector1, Vector vector2) {
        if (vector2.length() != vector1.length())
            throw new IllegalArgumentException(
                    "Vectors of different sizes cannot be added");
        if (vector2 instanceof IntegerVector &&
            vector1 instanceof DoubleVector)
            return add(vector1, Vectors.asDouble(vector2));
        if (vector2 instanceof SparseVector)
            addSparseValues(vector1, vector2);
        else {
            int length = vector2.length();
            for (int i = 0; i < length; ++i) {
                double value = vector2.getValue(i).doubleValue() +
                               vector1.getValue(i).doubleValue();
                vector1.set(i, value);
            }
        }

        return vector1;
    }
213861
private void setInput(double[] x) {
        if (x.length != inputLayer.units) {
            throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, inputLayer.units));
        }
        System.arraycopy(x, 0, inputLayer.output, 0, inputLayer.units);
    }
313570
private void setvdWaals() throws Exception {
        List data = new Vector();
        st.nextToken();
        String sid = st.nextToken();
        String sradius = st.nextToken();
        String sepsi = st.nextToken();
        try {
            double epsi = new Double(sepsi).doubleValue();
            double radius = new Double(sradius).doubleValue();
            data.add(new Double(radius));
            data.add(new Double(epsi));

        } catch (NumberFormatException nfe) {
            throw new IOException("VdWaalsTable.ReadvdWaals: " + "Malformed Number");
        }
        key = "vdw" + sid;
        //if (parameterSet.containsKey(key)){System.out.println("KeyError: hasKey "+key);}
        parameterSet.put(key, data);
    }
455641
public void addRow(String[] data) {

        if (data.length != iColCount) {
            return;
        }

        String[] row = new String[iColCount];

        for (int i = 0; i < iColCount; i++) {
            row[i] = data[i];

            if (row[i] == null) {
                row[i] = "(null)";
            }
        }

        vData.addElement(row);

        iRowCount++;
    }
595315
private void setStrBnd() throws Exception {
        List data = new Vector();
        st.nextToken();
        String scode = st.nextToken(); // String scode
        String sid1 = st.nextToken();
        String sid2 = st.nextToken();
        String sid3 = st.nextToken();
        String value1 = st.nextToken();
        String value2 = st.nextToken();

        try {
            //int code=new Integer(scode).intValue();
            double va1 = new Double(value1).doubleValue();
            double va2 = new Double(value2).doubleValue();
            data.add(new Double(va1));
            data.add(new Double(va2));

        } catch (NumberFormatException nfe) {
            throw new IOException("setStrBnd: Malformed Number due to:" + nfe);
        }
        key = "strbnd" + scode + ";" + sid1 + ";" + sid2 + ";" + sid3;
        LOG.debug("key =" + key);
        parameterSet.put(key, data);
    }
733058
private void add(Element element)
    {
        if (ivElements == null)
        {
            ivElements = new Element[DEFAULT_CAPACITY];
        }
        else if (ivTailIndex == ivElements.length)
        {
            // No more room at the tail of the array.  If we're completely out of
            // space (ivBaseIndex == 0), then we need a bigger array.  Otherwise,
            // determine if we can reset ivBaseIndex to 0 without needing to copy
            // more than half the elements.  If not, we allocate a new array.
            //
            // We choose to limit to half the array to avoid repeatedly copying
            // the array.  For example, if the array is full and ivBaseIndex == 0,
            // and we have a sequence of remove(0)/add(x), we do not want:
            //   - remove(0): ivBaseIndex++
            //   - add(x): copy 1..N to 0..N-1, ivBaseIndex=0, array[N] = x
            //   - remove(0): ivBaseIndex++
            //   - add(x): copy 1..N to 0..N-1, ivBaseIndex=0, array[N] = x
            //   - ...etc.

            int size = size();
            int halfCapacity = ivElements.length >> 1;
            if (ivHeadIndex > halfCapacity)
            {
                // Less than half of the array is full.  Rather than creating a new
                // array, just copy all the elements to the front.
                System.arraycopy(ivElements, ivHeadIndex, ivElements, 0, size);
                Arrays.fill(ivElements, ivHeadIndex, ivElements.length, null);
            }
            else
            {
                // Either we're completely out of space (ivBaseIndex == 0), or it
                // would be wasteful to continuously copy over half the elements.
                // Grow the array by half its current size.
                Element[] newElements = new Element[ivElements.length + halfCapacity];
                System.arraycopy(ivElements, ivHeadIndex, newElements, 0, size);
                ivElements = newElements;
            }

            ivHeadIndex = 0;
            ivTailIndex = size;
        }

        ivElements[ivTailIndex++] = element;
    }
912815
void add_vector(SparseVector vec)
    {

        for (Map.Entry<Integer, Double> entry : vec.entrySet())
        {
            Double v = get(entry.getKey());
            if (v == null)
                v = 0.;
            put(entry.getKey(), v + entry.getValue());
        }
    }