Skip to content

Commit

Permalink
Use C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Jan 23, 2019
1 parent d789aed commit 749c6e1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -3,7 +3,7 @@ project (Tapkee LANGUAGES CXX)
cmake_minimum_required (VERSION 3.3)

This comment has been minimized.

Copy link
@vigsterkr

vigsterkr Jan 23, 2019

you'll need for 17 3.8 cmake!


# set paths
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD 17)
set (TAPKEE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set (TAPKEE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set (TAPKEE_TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/test/unit")
Expand Down
5 changes: 4 additions & 1 deletion include/tapkee/defines/random.hpp
Expand Up @@ -9,6 +9,7 @@
#include <cstdlib>
#include <algorithm>
#include <limits>
#include <random>

namespace tapkee
{
Expand Down Expand Up @@ -57,7 +58,9 @@ inline ScalarType gaussian_random()
template <class RAI>
inline void random_shuffle(RAI first, RAI last)
{
std::random_shuffle(first,last,uniform_random_index_bounded);
std::random_device rng;
std::mt19937 urng(rng());

This comment has been minimized.

Copy link
@vigsterkr

vigsterkr Jan 23, 2019

use _64... it's faster ;)

This comment has been minimized.

Copy link
@vigsterkr

vigsterkr Jan 23, 2019

std::mt19937_64 that is

std::shuffle(first,last, urng);
}

}
Expand Down
20 changes: 9 additions & 11 deletions include/tapkee/methods.hpp
Expand Up @@ -118,7 +118,7 @@ class ImplementationBase

p_target_dimension = parameters[target_dimension];
p_n_neighbors = parameters[num_neighbors].checked().satisfies(Positivity<IndexType>());

if (n_vectors > 0)
{
p_target_dimension.checked().satisfies(InRange<IndexType>(1,n_vectors));
Expand Down Expand Up @@ -157,23 +157,21 @@ class ImplementationBase
if (context.is_cancelled())
throw cancelled_exception();

using std::mem_fun_ref_t;
using std::mem_fun_ref;
typedef std::mem_fun_ref_t<TapkeeOutput,ImplementationBase> ImplRef;

#define tapkee_method_handle(X) \
case X: \
{ \
timed_context tctx__("[+] embedding with " # X); \
ImplRef ref = conditional_select< \
if constexpr ( \

This comment has been minimized.

Copy link
@iglesias

iglesias Jan 28, 2019

Collaborator

Easier to read 😍.

((!MethodTraits<X>::needs_kernel) || (!is_dummy<KernelCallback>::value)) && \
((!MethodTraits<X>::needs_distance) || (!is_dummy<DistanceCallback>::value)) && \
((!MethodTraits<X>::needs_features) || (!is_dummy<FeaturesCallback>::value)), \
ImplRef>()(mem_fun_ref(&ImplementationBase::embed##X), \
mem_fun_ref(&ImplementationBase::embedEmpty)); \
return ref(*this); \
((!MethodTraits<X>::needs_features) || (!is_dummy<FeaturesCallback>::value)) \
) { \
return ImplementationBase::embed##X(); \
} else { \
return ImplementationBase::embedEmpty(); \
} \
} \
break \
break; \

switch (method)
{
Expand Down

0 comments on commit 749c6e1

Please sign in to comment.