File vector_statistic_dense.hpp

template<typename View, typename MemoryAllocator = DefaultMemoryAllocator>
class DenseStatisticVectorAllocator : public View
#include <vector_statistic_dense.hpp>

Allocates the memory, a DenseStatisticVectorView provides access to.

Template Parameters:
  • View – The type of the view

  • MemoryAllocator – The type of the memory allocator to be used

Public Types

using allocated_view_type = View

The type of the view for which this allocator manages memory.

Public Functions

inline explicit DenseStatisticVectorAllocator(uint32 numGradients, uint32 numHessians, bool init = false)
Parameters:
  • numGradients – The number of gradients in the view

  • numHessians – The number of Hessians in the view

  • init – True, if all elements in the view should be value-initialized, false otherwise

inline DenseStatisticVectorAllocator(const DenseStatisticVectorAllocator<View, MemoryAllocator> &other)
Parameters:

other – A reference to an object of type DenseStatisticVectorAllocator that should be copied

inline DenseStatisticVectorAllocator(DenseStatisticVectorAllocator<View, MemoryAllocator> &&other)
Parameters:

other – A reference to an object of type DenseStatisticVectorAllocator that should be moved

inline virtual ~DenseStatisticVectorAllocator() override
inline const View &getAllocatedView() const

Returns a const reference to the view for which this allocator manages memory.

Returns:

A const reference to an object of template type View for which this allocator manages memory

inline View &getAllocatedView()

Returns a reference to the view for which this allocator manages memory.

Returns:

A reference to an object of template type View for which this allocator manages memory

namespace boosting
template<typename StatisticType>
class DenseStatisticVectorView : public Vector<StatisticType>
#include <vector_statistic_dense.hpp>

A one-dimensional view that provides access to gradients and Hessians that are stored in a single pre-allocated array.

Template Parameters:

StatisticType – The type of the gradient and Hessians

Subclassed by boosting::DenseNonDecomposableStatisticVectorView< StatisticType >

Public Types

using statistic_type = StatisticType

The type of the gradients and Hessians.

using gradient_iterator = View<StatisticType>::iterator

An iterator that provides access to the gradients in the view and allows to modify them.

using gradient_const_iterator = View<StatisticType>::const_iterator

An iterator that provides read-only access to the gradients in the view.

using hessian_iterator = View<StatisticType>::iterator

An iterator that provides access to the Hessians in the view and allows to modify them.

using hessian_const_iterator = View<StatisticType>::const_iterator

An iterator that provides read-only access to the Hessians in the view.

Public Functions

inline DenseStatisticVectorView(StatisticType *array, uint32 numGradients, uint32 numHessians)
Parameters:
  • array – A pointer to an array of template type StatisticType that stores the gradients and Hessians

  • numGradients – The number of gradients in the view

  • numHessians – The number of Hessians in the view

inline DenseStatisticVectorView(const DenseStatisticVectorView<StatisticType> &other)
Parameters:

other – A reference to an object of type DenseStatisticVectorView that should be copied

inline DenseStatisticVectorView(DenseStatisticVectorView<StatisticType> &&other)
Parameters:

other – A reference to an object of type DenseStatisticVectorView that should be moved

inline virtual ~DenseStatisticVectorView() override
inline gradient_iterator gradients_begin()

Returns a gradient_iterator to the beginning of the gradients.

Returns:

A gradient_iterator to the beginning

inline gradient_iterator gradients_end()

Returns a gradient_iterator to the end of the gradients.

Returns:

A gradient_iterator to the end

inline gradient_const_iterator gradients_cbegin() const

Returns a gradient_const_iterator to the beginning of the gradients.

Returns:

A gradient_const_iterator to the beginning

inline gradient_const_iterator gradients_cend() const

Returns a gradient_const_iterator to the end of the gradients.

Returns:

A gradient_const_iterator to the end

inline hessian_iterator hessians_begin()

Returns a hessian_iterator to the beginning of the Hessians.

Returns:

A hessian_iterator to the beginning

inline hessian_iterator hessians_end()

Returns a hessian_iterator to the end of the Hessians.

Returns:

A hessian_iterator to the end

inline hessian_const_iterator hessians_cbegin() const

Returns a hessian_const_iterator to the beginning of the Hessians.

Returns:

A hessian_const_iterator to the beginning

inline hessian_const_iterator hessians_cend() const

Returns a hessian_const_iterator to the end of the Hessians.

Returns:

A hessian_const_iterator to the end

inline uint32 getNumGradients() const

Returns the number of gradients in the view.

Returns:

The number of gradients

inline uint32 getNumHessians() const

Returns the number of Hessians in the view.

Returns:

The number of Hessians

Private Members

const uint32 numGradients_