xgboost
| 命名空间 | | 类型定义 | 枚举 | 函数
linalg.h 文件参考

线性代数相关实用工具。 更多...

#include <dmlc/endian.h>
#include <xgboost/base.h>
#include <xgboost/context.h>
#include <xgboost/host_device_vector.h>
#include <xgboost/json.h>
#include <xgboost/span.h>
#include <algorithm>
#include <cassert>
#include <cinttypes>
#include <cstddef>
#include <limits>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
linalg.h 的包含依赖关系图
此图显示了哪些文件直接或间接包含了此文件

转到此文件的源代码。

结构体  xgboost::linalg::detail::ArrayInterfaceHandler
 
结构体  xgboost::linalg::detail::AllTag
 
结构体  xgboost::linalg::detail::IntTag
 
结构体  xgboost::linalg::detail::RangeTag< I >
 
结构体  xgboost::linalg::detail::Conjunction<... >
 
结构体  xgboost::linalg::detail::Conjunction< B1 >
 
结构体  xgboost::linalg::detail::Conjunction< B1, Bn... >
 
类  xgboost::linalg::TensorView< T, kDim >
 具有静态类型和维度的张量视图。它实现了索引和切片。 更多...
 
类  xgboost::linalg::Tensor< T, kDim >
 张量存储。要将其用于切片等其他功能,需要先获取一个视图。这样我们可以在主机和设备上使用它。 更多...
 

命名空间

 xgboost
 多目标树的核心数据结构。
 
 xgboost::linalg
 
 xgboost::linalg::detail
 

#define LINALG_HD
 

类型定义

template<typename S >
using xgboost::linalg::detail::RemoveCRType = std::remove_const_t< std::remove_reference_t< S > >
 
template<typename S >
using xgboost::linalg::detail::IndexToTag = std::conditional_t< std::is_integral_v< RemoveCRType< S > >, IntTag, S >
 
template<typename... Index>
using xgboost::linalg::detail::IsAllIntegral = Conjunction< std::is_integral< std::remove_reference_t< Index > >... >
 
template<typename... Index>
using xgboost::linalg::detail::EnableIfIntegral = std::enable_if_t< IsAllIntegral< Index... >::value >
 
template<typename T >
using xgboost::linalg::VectorView = TensorView< T, 1 >
 向量视图,是 Tensor 的特化。 更多...
 
template<typename T >
using xgboost::linalg::MatrixView = TensorView< T, 2 >
 矩阵视图,是 Tensor 的特化。 更多...
 
template<typename T >
using xgboost::linalg::Matrix = Tensor< T, 2 >
 
template<typename T >
using xgboost::linalg::Vector = Tensor< T, 1 >
 

枚举

枚举  xgboost::linalg::Order : std::uint8_t { xgboost::linalg::kC , xgboost::linalg::kF }
 

函数

template<size_t dim, typename S , typename Head , size_t D>
constexpr size_t xgboost::linalg::detail::Offset (S(&strides)[D], size_t n, Head head)
 
template<size_t dim, typename S , size_t D, typename Head , typename... Tail>
constexpr std::enable_if_t< sizeof...(Tail) !=0, size_t > xgboost::linalg::detail::Offset (S(&strides)[D], size_t n, Head head, Tail &&...rest)
 
template<int32_t D, bool f_array = false>
constexpr void xgboost::linalg::detail::CalcStride (size_t const (&shape)[D], size_t(&stride)[D])
 
template<typename T >
constexpr int32_t xgboost::linalg::detail::CalcSliceDim ()
 计算切片张量的维度。 更多...
 
template<typename T , typename... S>
constexpr std::enable_if_t< sizeof...(S) !=0, int32_t > xgboost::linalg::detail::CalcSliceDim ()
 
template<int32_t D>
constexpr size_t xgboost::linalg::detail::CalcSize (size_t(&shape)[D])
 
template<int32_t n, typename Fn >
constexpr LINALG_HD auto xgboost::linalg::detail::UnrollLoop (Fn fn)
 
template<typename T >
int32_t xgboost::linalg::detail::NativePopc (T v)
 
LINALG_HD int xgboost::linalg::detail::Popc (uint32_t v)
 
LINALG_HD int xgboost::linalg::detail::Popc (uint64_t v)
 
template<std::size_t D, typename Head >
LINALG_HD void xgboost::linalg::detail::IndexToArr (std::size_t(&arr)[D], Head head)
 
template<std::size_t D, typename Head , typename... Rest>
LINALG_HD void xgboost::linalg::detail::IndexToArr (std::size_t(&arr)[D], Head head, Rest &&...index)
 将参数包中的索引转换为 C 风格数组。 更多...
 
template<class T , std::size_t N, std::size_t... Idx>
constexpr auto xgboost::linalg::detail::ArrToTuple (T(&arr)[N], std::index_sequence< Idx... >)
 
template<class T , std::size_t N>
constexpr auto xgboost::linalg::detail::ArrToTuple (T(&arr)[N])
 将 C 风格数组转换为 std::tuple。 更多...
 
