@@ -487,4 +487,78 @@ public final AggregateMetricDoubleBlock newAggregateMetricDoubleBlock(
487487 public long maxPrimitiveArrayBytes () {
488488 return maxPrimitiveArrayBytes ;
489489 }
490+
491+ public DenseVectorBlock .Builder newDenseVectorBlockBuilder (int estimatedSize ) {
492+ return new DenseVectorBlockBuilder (estimatedSize , this );
493+ }
494+
495+ public final DenseVectorBlock newDenseVectorArrayBlock (
496+ float [][] values ,
497+ int dimensions ,
498+ int positionCount ,
499+ int [] firstValueIndexes ,
500+ BitSet nulls ,
501+ MvOrdering mvOrdering
502+ ) {
503+ return newDenseVectorArrayBlock (values , dimensions , positionCount , firstValueIndexes , nulls , mvOrdering , 0L );
504+ }
505+
506+ public DenseVectorBlock newDenseVectorArrayBlock (
507+ float [][] values ,
508+ int dimensions ,
509+ int pc ,
510+ int [] fvi ,
511+ BitSet nulls ,
512+ MvOrdering mvOrdering ,
513+ long preAdjustedBytes
514+ ) {
515+ var b = new DenseVectorArrayBlock (values , pc , fvi , nulls , mvOrdering , this );
516+ adjustBreaker (b .ramBytesUsed () - preAdjustedBytes );
517+ return b ;
518+ }
519+
520+ public DenseVectorVector .Builder newDenseVectorVectorBuilder (int estimatedSize , int dimensions ) {
521+ return new DenseVectorVectorBuilder (dimensions , estimatedSize , this );
522+ }
523+
524+ /**
525+ * Build a {@link DenseVectorVector.FixedBuilder} that never grows.
526+ */
527+ public DenseVectorVector .FixedBuilder newDenseVectorVectorFixedBuilder (int dimensions , int size ) {
528+ return new DenseVectorVectorFixedBuilder (dimensions , size , this );
529+ }
530+
531+ /**
532+ * Creates a new Vector with the given values and positionCount, where the caller has already
533+ * pre-adjusted a number of bytes with the factory's breaker.
534+ *
535+ * long preAdjustedBytes = blockFactory.preAdjustBreakerForDenseVector(positionCount);
536+ * int[] values = new int[positionCount];
537+ * for (int i = 0; i < positionCount; i++) {
538+ * values[i] = doWhateverStuff
539+ * }
540+ * var vector = blockFactory.newDenseVectorArrayVector(values, positionCount, preAdjustedBytes);
541+ */
542+ public DenseVectorVector newDenseVectorArrayVector (float [][] values , int positionCount , long preAdjustedBytes ) {
543+ var b = new DenseVectorArrayVector (values , positionCount , this );
544+ adjustBreaker (b .ramBytesUsed () - preAdjustedBytes );
545+ return b ;
546+ }
547+
548+ public final DenseVectorBlock newConstantDenseVectorBlockWith (float [] value , int positions ) {
549+ return newConstantDenseVectorBlockWith (value , positions , 0L );
550+ }
551+
552+ public DenseVectorBlock newConstantDenseVectorBlockWith (float [] value , int positions , long preAdjustedBytes ) {
553+ var b = new ConstantDenseVectorVector (value , positions , this ).asBlock ();
554+ adjustBreaker (b .ramBytesUsed () - preAdjustedBytes );
555+ return b ;
556+ }
557+
558+ public DenseVectorVector newConstantDenseVectorVector (float [] value , int positions ) {
559+ adjustBreaker (ConstantDenseVectorVector .RAM_BYTES_USED );
560+ var v = new ConstantDenseVectorVector (value , positions , this );
561+ assert v .ramBytesUsed () == ConstantDenseVectorVector .RAM_BYTES_USED ;
562+ return v ;
563+ }
490564}
0 commit comments