Add the vectors of all documents to a composite vector.
422099
void set_composite_vector()
    {
        composite_.clear();
        for (Document<K> document : documents_)
        {
            composite_.add_vector(document.feature());
        }
    }
267654
def populate(self, blueprint, documents):
        """"""

        # Finish the documents
        documents = self.finish(blueprint, documents)

        # Convert the documents to frame instances
        frames = []
        for document in documents:
            # Separate out any meta fields
            meta_document = {}
            for field_name in blueprint._meta_fields:
                meta_document[field_name] = document[field_name]
                document.pop(field_name)

            # Initialize the frame
            frame = blueprint.get_frame_cls()(document)

            # Apply any meta fields
            for key, value in meta_document.items():
                setattr(frame, key, value)

            frames.append(frame)

        # Insert the documents
        blueprint.on_fake(frames)
        frames = blueprint.get_frame_cls().insert_many(frames)
        blueprint.on_faked(frames)

        return frames
333988
def add_docs(self, docs):
        """"""
        return self.query(
            'solr',
            '<add>{}</add>'.format(
                ''.join([self._format_add(fields) for fields in docs])
            ),
            do_post=True,
        )
416139
def concat_ast(asts: Sequence[DocumentNode]) -> DocumentNode:
    
    return DocumentNode(
        definitions=list(chain.from_iterable(document.definitions for document in asts))
    )
493106
def text_to_vector(sent_str):
    """"""
    r = requests.get("{}/sva/vector".format(VECTORIZE_API), params={'s':sent_str})
    return inflate(r.text)
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;
    }
100159
def transform(self, document):
        
        if isinstance(document, RDD):
            return document.map(self.transform)

        freq = {}
        for term in document:
            i = self.indexOf(term)
            freq[i] = 1.0 if self.binary else freq.get(i, 0) + 1.0
        return Vectors.sparse(self.numFeatures, freq.items())
310120
def add_vectors(vec_a, vec_b, periodic):
    '''

    '''
    moved = noperiodic(np.array([vec_a, vec_b]), periodic)
    return vec_a + vec_b
975620
public Vector4i add(int x, int y, int z, int w) {
        return add(x, y, z, w, thisOrNew());
    }
193010
def combine_results(self, results):
        """"""
        result = {}
        for key in results[0]:
            result[key] = numpy.concatenate([r[key] for r in results])
        return result
370402
private AFromModuleImports importAll(ILexIdentifierToken from)
	{
		List<List<PImport>> types = new Vector<List<PImport>>();
		ILexNameToken all = new LexNameToken(from.getName(), "all", from.getLocation());
		List<PImport> impAll = new Vector<PImport>();
		AAllImport iport = AstFactory.newAAllImport(all);
		iport.setLocation(all.getLocation());
		iport.setName(all);
		iport.setRenamed(all);
		iport.setFrom(null);
		impAll.add(iport);
		types.add(impAll);
		return AstFactory.newAFromModuleImports(from, types);
	}
123570
public Vector<Object> marshallize()
    {
        Vector<Object> vector = new Vector<Object>();
        vector.add(NODE_TITLE_INDEX, title);
        vector.add(NODE_EXECUTABLE_INDEX, executable);
        vector.add(NODE_CAN_BE_IMPLEMENTED_INDEX, canBeImplemented);

        Hashtable<String, Object> hashtable = new Hashtable<String, Object>();
        for (DocumentNode node : children)
            hashtable.put(node.getTitle(), node.marshallize());

        vector.add(NODE_CHILDREN_INDEX, hashtable);

        return vector;
    }
914195
private static void vectorSwap(PagesIndex pagesIndex, int from, int l, int s)
    {
        for (int i = 0; i < s; i++, from++, l++) {
            pagesIndex.swap(from, l);
        }
    }
277436
def wr_row_mergeall(self, worksheet, txtstr, fmt, row_idx):
        """"""
        hdridxval = len(self.hdrs) - 1
        worksheet.merge_range(row_idx, 0, row_idx, hdridxval, txtstr, fmt)
        return row_idx + 1
1338269
def add(self, documents, boost=None):
        

        if not isinstance(documents, list):
            documents = [documents]
        documents = [{'doc': d} for d in documents]
        if boost:
            for d in documents:
                d['boost'] = boost

        self._add_batch.extend(documents)

        if len(self._add_batch) > SOLR_ADD_BATCH:
            self._addFlushBatch()
78257
def merge(self, other):
        """"""
        other.qindex.normalize, other.qindex.num_best = False, self.topsims
        # update precomputed "most similar" for old documents (in case some of
        # the new docs make it to the top-N for some of the old documents)
        logger.info("updating old precomputed values")
        pos, lenself = 0, len(self.qindex)
        for chunk in self.qindex.iter_chunks():
            for sims in other.qindex[chunk]:
                if pos in self.pos2id:
                    # ignore masked entries (deleted, overwritten documents)
                    docid = self.pos2id[pos]
                    sims = self.sims2scores(sims)
                    self.id2sims[docid] = merge_sims(self.id2sims[docid], sims, self.topsims)
                pos += 1
                if pos % 10000 == 0:
                    logger.info("PROGRESS: updated doc #%i/%i" % (pos, lenself))
        self.id2sims.sync()

        logger.info("merging fresh index into optimized one")
        pos, docids = 0, []
        for chunk in other.qindex.iter_chunks():
            for vec in chunk:
                if pos in other.pos2id: # don't copy deleted documents
                    self.qindex.add_documents([vec])
                    docids.append(other.pos2id[pos])
                pos += 1
        self.qindex.save()
        self.update_ids(docids)

        logger.info("precomputing most similar for the fresh index")
        pos, lenother = 0, len(other.qindex)
        norm, self.qindex.normalize = self.qindex.normalize, False
        topsims, self.qindex.num_best = self.qindex.num_best, self.topsims
        for chunk in other.qindex.iter_chunks():
            for sims in self.qindex[chunk]:
                if pos in other.pos2id:
                    # ignore masked entries (deleted, overwritten documents)
                    docid = other.pos2id[pos]
                    self.id2sims[docid] = self.sims2scores(sims)
                pos += 1
                if pos % 10000 == 0:
                    logger.info("PROGRESS: precomputed doc #%i/%i" % (pos, lenother))
        self.qindex.normalize, self.qindex.num_best = norm, topsims
        self.id2sims.sync()
713430
public Vector4f add(float x, float y, float z, float w, Vector4f dest) {
        dest.x = this.x + x;
        dest.y = this.y + y;
        dest.z = this.z + z;
        dest.w = this.w + w;
        return dest;
    }