MCPcopy Create free account
hub / github.com/apache/madlib / makeEmptySvec

Function makeEmptySvec

methods/svec/src/pg_gp/sparse_vector.c:349–364  ·  view source on GitHub ↗

* Makes an empty svec with sufficient memory allocated for the input number */

Source from the content-addressed store, hash-verified

347 * Makes an empty svec with sufficient memory allocated for the input number
348 */
349SvecType *makeEmptySvec(int allocation)
350{
351 int val_len = sizeof(float8)*allocation+1;
352 int ind_len = 9*allocation+1;
353 SvecType *svec;
354 SparseData sdata = makeEmptySparseData();
355 sdata->vals->data = (char *)palloc(val_len);
356 sdata->vals->len = 0;
357 sdata->vals->maxlen = val_len;
358 sdata->index->data = (char *)palloc(ind_len);
359 sdata->index->len = 0;
360 sdata->index->maxlen = ind_len;
361 svec = svec_from_sparsedata(sdata,false);
362 freeSparseDataAndData(sdata);
363 return(svec);
364}
365
366/**
367 * Allocates more space for the count and data arrays of an svec

Callers 1

svec_pivotFunction · 0.85

Calls 3

makeEmptySparseDataFunction · 0.85
svec_from_sparsedataFunction · 0.85
freeSparseDataAndDataFunction · 0.85

Tested by

no test coverage detected