For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
GitHubCUDA-X
    • Home
    • Installation
  • Getting Started
    • Introduction
    • Integrations
    • Use-cases
  • User Guide
    • API Guide
    • Benchmarking Guide
    • Compatibility
    • Integration Patterns
    • Advanced Topics
    • References
  • Developer Guide
    • Coding Guidelines
    • ABI Stability
    • Link-time Optimization
    • Contributing
  • API Reference
    • C API Documentation
    • Cpp API Documentation
      • Cluster Agglomerative
      • Cluster Kmeans
      • Cluster Spectral
      • Common Types
        • Execution Resources
        • Dense Array Views
        • Dense View Factories
        • Owning Dense Arrays
        • Owning Array Factories
        • Layouts and Extents
        • Sparse Array Types
        • Copy, Serialization, and Utility APIs
        • Errors and Logging
      • Distance Distance
      • Distance Grammian
      • Neighbors All Neighbors
      • Neighbors Ball Cover
      • Neighbors Brute Force
      • Neighbors Cagra
      • Neighbors Common
      • Neighbors Dynamic Batching
      • Neighbors Epsilon Neighborhood
      • Neighbors HNSW
      • Neighbors Composite Index
      • Neighbors IVF Flat
      • Neighbors IVF PQ
      • Neighbors NN Descent
      • Neighbors Refine
      • Neighbors Scann
      • Neighbors Tiered Index
      • Neighbors Vamana
      • Preprocessing Quantize Binary
      • Preprocessing PCA
      • Preprocessing Quantize PQ
      • Preprocessing Quantize Scalar
      • Preprocessing Spectral Embedding
      • Selection Select K
      • Stats Silhouette Score
      • Stats Trustworthiness Score
      • Util Cutlass Utils
      • Util File Io
    • Python API Documentation
    • Java API Documentation
    • Rust API Documentation
    • Go API Documentation
NVIDIANVIDIA
Developer-friendly docs for your API
Privacy Policy | Manage My Privacy | Do Not Sell or Share My Data | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2026, NVIDIA Corporation.

LogoLogocuVS
GitHubCUDA-X
On this page
  • raft::mdspan
  • raft::mdspan::data_handle
  • raft::mdspan::extents
  • raft::mdspan::extent
  • raft::mdspan::stride
  • raft::mdspan::size
  • raft::mdspan::empty
  • raft::mdspan::operator()
  • raft::device_mdspan
  • raft::host_mdspan
  • raft::device_matrix_view
  • raft::device_vector_view
  • raft::device_scalar_view
  • raft::host_matrix_view
  • raft::host_vector_view
  • raft::host_scalar_view
  • raft::span
  • raft::span::data
  • raft::span::size
  • raft::span::empty
  • raft::span::operator[]
  • raft::span::begin
  • raft::span::end
API ReferenceCpp API DocumentationCommon Types

Dense Array Views

||View as Markdown|
Previous

Execution Resources

Next

Dense View Factories

Dense array views describe memory owned somewhere else. They carry the pointer, shape, layout, memory-space accessor, and constness needed by NVIDIA cuVS C++ APIs without allocating or freeing data.

raft::mdspan

Source header: raft/core/mdspan.hpp

Generic multi-dimensional non-owning view.

1template <typename ElementType, typename Extents, typename LayoutPolicy,
2 typename AccessorPolicy>
3class mdspan;

raft::mdspan::data_handle

Returns the pointer held by the non-owning view.

1element_type* data_handle() const;

Returns

element_type*

raft::mdspan::extents

Returns the extents object that describes the view shape.

1extents_type extents() const;

Returns

extents_type

raft::mdspan::extent

Returns the size of one rank of the view.

1index_type extent(std::size_t r) const noexcept;

Parameters

NameTypeDescription
rstd::size_tRank to query.

Returns

index_type

raft::mdspan::stride

Returns the stride for one rank of a strided view.

1index_type stride(std::size_t r) const;

Parameters

NameTypeDescription
rstd::size_tRank to query.

Returns

index_type

raft::mdspan::size

Returns the total number of elements described by the view.

1size_type size() const;

Returns

size_type

raft::mdspan::empty

