File weight_vector_dense.hpp¶
-
template<typename T>
class DenseWeightVector : public IterableVectorDecorator<AllocatedVector<T>>, public IWeightVector¶ - #include <weight_vector_dense.hpp>
An one-dimensional vector that provides random access to a fixed number of weights stored in a C-contiguous array.
- Template Parameters:
T – The type of the weights
Public Functions
-
DenseWeightVector(uint32 numElements, bool init = false)¶
- Parameters:
numElements – The number of elements in the vector
init – True, if all elements in the vector should be value-initialized, false otherwise
-
uint32 getNumNonZeroWeights() const¶
Returns the number of non-zero weights.
- Returns:
The number of non-zero weights
-
void setNumNonZeroWeights(uint32 numNonZeroWeights)¶
Sets the number of non-zero weights.
- Parameters:
numNonZeroWeights – The number of non-zero weights to be set
-
virtual bool hasZeroWeights() const override¶
Returns whether the vector contains any zero weights or not.
- Returns:
True, if the vector contains any zero weights, false otherwise
-
virtual std::unique_ptr<IFeatureSubspace> createFeatureSubspace(IFeatureSpace &featureSpace) const override¶
Creates and returns a new instance of type
IFeatureSubspace
that uses the weights in this vector for the training examples it includes.- Parameters:
featureSpace – A reference to an object of type
IFeatureSpace
that should be used to create the instance- Returns:
An unique pointer to an object of type
IFeatureSubspace
that has been created