template<typename I , std::int32_t D>
LINALG_HD auto xgboost::linalg::detail::UnravelImpl (I idx, common::Span< size_t const, D > shape)
 
template<size_t dim, typename I , int32_t D>
void xgboost::linalg::detail::ReshapeImpl (size_t(&out_shape)[D], I s)
 
template<size_t dim, int32_t D, typename... S, typename I , std::enable_if_t< sizeof...(S) !=0 > * = nullptr>
void xgboost::linalg::detail::ReshapeImpl (size_t(&out_shape)[D], I &&s, S &&...rest)
 
template<typename Fn , typename Tup , size_t... I>
decltype(auto) constexpr LINALG_HD xgboost::linalg::detail::Apply (Fn &&f, Tup &&t, std::index_sequence< I... >)
 
template<typename Fn , typename Tup >
decltype(auto) constexpr LINALG_HD xgboost::linalg::detail::Apply (Fn &&f, Tup &&t)
 
constexpr detail::AllTag xgboost::linalg::All ()
 指定轴中的所有元素用于切片。 更多...
 
template<typename I >
constexpr detail::RangeTag< I > xgboost::linalg::Range (I beg, I end)
 指定轴中的一个元素范围用于切片。 更多...
 
template<typename Container , typename... S, std::enable_if_t<!common::detail::IsSpan< Container >::value &&!std::is_pointer_v< Container >> * = nullptr>
auto xgboost::linalg::MakeTensorView (Context const *ctx, Container &data, S &&...shape)
 用于自动类型推断的构造函数。 更多...
 
template<typename T , decltype(common::dynamic_extent) ext, typename... S>
LINALG_HD auto xgboost::linalg::MakeTensorView (DeviceOrd device, common::Span< T, ext > data, S &&...shape)
 
template<typename T , decltype(common::dynamic_extent) ext, typename... S>
auto xgboost::linalg::MakeTensorView (Context const *ctx, common::Span< T, ext > data, S &&...shape)
 
template<typename T , decltype(common::dynamic_extent) ext, typename... S>
auto xgboost::linalg::MakeTensorView (Context const *ctx, Order order, common::Span< T, ext > data, S &&...shape)
 
template<typename T , typename... S>
auto xgboost::linalg::MakeTensorView (Context const *ctx, HostDeviceVector< T > *data, S &&...shape)
 
template<typename T , typename... S>
auto xgboost::linalg::MakeTensorView (Context const *ctx, HostDeviceVector< T > const *data, S &&...shape)
 
template<size_t D>
LINALG_HD auto xgboost::linalg::UnravelIndex (size_t idx, common::Span< size_t const, D > shape)
 将线性索引转换为多维索引。类似于 numpy 的 unravel。 更多...
 
template<size_t D>
LINALG_HD auto xgboost::linalg::UnravelIndex (size_t idx, std::size_t const (&shape)[D])
 
template<typename... S>
LINALG_HD auto xgboost::linalg::UnravelIndex (std::size_t idx, S... shape)
 
template<typename T >
auto xgboost::linalg::MakeVec (T *ptr, size_t s, DeviceOrd device=DeviceOrd::CPU())
 从连续内存创建向量视图。 更多...
 
template<typename T >
auto xgboost::linalg::MakeVec (HostDeviceVector< T > *data)
 
template<typename T >
auto xgboost::linalg::MakeVec (HostDeviceVector< T > const *data)
 
template<typename T , std::int32_t D>
Json xgboost::linalg::ArrayInterface (TensorView< T const, D > const &t)
 numpy 定义的数组接口。 更多...
 
template<typename T , int32_t D>
Json xgboost::linalg::ArrayInterface (TensorView< T, D > const &t)
 与 const 版本相同,但返回非只读数据指针。 更多...
 
template<typename T , int32_t D>
auto xgboost::linalg::ArrayInterfaceStr (TensorView< T const, D > const &t)
 返回数组接口的字符串表示。 更多...
 
template<typename T , int32_t D>
auto xgboost::linalg::ArrayInterfaceStr (TensorView< T, D > const &t)
 
template<typename T >
auto xgboost::linalg::Make1dInterface (T const *vec, std::size_t len)
 
template<typename T , typename... Index>
auto xgboost::linalg::Empty (Context const *ctx, Index &&...index)
 创建一个未初始化的数组。 更多...
 
template<typename T , typename... Index>
auto xgboost::linalg::Constant (Context const *ctx, T v, Index &&...index)
 创建一个值为 v 的数组。 更多...
 
template<typename T , typename... Index>
auto xgboost::linalg::Zeros (Context const *ctx, Index &&...index)
 类似于 np.zeros,返回指定形状和类型的新数组,并用零填充。 更多...
 
template<typename T , int32_t D>
void xgboost::linalg::Stack (Tensor< T, D > *l, Tensor< T, D > const &r)
 

详细描述

线性代数相关实用工具。

Copyright 2021-2023 XGBoost 贡献者

宏定义文档

◆ LINALG_HD

#define LINALG_HD