diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 332f23a43b..41e1b8fa27 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -279,18 +279,6 @@ if(BUILD_CUML_CPP_LIBRARY) src/metrics/kl_divergence.cu src/metrics/mutual_info_score.cu src/metrics/pairwise_distance.cu - src/metrics/pairwise_distance_canberra.cu - src/metrics/pairwise_distance_chebyshev.cu - src/metrics/pairwise_distance_correlation.cu - src/metrics/pairwise_distance_cosine.cu - src/metrics/pairwise_distance_euclidean.cu - src/metrics/pairwise_distance_hamming.cu - src/metrics/pairwise_distance_hellinger.cu - src/metrics/pairwise_distance_jensen_shannon.cu - src/metrics/pairwise_distance_kl_divergence.cu - src/metrics/pairwise_distance_l1.cu - src/metrics/pairwise_distance_minkowski.cu - src/metrics/pairwise_distance_russell_rao.cu src/metrics/r2_score.cu src/metrics/rand_index.cu src/metrics/silhouette_score.cu diff --git a/cpp/src/metrics/pairwise_distance.cu b/cpp/src/metrics/pairwise_distance.cu index fadf91887d..f1f53f8154 100644 --- a/cpp/src/metrics/pairwise_distance.cu +++ b/cpp/src/metrics/pairwise_distance.cu @@ -15,23 +15,13 @@ * limitations under the License. */ -#include #include -#include + #include + +#include +#include #include -#include "pairwise_distance_canberra.cuh" -#include "pairwise_distance_chebyshev.cuh" -#include "pairwise_distance_correlation.cuh" -#include "pairwise_distance_cosine.cuh" -#include "pairwise_distance_euclidean.cuh" -#include "pairwise_distance_hamming.cuh" -#include "pairwise_distance_hellinger.cuh" -#include "pairwise_distance_jensen_shannon.cuh" -#include "pairwise_distance_kl_divergence.cuh" -#include "pairwise_distance_l1.cuh" -#include "pairwise_distance_minkowski.cuh" -#include "pairwise_distance_russell_rao.cuh" namespace ML { @@ -47,48 +37,8 @@ void pairwise_distance(const raft::handle_t& handle, bool isRowMajor, double metric_arg) { - switch (metric) { - case raft::distance::DistanceType::L2Expanded: - case raft::distance::DistanceType::L2SqrtExpanded: - case raft::distance::DistanceType::L2Unexpanded: - case raft::distance::DistanceType::L2SqrtUnexpanded: - pairwise_distance_euclidean(handle, x, y, dist, m, n, k, metric, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::CosineExpanded: - pairwise_distance_cosine(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::L1: - pairwise_distance_l1(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::Linf: - pairwise_distance_chebyshev(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::HellingerExpanded: - pairwise_distance_hellinger(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::LpUnexpanded: - pairwise_distance_minkowski(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::Canberra: - pairwise_distance_canberra(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::CorrelationExpanded: - pairwise_distance_correlation(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::HammingUnexpanded: - pairwise_distance_hamming(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::JensenShannon: - pairwise_distance_jensen_shannon(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::KLDivergence: - pairwise_distance_kl_divergence(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::RusselRaoExpanded: - pairwise_distance_russell_rao(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - default: THROW("Unknown or unsupported distance metric '%d'!", (int)metric); - }; + raft::distance::pairwise_distance( + handle, x, y, dist, m, n, k, raft::distance::DistanceType::Canberra, isRowMajor); } void pairwise_distance(const raft::handle_t& handle, @@ -102,48 +52,8 @@ void pairwise_distance(const raft::handle_t& handle, bool isRowMajor, float metric_arg) { - switch (metric) { - case raft::distance::DistanceType::L2Expanded: - case raft::distance::DistanceType::L2SqrtExpanded: - case raft::distance::DistanceType::L2Unexpanded: - case raft::distance::DistanceType::L2SqrtUnexpanded: - pairwise_distance_euclidean(handle, x, y, dist, m, n, k, metric, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::CosineExpanded: - pairwise_distance_cosine(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::L1: - pairwise_distance_l1(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::Linf: - pairwise_distance_chebyshev(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::HellingerExpanded: - pairwise_distance_hellinger(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::LpUnexpanded: - pairwise_distance_minkowski(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::Canberra: - pairwise_distance_canberra(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::CorrelationExpanded: - pairwise_distance_correlation(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::HammingUnexpanded: - pairwise_distance_hamming(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::JensenShannon: - pairwise_distance_jensen_shannon(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::KLDivergence: - pairwise_distance_kl_divergence(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - case raft::distance::DistanceType::RusselRaoExpanded: - pairwise_distance_russell_rao(handle, x, y, dist, m, n, k, isRowMajor, metric_arg); - break; - default: THROW("Unknown or unsupported distance metric '%d'!", (int)metric); - }; + raft::distance::pairwise_distance( + handle, x, y, dist, m, n, k, raft::distance::DistanceType::Canberra, isRowMajor); } template diff --git a/cpp/src/metrics/pairwise_distance_canberra.cu b/cpp/src/metrics/pairwise_distance_canberra.cu deleted file mode 100644 index 84940e46fc..0000000000 --- a/cpp/src/metrics/pairwise_distance_canberra.cu +++ /dev/null @@ -1,56 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_canberra.cuh" - -namespace ML { - -namespace Metrics { -void pairwise_distance_canberra(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg) -{ - // Call the distance function - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::Canberra, isRowMajor); -} - -void pairwise_distance_canberra(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::Canberra, isRowMajor); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_canberra.cuh b/cpp/src/metrics/pairwise_distance_canberra.cuh deleted file mode 100644 index 07e874ed0a..0000000000 --- a/cpp/src/metrics/pairwise_distance_canberra.cuh +++ /dev/null @@ -1,47 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_canberra(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_canberra(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg); - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_chebyshev.cu b/cpp/src/metrics/pairwise_distance_chebyshev.cu deleted file mode 100644 index 4c20f5524b..0000000000 --- a/cpp/src/metrics/pairwise_distance_chebyshev.cu +++ /dev/null @@ -1,54 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_chebyshev.cuh" -namespace ML { - -namespace Metrics { -void pairwise_distance_chebyshev(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::Linf, isRowMajor); -} - -void pairwise_distance_chebyshev(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::Linf, isRowMajor); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_chebyshev.cuh b/cpp/src/metrics/pairwise_distance_chebyshev.cuh deleted file mode 100644 index 6682479a47..0000000000 --- a/cpp/src/metrics/pairwise_distance_chebyshev.cuh +++ /dev/null @@ -1,45 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_chebyshev(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_chebyshev(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg); - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_correlation.cu b/cpp/src/metrics/pairwise_distance_correlation.cu deleted file mode 100644 index 35751b9667..0000000000 --- a/cpp/src/metrics/pairwise_distance_correlation.cu +++ /dev/null @@ -1,55 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_correlation.cuh" - -namespace ML { - -namespace Metrics { -void pairwise_distance_correlation(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::CorrelationExpanded, isRowMajor); -} - -void pairwise_distance_correlation(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::CorrelationExpanded, isRowMajor); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_correlation.cuh b/cpp/src/metrics/pairwise_distance_correlation.cuh deleted file mode 100644 index a55a24528a..0000000000 --- a/cpp/src/metrics/pairwise_distance_correlation.cuh +++ /dev/null @@ -1,47 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_correlation(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_correlation(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg); - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_cosine.cu b/cpp/src/metrics/pairwise_distance_cosine.cu deleted file mode 100644 index c3fb06dd97..0000000000 --- a/cpp/src/metrics/pairwise_distance_cosine.cu +++ /dev/null @@ -1,55 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_cosine.cuh" - -namespace ML { - -namespace Metrics { -void pairwise_distance_cosine(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::CosineExpanded, isRowMajor); -} - -void pairwise_distance_cosine(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::CosineExpanded, isRowMajor); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_cosine.cuh b/cpp/src/metrics/pairwise_distance_cosine.cuh deleted file mode 100644 index 714bb9157d..0000000000 --- a/cpp/src/metrics/pairwise_distance_cosine.cuh +++ /dev/null @@ -1,46 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_cosine(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_cosine(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg); - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_euclidean.cu b/cpp/src/metrics/pairwise_distance_euclidean.cu deleted file mode 100644 index 3a1c72c89f..0000000000 --- a/cpp/src/metrics/pairwise_distance_euclidean.cu +++ /dev/null @@ -1,55 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_euclidean.cuh" - -namespace ML { - -namespace Metrics { -void pairwise_distance_euclidean(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - raft::distance::DistanceType metric, - bool isRowMajor, - double metric_arg) -{ - raft::distance::pairwise_distance(handle, x, y, dist, m, n, k, metric, isRowMajor); -} - -void pairwise_distance_euclidean(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - raft::distance::DistanceType metric, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance(handle, x, y, dist, m, n, k, metric, isRowMajor); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_euclidean.cuh b/cpp/src/metrics/pairwise_distance_euclidean.cuh deleted file mode 100644 index 509b88eb2c..0000000000 --- a/cpp/src/metrics/pairwise_distance_euclidean.cuh +++ /dev/null @@ -1,46 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_euclidean(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - raft::distance::DistanceType metric, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_euclidean(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - raft::distance::DistanceType metric, - bool isRowMajor, - float metric_arg); -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_hamming.cu b/cpp/src/metrics/pairwise_distance_hamming.cu deleted file mode 100644 index dffb123849..0000000000 --- a/cpp/src/metrics/pairwise_distance_hamming.cu +++ /dev/null @@ -1,55 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_hamming.cuh" - -namespace ML { - -namespace Metrics { -void pairwise_distance_hamming(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::HammingUnexpanded, isRowMajor); -} - -void pairwise_distance_hamming(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::HammingUnexpanded, isRowMajor); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_hamming.cuh b/cpp/src/metrics/pairwise_distance_hamming.cuh deleted file mode 100644 index 6551c728e6..0000000000 --- a/cpp/src/metrics/pairwise_distance_hamming.cuh +++ /dev/null @@ -1,47 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_hamming(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_hamming(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg); - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_hellinger.cu b/cpp/src/metrics/pairwise_distance_hellinger.cu deleted file mode 100644 index 54a9f48a5d..0000000000 --- a/cpp/src/metrics/pairwise_distance_hellinger.cu +++ /dev/null @@ -1,55 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_hellinger.cuh" - -namespace ML { - -namespace Metrics { -void pairwise_distance_hellinger(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::HellingerExpanded, isRowMajor); -} - -void pairwise_distance_hellinger(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::HellingerExpanded, isRowMajor); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_hellinger.cuh b/cpp/src/metrics/pairwise_distance_hellinger.cuh deleted file mode 100644 index 560e413b53..0000000000 --- a/cpp/src/metrics/pairwise_distance_hellinger.cuh +++ /dev/null @@ -1,45 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_hellinger(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_hellinger(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg); -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_jensen_shannon.cu b/cpp/src/metrics/pairwise_distance_jensen_shannon.cu deleted file mode 100644 index 8e37e1d48b..0000000000 --- a/cpp/src/metrics/pairwise_distance_jensen_shannon.cu +++ /dev/null @@ -1,55 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_jensen_shannon.cuh" - -namespace ML { - -namespace Metrics { -void pairwise_distance_jensen_shannon(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::JensenShannon, isRowMajor); -} - -void pairwise_distance_jensen_shannon(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::JensenShannon, isRowMajor); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_jensen_shannon.cuh b/cpp/src/metrics/pairwise_distance_jensen_shannon.cuh deleted file mode 100644 index dab4b64657..0000000000 --- a/cpp/src/metrics/pairwise_distance_jensen_shannon.cuh +++ /dev/null @@ -1,47 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_jensen_shannon(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_jensen_shannon(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg); - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_kl_divergence.cu b/cpp/src/metrics/pairwise_distance_kl_divergence.cu deleted file mode 100644 index e9ed79be8e..0000000000 --- a/cpp/src/metrics/pairwise_distance_kl_divergence.cu +++ /dev/null @@ -1,55 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_kl_divergence.cuh" - -namespace ML { - -namespace Metrics { -void pairwise_distance_kl_divergence(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::KLDivergence, isRowMajor); -} - -void pairwise_distance_kl_divergence(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::KLDivergence, isRowMajor); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_kl_divergence.cuh b/cpp/src/metrics/pairwise_distance_kl_divergence.cuh deleted file mode 100644 index 301ed1ba5f..0000000000 --- a/cpp/src/metrics/pairwise_distance_kl_divergence.cuh +++ /dev/null @@ -1,47 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_kl_divergence(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_kl_divergence(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg); - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_l1.cu b/cpp/src/metrics/pairwise_distance_l1.cu deleted file mode 100644 index e28884f327..0000000000 --- a/cpp/src/metrics/pairwise_distance_l1.cu +++ /dev/null @@ -1,55 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_l1.cuh" - -namespace ML { - -namespace Metrics { -void pairwise_distance_l1(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::L1, isRowMajor); -} - -void pairwise_distance_l1(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance( - handle, x, y, dist, m, n, k, raft::distance::DistanceType::L1, isRowMajor); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_l1.cuh b/cpp/src/metrics/pairwise_distance_l1.cuh deleted file mode 100644 index 0d63a2bec7..0000000000 --- a/cpp/src/metrics/pairwise_distance_l1.cuh +++ /dev/null @@ -1,45 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_l1(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_l1(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg); - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_minkowski.cu b/cpp/src/metrics/pairwise_distance_minkowski.cu deleted file mode 100644 index 088e5a2898..0000000000 --- a/cpp/src/metrics/pairwise_distance_minkowski.cu +++ /dev/null @@ -1,71 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_minkowski.cuh" - -namespace ML { - -namespace Metrics { -void pairwise_distance_minkowski(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg) -{ - raft::distance::pairwise_distance(handle, - x, - y, - dist, - m, - n, - k, - raft::distance::DistanceType::LpUnexpanded, - isRowMajor, - metric_arg); -} - -void pairwise_distance_minkowski(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance(handle, - x, - y, - dist, - m, - n, - k, - raft::distance::DistanceType::LpUnexpanded, - isRowMajor, - metric_arg); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_minkowski.cuh b/cpp/src/metrics/pairwise_distance_minkowski.cuh deleted file mode 100644 index b1a2824254..0000000000 --- a/cpp/src/metrics/pairwise_distance_minkowski.cuh +++ /dev/null @@ -1,46 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_minkowski(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_minkowski(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg); - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_russell_rao.cu b/cpp/src/metrics/pairwise_distance_russell_rao.cu deleted file mode 100644 index 343920b755..0000000000 --- a/cpp/src/metrics/pairwise_distance_russell_rao.cu +++ /dev/null @@ -1,71 +0,0 @@ - -/* - * Copyright (c) 2021, 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. - */ - -#include -#include -#include -#include "pairwise_distance_russell_rao.cuh" - -namespace ML { - -namespace Metrics { -void pairwise_distance_russell_rao(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg) -{ - raft::distance::pairwise_distance(handle, - x, - y, - dist, - m, - n, - k, - raft::distance::DistanceType::RusselRaoExpanded, - isRowMajor, - metric_arg); -} - -void pairwise_distance_russell_rao(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg) -{ - raft::distance::pairwise_distance(handle, - x, - y, - dist, - m, - n, - k, - raft::distance::DistanceType::RusselRaoExpanded, - isRowMajor, - metric_arg); -} - -} // namespace Metrics -} // namespace ML diff --git a/cpp/src/metrics/pairwise_distance_russell_rao.cuh b/cpp/src/metrics/pairwise_distance_russell_rao.cuh deleted file mode 100644 index 90f2c64ab8..0000000000 --- a/cpp/src/metrics/pairwise_distance_russell_rao.cuh +++ /dev/null @@ -1,47 +0,0 @@ - -/* - * Copyright (c) 2021, 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 -#include - -namespace ML { - -namespace Metrics { -void pairwise_distance_russell_rao(const raft::handle_t& handle, - const double* x, - const double* y, - double* dist, - int m, - int n, - int k, - bool isRowMajor, - double metric_arg); - -void pairwise_distance_russell_rao(const raft::handle_t& handle, - const float* x, - const float* y, - float* dist, - int m, - int n, - int k, - bool isRowMajor, - float metric_arg); - -} // namespace Metrics -} // namespace ML