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
    • Field Guide
    • References
  • Developer Guide
    • Coding Guidelines
    • Contributing
  • API Reference
    • C API Documentation
      • Cluster Kmeans
      • Core C API
      • Distance Distance
      • Distance Pairwise Distance
      • Neighbors Multi GPU Cagra
      • Neighbors Multi GPU Common
      • Neighbors Multi GPU IVF Flat
      • Neighbors Multi GPU IVF PQ
      • Neighbors All Neighbors
      • Neighbors Brute Force
      • Neighbors Cagra
      • Neighbors Common
      • Neighbors HNSW
      • Neighbors IVF Flat
      • Neighbors IVF PQ
      • Neighbors IVF SQ
      • Neighbors NN Descent
      • Neighbors Refine
      • Neighbors Tiered Index
      • Neighbors Vamana
      • Preprocessing Quantize Binary
      • Preprocessing PCA
      • Preprocessing Quantize PQ
      • Preprocessing Quantize Scalar
    • Cpp API Documentation
    • Python API Documentation
    • Java API Documentation
    • Rust API Documentation
    • Go API Documentation
NVIDIANVIDIA
Developer-friendly docs for your API
Privacy Policy | Your Privacy Choices | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2026, NVIDIA Corporation.

LogoLogocuVS
GitHubCUDA-X
On this page
  • C API for Scalar Quantizer
  • cuvsScalarQuantizerParams
  • cuvsScalarQuantizerParamsCreate
  • cuvsScalarQuantizerParamsDestroy
  • cuvsScalarQuantizer
  • cuvsScalarQuantizerCreate
  • cuvsScalarQuantizerDestroy
  • cuvsScalarQuantizerTrain
  • cuvsScalarQuantizerTransform
  • cuvsScalarQuantizerInverseTransform
API ReferenceC API Documentation

Scalar

||View as Markdown|
Previous

Preprocessing Quantize PQ

Next

Cpp API Documentation

Source header: cuvs/preprocessing/quantize/scalar.h

C API for Scalar Quantizer

cuvsScalarQuantizerParams

Scalar quantizer parameters.

1struct cuvsScalarQuantizerParams;

cuvsScalarQuantizerParamsCreate

Allocate Scalar Quantizer params, and populate with default values

1cuvsError_t cuvsScalarQuantizerParamsCreate(cuvsScalarQuantizerParams_t* params);

Parameters

NameDirectionTypeDescription
paramsincuvsScalarQuantizerParams_t*cuvsScalarQuantizerParams_t to allocate

Returns

cuvsError_t

cuvsScalarQuantizerParamsDestroy

De-allocate Scalar Quantizer params

1cuvsError_t cuvsScalarQuantizerParamsDestroy(cuvsScalarQuantizerParams_t params);

Parameters

NameDirectionTypeDescription
paramsincuvsScalarQuantizerParams_t

Returns

cuvsError_t

cuvsScalarQuantizer

Defines and stores scalar for quantisation upon training

The quantization is performed by a linear mapping of an interval in the float data type to the full range of the quantized int type.

1typedef struct {
2 double min_;
3 double max_;
4} cuvsScalarQuantizer;

Fields

NameTypeDescription
min_double
max_double

cuvsScalarQuantizerCreate

Allocate Scalar Quantizer and populate with default values

1cuvsError_t cuvsScalarQuantizerCreate(cuvsScalarQuantizer_t* quantizer);

Parameters

NameDirectionTypeDescription
quantizerincuvsScalarQuantizer_t*cuvsScalarQuantizer_t to allocate

Returns

cuvsError_t

cuvsScalarQuantizerDestroy

De-allocate Scalar Quantizer

1cuvsError_t cuvsScalarQuantizerDestroy(cuvsScalarQuantizer_t quantizer);

Parameters

NameDirectionTypeDescription
quantizerincuvsScalarQuantizer_t

Returns

cuvsError_t

cuvsScalarQuantizerTrain

Trains a scalar quantizer to be used later for quantizing the dataset.

1cuvsError_t cuvsScalarQuantizerTrain(cuvsResources_t res,
2cuvsScalarQuantizerParams_t params,
3DLManagedTensor* dataset,
4cuvsScalarQuantizer_t quantizer);

Parameters

NameDirectionTypeDescription
resincuvsResources_traft resource
paramsincuvsScalarQuantizerParams_tconfigure scalar quantizer, e.g. quantile
datasetinDLManagedTensor*a row-major host or device matrix
quantizeroutcuvsScalarQuantizer_ttrained scalar quantizer

Returns

cuvsError_t

cuvsScalarQuantizerTransform

Applies quantization transform to given dataset

1cuvsError_t cuvsScalarQuantizerTransform(cuvsResources_t res,
2cuvsScalarQuantizer_t quantizer,
3DLManagedTensor* dataset,
4DLManagedTensor* out);

Parameters

NameDirectionTypeDescription
resincuvsResources_traft resource
quantizerincuvsScalarQuantizer_ta scalar quantizer
datasetinDLManagedTensor*a row-major host or device matrix to transform
outoutDLManagedTensor*a row-major host or device matrix to store transformed data

Returns

cuvsError_t

cuvsScalarQuantizerInverseTransform

Perform inverse quantization step on previously quantized dataset

1cuvsError_t cuvsScalarQuantizerInverseTransform(cuvsResources_t res,
2cuvsScalarQuantizer_t quantizer,
3DLManagedTensor* dataset,
4DLManagedTensor* out);

Note that depending on the chosen data types train dataset the conversion is not lossless.

Parameters

NameDirectionTypeDescription
resincuvsResources_traft resource
quantizerincuvsScalarQuantizer_ta scalar quantizer
datasetinDLManagedTensor*a row-major host or device matrix
outoutDLManagedTensor*a row-major host or device matrix

Returns

cuvsError_t