Reports whether the view describes zero elements.

1bool empty() const;

Returns

bool

raft::mdspan::operator()

Indexes into the view with one coordinate per rank.

1template <typename... IndexType>
2reference operator()(IndexType... indices) const;

Parameters

NameTypeDescription
indicesIndexType...Coordinates into the view, one per rank.

Returns

reference

raft::device_mdspan

Source header: raft/core/device_mdspan.hpp

Non-owning view over device-accessible memory.

1template <typename ElementType,
2 typename Extents,
3 typename LayoutPolicy = layout_c_contiguous,
4 typename AccessorPolicy = cuda::std::default_accessor<ElementType>>
5using device_mdspan =
6 mdspan<ElementType, Extents, LayoutPolicy, device_accessor<AccessorPolicy>>;

raft::host_mdspan

Source header: raft/core/host_mdspan.hpp

Non-owning view over host memory.

1template <typename ElementType,
2 typename Extents,
3 typename LayoutPolicy = layout_c_contiguous,
4 typename AccessorPolicy = cuda::std::default_accessor<ElementType>>
5using host_mdspan =
6 mdspan<ElementType, Extents, LayoutPolicy, host_accessor<AccessorPolicy>>;

raft::device_matrix_view

Source header: raft/core/device_mdspan.hpp

Common device view alias for matrix arguments.

1template <typename ElementType,
2 typename IndexType = std::uint32_t,
3 typename LayoutPolicy = layout_c_contiguous>
4using device_matrix_view =
5 device_mdspan<ElementType, matrix_extent<IndexType>, LayoutPolicy>;

raft::device_vector_view

Source header: raft/core/device_mdspan.hpp

Common device view alias for vector arguments.

1template <typename ElementType,
2 typename IndexType = std::uint32_t,
3 typename LayoutPolicy = layout_c_contiguous>
4using device_vector_view =
5 device_mdspan<ElementType, vector_extent<IndexType>, LayoutPolicy>;

raft::device_scalar_view

Source header: raft/core/device_mdspan.hpp

Common device view alias for scalar arguments.

1template <typename ElementType, typename IndexType = std::uint32_t>
2using device_scalar_view = device_mdspan<ElementType, scalar_extent<IndexType>>;

raft::host_matrix_view

Source header: raft/core/host_mdspan.hpp

Common host view alias for matrix arguments.

1template <typename ElementType,
2 typename IndexType = std::uint32_t,
3 typename LayoutPolicy = layout_c_contiguous>
4using host_matrix_view =
5 host_mdspan<ElementType, matrix_extent<IndexType>, LayoutPolicy>;

raft::host_vector_view

Source header: raft/core/host_mdspan.hpp

Common host view alias for vector arguments.

1template <typename ElementType,
2 typename IndexType = std::uint32_t,
3 typename LayoutPolicy = layout_c_contiguous>
4using host_vector_view =
5 host_mdspan<ElementType, vector_extent<IndexType>, LayoutPolicy>;

raft::host_scalar_view

Source header: raft/core/host_mdspan.hpp

Common host view alias for scalar arguments.

1template <typename ElementType, typename IndexType = std::uint32_t>
2using host_scalar_view = host_mdspan<ElementType, scalar_extent<IndexType>>;

raft::span

Source header: raft/core/span.hpp

Lightweight one-dimensional non-owning view. NVIDIA cuVS public APIs usually prefer device_vector_view and host_vector_view for one-dimensional buffers.

1template <typename ElementType, std::size_t Extent>
2class span;

raft::span::data

Returns the pointer held by the span.

1element_type* data() const;

Returns

element_type*

raft::span::size

Returns the number of elements in the span.

1size_type size() const;

Returns

size_type

raft::span::empty

Reports whether the span contains zero elements.

1bool empty() const;

Returns

bool

raft::span::operator[]

Indexes into the span.

1reference operator[](size_type idx) const;

Parameters

NameTypeDescription
idxsize_typeElement index.

Returns

reference

raft::span::begin

Returns an iterator to the first element.

1iterator begin() const;

Returns

iterator

raft::span::end

Returns an iterator one past the last element.

1iterator end() const;

Returns

iterator