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::mdarray
  • raft::mdarray::view
  • raft::mdarray::data_handle
  • raft::mdarray::extents
  • raft::mdarray::extent
  • raft::mdarray::size
  • raft::mdarray::operator()
  • raft::device_mdarray
  • raft::host_mdarray
  • raft::device_matrix
  • raft::device_vector
  • raft::host_matrix
  • raft::host_vector
API ReferenceCpp API DocumentationCommon Types

Owning Dense Arrays

||View as Markdown|
Previous

Dense View Factories

Next

Owning Array Factories

Owning arrays allocate storage and release it when the object is destroyed. They are commonly used in examples, tests, index objects, and user code that needs RAFT to allocate inputs, outputs, or staging buffers.

raft::mdarray

Source header: raft/core/mdarray.hpp

Generic owning multi-dimensional array.

1template <typename ElementType, typename Extents, typename LayoutPolicy,
2 typename ContainerPolicy>
3class mdarray;

raft::mdarray::view

Returns an mdspan view over the owned storage.

1mdspan_type view();
2const_mdspan_type view() const;

Returns

mdspan_type or const_mdspan_type

raft::mdarray::data_handle

Returns the pointer to the owned storage.

1element_type* data_handle();
2element_type const* data_handle() const;

Returns

element_type* or element_type const*

raft::mdarray::extents

Returns the extents object that describes the array shape.

1extents_type extents() const;

Returns

extents_type

raft::mdarray::extent

Returns the size of one rank of the array.

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

Parameters

NameTypeDescription
rstd::size_tRank to query.

Returns

index_type

raft::mdarray::size

Returns the total number of elements in the array.

1size_type size() const;

Returns

size_type

raft::mdarray::operator()

Indexes into the array. For device arrays, use this sparingly because element access may require device-host movement.

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

Parameters

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

Returns

reference or const_reference

raft::device_mdarray

Source header: raft/core/device_mdarray.hpp

Owning array in device-accessible memory.

1template <typename ElementType, typename Extents,
2 typename LayoutPolicy = layout_c_contiguous,
3 typename ContainerPolicy = device_container_policy<ElementType>>
4using device_mdarray =
5 mdarray<ElementType, Extents, LayoutPolicy, device_accessor<ContainerPolicy>>;

raft::host_mdarray

Source header: raft/core/host_mdarray.hpp

Owning array in host memory.

1template <typename ElementType, typename Extents,
2 typename LayoutPolicy = layout_c_contiguous,
3 typename ContainerPolicy = host_container_policy<ElementType>>
4using host_mdarray =
5 mdarray<ElementType, Extents, LayoutPolicy, host_accessor<ContainerPolicy>>;

raft::device_matrix

Source header: raft/core/device_mdarray.hpp

Owning device matrix alias used for datasets, outputs, and temporary storage.

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

raft::device_vector

Source header: raft/core/device_mdarray.hpp

Owning device vector alias used for outputs and temporary storage.

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

raft::host_matrix

Source header: raft/core/host_mdarray.hpp

Owning host matrix alias used for CPU-resident data and staging.

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

raft::host_vector

Source header: raft/core/host_mdarray.hpp

Owning host vector alias used for CPU-resident data and staging.

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