Skip to content

Commit

Permalink
Test if defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
breyerml committed Feb 16, 2025
1 parent d4579fd commit 82a10e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion bindings/Python/sklearn_svc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,12 @@ void init_sklearn_svc(py::module_ &m) {
std::vector<std::size_t> sorted_indices(num_data_points_in_sub_matrix);
std::merge(index_sets[i].cbegin(), index_sets[i].cend(), index_sets[j].cbegin(), index_sets[j].cend(), sorted_indices.begin());
// copy the support vectors to the binary support vectors
#pragma omp parallel for //collapse(2)
// NOTE: it seems that MSVC doesn't like the collapse clause inside a lambda function
#if defined(MSC_VER)
#pragma omp parallel for
#else
#pragma omp parallel for collapse(2)
#endif
for (std::size_t si = 0; si < num_data_points_in_sub_matrix; ++si) {
for (std::size_t dim = 0; dim < num_features; ++dim) {
temp(si, dim) = model.support_vectors()(sorted_indices[si], dim);
Expand Down
7 changes: 6 additions & 1 deletion include/plssvm/svm/csvc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,12 @@ class csvc : virtual public csvm {
std::vector<std::size_t> sorted_indices(num_data_points_in_sub_matrix);
std::merge(index_sets[i].cbegin(), index_sets[i].cend(), index_sets[j].cbegin(), index_sets[j].cend(), sorted_indices.begin());
// copy the support vectors to the binary support vectors
#pragma omp parallel for //collapse(2)
// NOTE: it seems that MSVC doesn't like the collapse clause inside a lambda function
#if defined(MSC_VER)
#pragma omp parallel for
#else
#pragma omp parallel for collapse(2)
#endif
for (std::size_t si = 0; si < num_data_points_in_sub_matrix; ++si) {
for (std::size_t dim = 0; dim < num_features; ++dim) {
temp(si, dim) = model.support_vectors()(sorted_indices[si], dim);
Expand Down

0 comments on commit 82a10e6

Please sign in to comment.