Skip to content

Commit

Permalink
Revert use of new Lanczos solver in spectral clustering (#2507)
Browse files Browse the repository at this point in the history
Revert partly #2481
  • Loading branch information
lowener authored Nov 25, 2024
1 parent fbdf2df commit deff995
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions cpp/include/raft/spectral/eigen_solvers.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#pragma once

#include <raft/core/mdspan.hpp>
#include <raft/sparse/solver/lanczos.cuh>
#include <raft/spectral/matrix_wrappers.hpp>

Expand Down Expand Up @@ -58,31 +57,18 @@ struct lanczos_solver_t {
{
RAFT_EXPECTS(eigVals != nullptr, "Null eigVals buffer.");
RAFT_EXPECTS(eigVecs != nullptr, "Null eigVecs buffer.");
index_type_t iters{0}; // TODO: return total number of iter
auto lanczos_config = raft::sparse::solver::lanczos_solver_config<value_type_t>{
config_.n_eigVecs, config_.maxIter, config_.restartIter, config_.tol, config_.seed};
auto csr_structure =
raft::make_device_compressed_structure_view<index_type_t, index_type_t, index_type_t>(
const_cast<index_type_t*>(A.row_offsets_),
const_cast<index_type_t*>(A.col_indices_),
A.nrows_,
A.ncols_,
A.nnz_);

auto csr_matrix =
raft::make_device_csr_matrix_view<value_type_t, index_type_t, index_type_t, index_type_t>(
const_cast<value_type_t*>(A.values_), csr_structure);
std::optional<raft::device_vector_view<value_type_t, uint32_t, raft::row_major>> v0_opt;

sparse::solver::lanczos_compute_smallest_eigenvectors(
handle,
lanczos_config,
csr_matrix,
v0_opt,
raft::make_device_vector_view<value_type_t, uint32_t, raft::col_major>(eigVals,
config_.n_eigVecs),
raft::make_device_matrix_view<value_type_t, uint32_t, raft::col_major>(
eigVecs, A.nrows_, config_.n_eigVecs));
index_type_t iters{};
sparse::solver::computeSmallestEigenvectors(handle,
A,
config_.n_eigVecs,
config_.maxIter,
config_.restartIter,
config_.tol,
config_.reorthogonalize,
iters,
eigVals,
eigVecs,
config_.seed);

return iters;
}
Expand Down

0 comments on commit deff995

Please sign in to comment.