Skip to content

Commit dff6497

Browse files
authored
Rename lanczos (rapidsai#2936)
Resolves rapidsai#2727. Follow up to un-break cuvs rapidsai/cuvs#1759 Rename `lanczos_compute_smallest_eigenvectors` to `lanczos_compute_eigenpairs` Authors: - Anupam (https://github.com/aamijar) Approvers: - Victor Lafargue (https://github.com/viclafargue) - Micka (https://github.com/lowener) URL: rapidsai#2936
1 parent 3bad9e5 commit dff6497

4 files changed

Lines changed: 52 additions & 56 deletions

File tree

cpp/include/raft/sparse/solver/detail/lanczos.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ auto lanczos_smallest(raft::resources const& handle,
754754
}
755755

756756
template <typename IndexTypeT, typename ValueTypeT, typename AType>
757-
auto lanczos_compute_smallest_eigenvectors(
757+
auto lanczos_compute_eigenpairs(
758758
raft::resources const& handle,
759759
lanczos_solver_config<ValueTypeT> const& config,
760760
AType A,

cpp/include/raft/sparse/solver/lanczos.cuh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ namespace raft::sparse::solver {
3030
* @return Zero if successful. Otherwise non-zero.
3131
*/
3232
template <typename IndexTypeT, typename ValueTypeT, typename NNZTypeT>
33-
auto lanczos_compute_smallest_eigenvectors(
33+
auto lanczos_compute_eigenpairs(
3434
raft::resources const& handle,
3535
lanczos_solver_config<ValueTypeT> const& config,
3636
raft::device_csr_matrix_view<ValueTypeT, IndexTypeT, IndexTypeT, NNZTypeT> A,
3737
std::optional<raft::device_vector_view<ValueTypeT, uint32_t, raft::row_major>> v0,
3838
raft::device_vector_view<ValueTypeT, uint32_t, raft::col_major> eigenvalues,
3939
raft::device_matrix_view<ValueTypeT, uint32_t, raft::col_major> eigenvectors) -> int
4040
{
41-
return detail::lanczos_compute_smallest_eigenvectors<IndexTypeT, ValueTypeT>(
41+
return detail::lanczos_compute_eigenpairs<IndexTypeT, ValueTypeT>(
4242
handle, config, A, v0, eigenvalues, eigenvectors);
4343
}
4444

@@ -55,15 +55,15 @@ auto lanczos_compute_smallest_eigenvectors(
5555
* @return Zero if successful. Otherwise non-zero.
5656
*/
5757
template <typename IndexTypeT, typename ValueTypeT, typename NNZTypeT>
58-
auto lanczos_compute_smallest_eigenvectors(
58+
auto lanczos_compute_eigenpairs(
5959
raft::resources const& handle,
6060
lanczos_solver_config<ValueTypeT> const& config,
6161
raft::device_coo_matrix_view<ValueTypeT, IndexTypeT, IndexTypeT, NNZTypeT> A,
6262
std::optional<raft::device_vector_view<ValueTypeT, uint32_t, raft::row_major>> v0,
6363
raft::device_vector_view<ValueTypeT, uint32_t, raft::col_major> eigenvalues,
6464
raft::device_matrix_view<ValueTypeT, uint32_t, raft::col_major> eigenvectors) -> int
6565
{
66-
return detail::lanczos_compute_smallest_eigenvectors<IndexTypeT, ValueTypeT>(
66+
return detail::lanczos_compute_eigenpairs<IndexTypeT, ValueTypeT>(
6767
handle, config, A, v0, eigenvalues, eigenvectors);
6868
}
6969

@@ -82,7 +82,7 @@ auto lanczos_compute_smallest_eigenvectors(
8282
* @return Zero if successful. Otherwise non-zero.
8383
*/
8484
template <typename IndexTypeT, typename ValueTypeT>
85-
auto lanczos_compute_smallest_eigenvectors(
85+
auto lanczos_compute_eigenpairs(
8686
raft::resources const& handle,
8787
lanczos_solver_config<ValueTypeT> const& config,
8888
raft::device_vector_view<IndexTypeT, uint32_t, raft::row_major> rows,
@@ -108,7 +108,7 @@ auto lanczos_compute_smallest_eigenvectors(
108108
raft::make_device_csr_matrix_view<ValueTypeT, IndexTypeT, IndexTypeT, IndexTypeT>(
109109
const_cast<ValueTypeT*>(vals.data_handle()), csr_structure);
110110

111-
return lanczos_compute_smallest_eigenvectors<IndexTypeT, ValueTypeT>(
111+
return lanczos_compute_eigenpairs<IndexTypeT, ValueTypeT>(
112112
handle, config, csr_matrix, v0, eigenvalues, eigenvectors);
113113
}
114114

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

66
#include <raft/sparse/solver/lanczos.cuh>
77

8-
#define FUNC_DEF(IndexType, ValueType) \
9-
void lanczos_solver( \
10-
const raft::resources& handle, \
11-
raft::sparse::solver::lanczos_solver_config<ValueType> config, \
12-
raft::device_vector_view<IndexType, uint32_t, raft::row_major> rows, \
13-
raft::device_vector_view<IndexType, uint32_t, raft::row_major> cols, \
14-
raft::device_vector_view<ValueType, uint32_t, raft::row_major> vals, \
15-
std::optional<raft::device_vector_view<ValueType, uint32_t, raft::row_major>> v0, \
16-
raft::device_vector_view<ValueType, uint32_t, raft::col_major> eigenvalues, \
17-
raft::device_matrix_view<ValueType, uint32_t, raft::col_major> eigenvectors) \
18-
{ \
19-
raft::sparse::solver::lanczos_compute_smallest_eigenvectors<IndexType, ValueType>( \
20-
handle, config, rows, cols, vals, v0, eigenvalues, eigenvectors); \
8+
#define FUNC_DEF(IndexType, ValueType) \
9+
void lanczos_solver( \
10+
const raft::resources& handle, \
11+
raft::sparse::solver::lanczos_solver_config<ValueType> config, \
12+
raft::device_vector_view<IndexType, uint32_t, raft::row_major> rows, \
13+
raft::device_vector_view<IndexType, uint32_t, raft::row_major> cols, \
14+
raft::device_vector_view<ValueType, uint32_t, raft::row_major> vals, \
15+
std::optional<raft::device_vector_view<ValueType, uint32_t, raft::row_major>> v0, \
16+
raft::device_vector_view<ValueType, uint32_t, raft::col_major> eigenvalues, \
17+
raft::device_matrix_view<ValueType, uint32_t, raft::col_major> eigenvectors) \
18+
{ \
19+
raft::sparse::solver::lanczos_compute_eigenpairs<IndexType, ValueType>( \
20+
handle, config, rows, cols, vals, v0, eigenvalues, eigenvectors); \
2121
}

cpp/tests/sparse/solver/lanczos.cu

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

@@ -194,14 +194,13 @@ class rmat_lanczos_tests
194194
auto csr_matrix = raft::make_device_csr_matrix_view<ValueType, IndexType, IndexType, IndexType>(
195195
const_cast<ValueType*>(symmetric_coo.vals()), csr_structure);
196196

197-
std::get<0>(stats) =
198-
raft::sparse::solver::lanczos_compute_smallest_eigenvectors<IndexType, ValueType>(
199-
handle,
200-
config,
201-
csr_matrix,
202-
std::make_optional(v0.view()),
203-
eigenvalues.view(),
204-
eigenvectors.view());
197+
std::get<0>(stats) = raft::sparse::solver::lanczos_compute_eigenpairs<IndexType, ValueType>(
198+
handle,
199+
config,
200+
csr_matrix,
201+
std::make_optional(v0.view()),
202+
eigenvalues.view(),
203+
eigenvectors.view());
205204

206205
ASSERT_TRUE(raft::devArrMatch<ValueType>(eigenvalues.data_handle(),
207206
expected_eigenvalues.data_handle(),
@@ -216,7 +215,7 @@ class rmat_lanczos_tests
216215
raft::make_device_matrix<ValueType, uint32_t, raft::col_major>(
217216
handle, symmetric_coo.n_rows, n_components);
218217

219-
raft::sparse::solver::lanczos_compute_smallest_eigenvectors<IndexType, ValueType>(
218+
raft::sparse::solver::lanczos_compute_eigenpairs<IndexType, ValueType>(
220219
handle,
221220
config,
222221
csr_matrix,
@@ -249,14 +248,13 @@ class rmat_lanczos_tests
249248
raft::make_device_matrix<ValueType, uint32_t, raft::col_major>(
250249
handle, symmetric_coo.n_rows, n_components);
251250

252-
std::get<0>(stats) =
253-
raft::sparse::solver::lanczos_compute_smallest_eigenvectors<IndexType, ValueType>(
254-
handle,
255-
config,
256-
coo_matrix,
257-
std::make_optional(v0.view()),
258-
eigenvalues_coo.view(),
259-
eigenvectors_coo.view());
251+
std::get<0>(stats) = raft::sparse::solver::lanczos_compute_eigenpairs<IndexType, ValueType>(
252+
handle,
253+
config,
254+
coo_matrix,
255+
std::make_optional(v0.view()),
256+
eigenvalues_coo.view(),
257+
eigenvectors_coo.view());
260258

261259
ASSERT_TRUE(raft::devArrMatch<ValueType>(eigenvalues_coo.data_handle(),
262260
expected_eigenvalues.data_handle(),
@@ -333,14 +331,13 @@ class lanczos_tests : public ::testing::TestWithParam<lanczos_inputs<IndexType,
333331
auto csr_matrix = raft::make_device_csr_matrix_view<ValueType, IndexType, IndexType, IndexType>(
334332
const_cast<ValueType*>(vals.data_handle()), csr_structure);
335333

336-
std::get<0>(stats) =
337-
raft::sparse::solver::lanczos_compute_smallest_eigenvectors<IndexType, ValueType>(
338-
handle,
339-
config,
340-
csr_matrix,
341-
std::make_optional(v0.view()),
342-
eigenvalues.view(),
343-
eigenvectors.view());
334+
std::get<0>(stats) = raft::sparse::solver::lanczos_compute_eigenpairs<IndexType, ValueType>(
335+
handle,
336+
config,
337+
csr_matrix,
338+
std::make_optional(v0.view()),
339+
eigenvalues.view(),
340+
eigenvectors.view());
344341

345342
ASSERT_TRUE(raft::devArrMatch<ValueType>(eigenvalues.data_handle(),
346343
expected_eigenvalues.data_handle(),
@@ -355,7 +352,7 @@ class lanczos_tests : public ::testing::TestWithParam<lanczos_inputs<IndexType,
355352
raft::make_device_matrix<ValueType, uint32_t, raft::col_major>(
356353
handle, n, params.n_components);
357354

358-
raft::sparse::solver::lanczos_compute_smallest_eigenvectors<IndexType, ValueType>(
355+
raft::sparse::solver::lanczos_compute_eigenpairs<IndexType, ValueType>(
359356
handle,
360357
config,
361358
csr_matrix,
@@ -387,14 +384,13 @@ class lanczos_tests : public ::testing::TestWithParam<lanczos_inputs<IndexType,
387384
raft::make_device_matrix<ValueType, uint32_t, raft::col_major>(
388385
handle, n, params.n_components);
389386

390-
std::get<0>(stats) =
391-
raft::sparse::solver::lanczos_compute_smallest_eigenvectors<IndexType, ValueType>(
392-
handle,
393-
config,
394-
coo_matrix,
395-
std::make_optional(v0.view()),
396-
eigenvalues_coo.view(),
397-
eigenvectors_coo.view());
387+
std::get<0>(stats) = raft::sparse::solver::lanczos_compute_eigenpairs<IndexType, ValueType>(
388+
handle,
389+
config,
390+
coo_matrix,
391+
std::make_optional(v0.view()),
392+
eigenvalues_coo.view(),
393+
eigenvectors_coo.view());
398394

399395
ASSERT_TRUE(raft::devArrMatch<ValueType>(eigenvalues_coo.data_handle(),
400396
expected_eigenvalues.data_handle(),

0 commit comments

Comments
 (0)