Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,12 @@ if(BUILD_CUML_CPP_LIBRARY)
endif()

# todo: separate solvers better
if(all_algo OR solvers_algo)
if(all_algo OR solvers_algo OR lanczos_algo)
target_sources(${CUML_CPP_TARGET}
PRIVATE
src/solver/lars.cu
src/solver/solver.cu)
src/solver/solver.cu
src/solver/lanczos.cu)
endif()

if(all_algo OR spectralclustering_algo)
Expand Down
4 changes: 3 additions & 1 deletion cpp/cmake/modules/ConfigureAlgorithms.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -72,13 +72,15 @@ else()
if(manifold_algo)
set(tsne_algo ON)
set(umap_algo ON)
set(solvers_algo ON)
endif()

if(solvers_algo)
set(lars_algo ON)
set(cd_algo ON)
set(sgd_algo ON)
set(qn_algo ON)
set(lanczos_solver ON)
endif()

if(tsa_algo)
Expand Down
117 changes: 117 additions & 0 deletions cpp/include/cuml/solvers/lanczos.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <raft/core/handle.hpp>

namespace ML {
namespace Solver {

template <typename index_type, typename value_type>
void lanczos_solver(const raft::handle_t& handle,
index_type* rows,
index_type* cols,
value_type* vals,
int nnz,
int n,
int n_components,
int max_iterations,
int ncv,
value_type tolerance,
uint64_t seed,
value_type* v0,
value_type* eigenvalues,
value_type* eigenvectors);

void lanczos_solver(const raft::handle_t& handle,
int* rows,
int* cols,
double* vals,
int nnz,
int n,
int n_components,
int max_iterations,
int ncv,
double tolerance,
uint64_t seed,
double* v0,
double* eigenvalues,
double* eigenvectors);

void lanczos_solver(const raft::handle_t& handle,
int* rows,
int* cols,
float* vals,
int nnz,
int n,
int n_components,
int max_iterations,
int ncv,
float tolerance,
uint64_t seed,
float* v0,
float* eigenvalues,
float* eigenvectors);

template <typename index_type, typename value_type>
void old_lanczos_solver(const raft::handle_t& handle,
index_type* rows,
index_type* cols,
value_type* vals,
int nnz,
int n,
int n_components,
int max_iterations,
int ncv,
value_type tolerance,
uint64_t seed,
value_type* v0,
value_type* eigenvalues,
value_type* eigenvectors);

void old_lanczos_solver(const raft::handle_t& handle,
int* rows,
int* cols,
float* vals,
int nnz,
int n,
int n_components,
int max_iterations,
int ncv,
float tolerance,
uint64_t seed,
float* v0,
float* eigenvalues,
float* eigenvectors);

void old_lanczos_solver(const raft::handle_t& handle,
int* rows,
int* cols,
double* vals,
int nnz,
int n,
int n_components,
int max_iterations,
int ncv,
double tolerance,
uint64_t seed,
double* v0,
double* eigenvalues,
double* eigenvectors);

}; // namespace Solver
}; // end namespace ML
Loading