diff --git a/cpp/include/cuvs/cluster/agglomerative.hpp b/cpp/include/cuvs/cluster/agglomerative.hpp index 817826856a..d80086e218 100644 --- a/cpp/include/cuvs/cluster/agglomerative.hpp +++ b/cpp/include/cuvs/cluster/agglomerative.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -129,7 +129,7 @@ struct distance_params { /** Specialized parameters to build the Mutual Reachability graph */ struct mutual_reachability_params { /** this neighborhood will be selected for core distances. */ - int min_samples; + int min_samples = 5; /** weight applied when internal distance is chosen for mutual reachability (value of 1.0 disables * the weighting) */ diff --git a/cpp/include/cuvs/distance/distance.hpp b/cpp/include/cuvs/distance/distance.hpp index 13c8c7bd7e..b5454f00a3 100644 --- a/cpp/include/cuvs/distance/distance.hpp +++ b/cpp/include/cuvs/distance/distance.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -93,10 +93,10 @@ enum KernelType { LINEAR, POLYNOMIAL, RBF, TANH }; */ struct KernelParams { // Kernel function parameters - KernelType kernel; //!< Type of the kernel function - int degree; //!< Degree of polynomial kernel (ignored by others) - double gamma; //!< multiplier in the - double coef0; //!< additive constant in poly and tanh kernels + KernelType kernel = KernelType::LINEAR; //!< Type of the kernel function + int degree = 3; //!< Degree of polynomial kernel (ignored by others) + double gamma = 1.0; //!< multiplier in the + double coef0 = 0.0; //!< additive constant in poly and tanh kernels }; } // end namespace kernels diff --git a/cpp/include/cuvs/distance/grammian.hpp b/cpp/include/cuvs/distance/grammian.hpp index 4cb3aa47b6..a179ae80f8 100644 --- a/cpp/include/cuvs/distance/grammian.hpp +++ b/cpp/include/cuvs/distance/grammian.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -36,15 +36,17 @@ using csr_input_matrix_view_t = raft::device_csr_matrix_view class GramMatrixBase { protected: - cublasHandle_t cublas_handle; + cublasHandle_t cublas_handle = nullptr; bool legacy_interface; public: - GramMatrixBase() : legacy_interface(false) {}; + GramMatrixBase() : legacy_interface(false) {} [[deprecated]] GramMatrixBase(cublasHandle_t cublas_handle) - : cublas_handle(cublas_handle), legacy_interface(true) {}; + : cublas_handle(cublas_handle), legacy_interface(true) + { + } - virtual ~GramMatrixBase() {}; + virtual ~GramMatrixBase() = default; /** Convenience function to evaluate the Gram matrix for two vector sets. * Vector sets are provided in Matrix format @@ -320,10 +322,14 @@ class PolynomialKernel : public GramMatrixBase { * @param offset */ PolynomialKernel(exp_t exponent, math_t gain, math_t offset) - : GramMatrixBase(), exponent(exponent), gain(gain), offset(offset) {}; + : GramMatrixBase(), exponent(exponent), gain(gain), offset(offset) + { + } [[deprecated]] PolynomialKernel(exp_t exponent, math_t gain, math_t offset, cublasHandle_t handle) - : GramMatrixBase(handle), exponent(exponent), gain(gain), offset(offset) {}; + : GramMatrixBase(handle), exponent(exponent), gain(gain), offset(offset) + { + } /** Evaluate kernel matrix using polynomial kernel. * @@ -436,7 +442,9 @@ class TanhKernel : public GramMatrixBase { TanhKernel(math_t gain, math_t offset) : GramMatrixBase(), gain(gain), offset(offset) {} [[deprecated]] TanhKernel(math_t gain, math_t offset, cublasHandle_t handle) - : GramMatrixBase(handle), gain(gain), offset(offset) {}; + : GramMatrixBase(handle), gain(gain), offset(offset) + { + } /** Evaluate kernel matrix using tanh kernel. * @@ -551,10 +559,12 @@ class RBFKernel : public GramMatrixBase { * @tparam math_t floating point type * @param gain */ - RBFKernel(math_t gain) : GramMatrixBase(), gain(gain) {}; + RBFKernel(math_t gain) : GramMatrixBase(), gain(gain) {} [[deprecated]] RBFKernel(math_t gain, cublasHandle_t handle) - : GramMatrixBase(handle), gain(gain) {}; + : GramMatrixBase(handle), gain(gain) + { + } void matrixRowNormL2(raft::resources const& handle, dense_input_matrix_view_t matrix, diff --git a/cpp/include/cuvs/neighbors/ball_cover.hpp b/cpp/include/cuvs/neighbors/ball_cover.hpp index 17fa94bfd7..039df42672 100644 --- a/cpp/include/cuvs/neighbors/ball_cover.hpp +++ b/cpp/include/cuvs/neighbors/ball_cover.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -135,7 +135,7 @@ struct index : cuvs::neighbors::index { raft::device_matrix X_reordered; protected: - bool index_trained; + bool index_trained = false; }; /** @} */ diff --git a/cpp/include/cuvs/neighbors/common.hpp b/cpp/include/cuvs/neighbors/common.hpp index 39967999ed..9d99b800fb 100644 --- a/cpp/include/cuvs/neighbors/common.hpp +++ b/cpp/include/cuvs/neighbors/common.hpp @@ -502,7 +502,7 @@ namespace filtering { enum class FilterType { None, Bitmap, Bitset }; struct base_filter { - ~base_filter() = default; + virtual ~base_filter() = default; virtual FilterType get_filter_type() const = 0; }; @@ -976,7 +976,7 @@ struct mg_index { auto operator=(mg_index&&) -> mg_index& = default; distribution_mode mode_; - int num_ranks_; + int num_ranks_ = 0; std::vector> ann_interfaces_; // for load balancing mechanism diff --git a/cpp/include/cuvs/neighbors/hnsw.hpp b/cpp/include/cuvs/neighbors/hnsw.hpp index a1be1c58cc..f58f772294 100644 --- a/cpp/include/cuvs/neighbors/hnsw.hpp +++ b/cpp/include/cuvs/neighbors/hnsw.hpp @@ -738,9 +738,9 @@ void extend(raft::resources const& res, */ struct search_params : cuvs::neighbors::search_params { - int ef; // size of the candidate list - int num_threads = 0; // number of host threads to use for concurrent searches. Value of 0 - // automatically maximizes parallelism + int ef = 200; // size of the candidate list + int num_threads = 0; // number of host threads to use for concurrent searches. Value of 0 + // automatically maximizes parallelism }; /** diff --git a/cpp/include/cuvs/neighbors/vamana.hpp b/cpp/include/cuvs/neighbors/vamana.hpp index 6c0fc94c1e..224d3bd97d 100644 --- a/cpp/include/cuvs/neighbors/vamana.hpp +++ b/cpp/include/cuvs/neighbors/vamana.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -33,8 +33,8 @@ namespace cuvs::neighbors::vamana { */ template struct codebook_params { - int pq_codebook_size; - int pq_dim; + int pq_codebook_size = 0; + int pq_dim = 0; std::vector pq_encoding_table; std::vector rotation_matrix; }; diff --git a/cpp/include/cuvs/preprocessing/spectral_embedding.hpp b/cpp/include/cuvs/preprocessing/spectral_embedding.hpp index e7a578d2ab..5575b1bb38 100644 --- a/cpp/include/cuvs/preprocessing/spectral_embedding.hpp +++ b/cpp/include/cuvs/preprocessing/spectral_embedding.hpp @@ -24,10 +24,10 @@ namespace cuvs::preprocessing::spectral_embedding { */ struct params { /** @brief The number of components to reduce the data to. */ - int n_components; + int n_components = 2; /** @brief The number of neighbors to use for the nearest neighbors graph. */ - int n_neighbors; + int n_neighbors = 15; /** * @brief Whether to normalize the Laplacian matrix. @@ -36,7 +36,7 @@ struct params { * If false, uses the unnormalized graph Laplacian (L = D - W). * Normalized Laplacian often leads to better results for clustering tasks. */ - bool norm_laplacian; + bool norm_laplacian = true; /** * @brief Whether to drop the first eigenvector. @@ -45,7 +45,7 @@ struct params { * uninformative. Setting this to true drops it from the embedding. * This is typically set to true when norm_laplacian is true. */ - bool drop_first; + bool drop_first = true; /** * @brief Tolerance for the eigenvalue solver.