Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ if (NOT DEFINED CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
endif ()

set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
if(MSVC)
set(CMAKE_CXX_FLAGS "/W4")
set(CMAKE_CXX_FLAGS_DEBUG "/Zi /Od")
set(CMAKE_CXX_FLAGS_RELEASE "/O2")
else()
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
endif()

list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

Expand Down
26 changes: 18 additions & 8 deletions include/libcmaes/eigenmvn.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,28 @@ namespace Eigen {
static std::mt19937 rng; // The uniform pseudo-random algorithm
mutable std::normal_distribution<Scalar> norm; // gaussian combinator

EIGEN_EMPTY_STRUCT_CTOR(scalar_normal_dist_op)

scalar_normal_dist_op &operator=(scalar_normal_dist_op &&other)
{
scalar_normal_dist_op() : norm(Scalar(0), Scalar(1)) {}

scalar_normal_dist_op(const scalar_normal_dist_op& other)
: norm(other.norm) {
}

scalar_normal_dist_op& operator=(const scalar_normal_dist_op& other) {
if (this != &other) {
swap(other);
norm = other.norm;
}
return *this;
}

scalar_normal_dist_op(scalar_normal_dist_op &&other) {
*this = std::move(other);

scalar_normal_dist_op(scalar_normal_dist_op&& other) noexcept
: norm(std::move(other.norm)) {
}

scalar_normal_dist_op& operator=(scalar_normal_dist_op&& other) noexcept {
if (this != &other) {
norm = std::move(other.norm);
}
return *this;
}

template<typename Index>
Expand Down