File view_statistic_dense.hpp

namespace boosting
template<typename StatisticType>
class DenseStatisticView : public CContiguousView<StatisticType>
#include <view_statistic_dense.hpp>

Implements row-wise read and write access to the gradients and Hessians that are stored in a single pre-allocated C-contiguous array.

Template Parameters:

StatisticType – The type of the gradients and Hessians

Subclassed by boosting::DenseNonDecomposableStatisticView< StatisticType >

Public Types

using gradient_const_iterator = CContiguousView<StatisticType>::value_const_iterator

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

using gradient_iterator = CContiguousView<StatisticType>::value_iterator

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

using hessian_const_iterator = CContiguousView<StatisticType>::value_const_iterator

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

using hessian_iterator = CContiguousView<StatisticType>::value_iterator

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

Public Functions

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

  • numRows – The number of rows in the view

  • numGradients – The number of gradients in each row of the view

  • numHessians – The number of Hessians in each row of the view

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

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

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

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

inline virtual ~DenseStatisticView() override
inline gradient_const_iterator gradients_cbegin(uint32 row) const

Returns a gradient_const_iterator to the beginning of the gradients at a specific row.

Parameters:

row – The row

Returns:

A gradient_const_iterator to the beginning of the given row

inline gradient_const_iterator gradients_cend(uint32 row) const

Returns a gradient_const_iterator to the end of the gradients at a specific row.

Parameters:

row – The row

Returns:

A gradient_const_iterator to the end of the given row

inline gradient_iterator gradients_begin(uint32 row)

Returns a gradient_iterator to the beginning of the gradients at a specific row.

Parameters:

row – The row

Returns:

A gradient_iterator to the beginning of the given row

inline gradient_iterator gradients_end(uint32 row)

Returns a gradient_iterator to the end of the gradients at a specific row.

Parameters:

row – The row

Returns:

A gradient_iterator to the end of the given row

inline hessian_const_iterator hessians_cbegin(uint32 row) const

Returns a hessian_const_iterator to the beginning of the Hessians at a specific row.

Parameters:

row – The row

Returns:

A hessian_const_iterator to the beginning of the given row

inline hessian_const_iterator hessians_cend(uint32 row) const

Returns a hessian_const_iterator to the end of the Hessians at a specific row.

Parameters:

row – The row

Returns:

A hessian_const_iterator to the end of the given row

inline hessian_iterator hessians_begin(uint32 row)

Returns a hessian_iterator to the beginning of the Hessians at a specific row.

Parameters:

row – The row

Returns:

A hessian_iterator to the beginning of the given row

inline hessian_iterator hessians_end(uint32 row)

Returns a hessian_iterator to the end of the Hessians at a specific row.

Parameters:

row – The row

Returns:

A hessian_iterator to the end of the given row

inline uint32 getNumRows() const

Returns the number of rows in the view.

Returns:

The number of rows

inline uint32 getNumGradients() const

Returns the number of gradients in each row of the view.

Returns:

The number of gradients in each row

inline uint32 getNumHessians() const

Returns the number of Hessians in each row of the view.

Returns:

The number of Hessians in each row

Private Members

const uint32 numGradients_
template<typename View, typename MemoryAllocator = DefaultMemoryAllocator>
class DenseStatisticViewAllocator : public View
#include <view_statistic_dense.hpp>

Allocates the memory, a DenseStatisticView provides access to.

Template Parameters:
  • View – The type of the view

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

Public Functions

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

  • 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 DenseStatisticViewAllocator(const DenseStatisticViewAllocator<View, MemoryAllocator> &other)
Parameters:

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

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

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

inline virtual ~DenseStatisticViewAllocator() override