Add a vector indexed
188174
def add_template_network_events(self, columns, vectors):
        
        # initialize with zeros - since vectors can be None, look for the
        # longest one that isn't
        new_events = None
        new_events = numpy.zeros(
            max([len(v) for v in vectors if v is not None]),
            dtype=self.network_event_dtype
        )
        # they shouldn't all be None
        assert new_events is not None
        new_events['template_id'] = self.template_index
        for c, v in zip(columns, vectors):
            if v is not None:
                if isinstance(v, Array):
                    new_events[c] = v.numpy()
                else:
                    new_events[c] = v
        self.template_events = numpy.append(self.template_events, new_events)
689058
def add(self, index, value):
        
        self.buf.append(value)
        if (index - self.flush_at) < self.interval:
            return
        value = np.mean(self.buf)
        if self.verbose:
            logger.info("iter={} {{{}}}={}".format(index, self.name, value))
        if self.fd is not None:
            print("{} {:g}".format(index, value), file=self.fd)
        self.flush_at = index
        self.buf = []
1162832
public void add(IVector b, IVector result) {
        if ((b == null) || (size != b.size)) return;

        if (result.size != size) result.reshape(size);

        int i;
        for (i = 0; i < size; i++) {
            result.realvector[i] = realvector[i] + b.realvector[i];
            result.imagvector[i] = imagvector[i] + b.imagvector[i];
        }
    }
394742
function indexPairs(num_pairs, context){
    var vertex_elements = context.vertex_data.vertex_elements;
    var num_vertices = context.vertex_data.vertex_count;
    var offset = num_vertices - 2 * num_pairs - 2;

    for (var i = 0; i < num_pairs; i++){
        vertex_elements.push(offset + 2 * i + 2);
        vertex_elements.push(offset + 2 * i + 1);
        vertex_elements.push(offset + 2 * i + 0);
        vertex_elements.push(offset + 2 * i + 2);
        vertex_elements.push(offset + 2 * i + 3);
        vertex_elements.push(offset + 2 * i + 1);
        context.geom_count += 2;
    }
}
416713
def set indexes, val
      cast(dtype: :array) if val.nil? && dtype != :array
      guard_type_check(val)

      if @index.valid?(*indexes)
        modify_vector(indexes, val)
      else
        insert_vector(indexes, val)
      end

      update_position_cache
    end
1052335
def addPointVectors(self, vectors, name):
        
        poly = self.polydata(False)
        if len(vectors) != poly.GetNumberOfPoints():
            colors.printc('~times addPointVectors Error: Number of vectors != nr. of points',
                          len(vectors), poly.GetNumberOfPoints(), c=1)
            exit()
        arr = vtk.vtkDoubleArray()
        arr.SetNumberOfComponents(3)
        arr.SetName(name)
        for v in vectors:
            arr.InsertNextTuple(v)
        poly.GetPointData().AddArray(arr)
        poly.GetPointData().SetActiveVectors(name)
        return self
748866
function newNestedIndex(vectors) {
  var arity = vectors.length;
  if (arity === 0) {
    throw new Error('cannot index an empty list of vectors');
  }
  var numRows = vectors[0].size();

  // Initialize properties
  var nestedIndex = Object.create(nestedIndexProto);
  nestedIndex.initVectors = vectors;
  nestedIndex.size = 0;
  nestedIndex.arity = arity;
  nestedIndex._dtypes = vectors.map(function(v) { return v.dtype; });
  nestedIndex._map = Object.create(null);

  // Build index
  var rootMap = nestedIndex._map;
  var lastColInd = arity - 1;
  for (var i = 0; i < numRows; i++) {
    var currMap = rootMap;
    var currVector, key;
    for (var j = 0; j < lastColInd; j++) {
      currVector = vectors[j];
      key = cleanKey(currVector.values[i], currVector.dtype);
      var innerMap = currMap[key];

      // Create innerMap if not present
      if (isUndefined(innerMap)) {
        currMap[key] = innerMap = Object.create(null);
      }
      currMap = innerMap;
    }

    // Add the row number to the entry
    currVector = vectors[lastColInd];
    key = cleanKey(currVector.values[i], currVector.dtype);
    var rowNums = currMap[key];
    if (isUndefined(rowNums)) {
      currMap[key] = i;
      nestedIndex.size++;
    } else if (typeof rowNums === 'number') {
      currMap[key] = [rowNums, i];
    } else {
      // rowNums must be an array
      rowNums.push(i);
    }
  }

  return nestedIndex;
}
623803
public void add(int num, int[] indices) {
        for (int i = 0; i < indices.length; ++i)
            indices[i] += num;
    }
52094
public void add(Vector3d v1) {
        x += v1.x;
        y += v1.y;
        z += v1.z;
    }
586381
private static String getVectorString(Vector vector) {
        StringBuffer buffer = new StringBuffer();
        int[] indices = vector.getIndices();
        double[] values = vector.getValues();
        for (int i = 0; i < indices.length; i++) {
            buffer.append(" ").append(indices[i]).append(":").append(values[i]);
        }
        return buffer.toString();
    }
1100680
def _add_row(self, index):
        
        self._index.append(index)
        self._data.append(None)
133028
public void add(IntLongVector other) {
        if (other instanceof IntLongUnsortedVector) {
            IntLongUnsortedVector vec = (IntLongUnsortedVector) other;
            for (int i=0; i<vec.top; i++) {
                this.add(vec.idx[i], vec.vals[i]);
            }
        } else {
            //  TODO: Add special case for IntLongDenseVector.
            other.iterate(new SparseBinaryOpApplier(this, new Lambda.LongAdd()));
        }
    }
1259908
public void plus(LinearSparseVector sv, float w) {
		if (sv == null)
			return;
		for (int i = 0; i < sv.length; i++) {
			float val = (float) sv.data[i] * w;
			add(sv.index[i], val);
		}
	}
706130
public void updateRow(int i, double c, Vec b)
    {
        if(b.length() != this.cols())
            throw new ArithmeticException("vector is not of the same column length");
        if (b.isSparse())
            for (IndexValue iv : b)
                this.increment(i, iv.getIndex(), c * iv.getValue());
        else
            for (int j = 0; j < b.length(); j++)
                this.increment(i, j, c * b.get(j));
    }
1266628
def _add_to_indices(self, pipeline):
        """"""
        for att in self.indices:
            self._add_to_index(att, pipeline=pipeline)
872062
public Vector2d add(Vector2fc v, Vector2d dest) {
        dest.x = x + v.x();
        dest.y = y + v.y();
        return dest;
    }
264322
def _add_indices(self):
        """"""
        self._logger.info('Adding database indices')
        self._conn.execute(constants.CREATE_INDEX_TEXTNGRAM_SQL)
        self._logger.info('Indices added')