Class SparseVectorCommitTimeUpdater
- java.lang.Object
-
- com.activeviam.risk.ref.cfg.datastore.triggers.SparseVectorCommitTimeUpdater
-
public class SparseVectorCommitTimeUpdater extends Object
Listen for changes to a specified datastore and it's field. Once a commit has been performed then aReadOnlySparseVector
object is wrapped around the IVector. This step is necessary when usingReadOnlySparseVector
type for fields the default AP IVector that an array is wrapped around does not know how to properly decode the "crunched" down array implementation used in the sparse array.- Author:
- ActiveViam
-
-
Constructor Summary
Constructors Constructor Description SparseVectorCommitTimeUpdater(com.qfs.store.IDatastore datastore, double densityProperty, double defaultValue)
Will generate sparse vectors
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double[]
createSparseVector(int[] scenarioIds, double[] pnls, Integer vectorLength)
This is intended to be used in order to avoid the expansion and re-compaction effect.void
register(String storeName, List<String> fields)
Listen for changes to the specified datastore and it's field.
-
-
-
Constructor Detail
-
SparseVectorCommitTimeUpdater
public SparseVectorCommitTimeUpdater(com.qfs.store.IDatastore datastore, double densityProperty, double defaultValue)
Will generate sparse vectors- Parameters:
datastore
- The datastoredensityProperty
- The density threshold that triggers the sparse representation bellowsdefaultValue
- The sparse default value (should be 0)
-
-
Method Detail
-
register
public void register(String storeName, List<String> fields)
Listen for changes to the specified datastore and it's field. Once a commit has been performed then aReadOnlySparseVector
object is wrapped around the IVector.- Parameters:
storeName
- the store which we will listen tofields
- the fields of the store we will listen to.
-
createSparseVector
protected double[] createSparseVector(int[] scenarioIds, double[] pnls, Integer vectorLength)
This is intended to be used in order to avoid the expansion and re-compaction effect. If the data is already represented as sparse (scenarios + values), the source can directly send it as is, and the commit handle will take care of it.- Parameters:
scenarioIds
- The list of non sparse scenariospnls
- The list of values corresponding to the scenariosvectorLength
- The size of the original vector- Returns:
- A buffer that is compacted or not depending on the sparse value density
-
-