Skip to content
Merged
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
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
cmake_minimum_required(VERSION 2.8)

# Change the compiler BEFORE the first `project()` command to avoid an infinite loop.
# See: https://public.kitware.com/pipermail/cmake/2009-November/033133.html
if(APPLE)
# If custom llvm compilers are available, use them (for openmp
# support), otherwise disable multicore.
if(EXISTS "/usr/local/opt/llvm/bin/clang")
set(CMAKE_C_COMPILER "/usr/local/opt/llvm/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/local/opt/llvm/bin/clang++")
endif()
endif()

project(libfqfft)

set(
Expand Down Expand Up @@ -57,7 +68,11 @@ else()
set(DEPENDS_DIR "${DEPENDS_DIR}")
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if(APPLE)
set(WITH_PROCPS OFF)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "^(Apple)?Clang$")
# Common compilation flags and warning configuration
set(
CMAKE_CXX_FLAGS
Expand Down
13 changes: 9 additions & 4 deletions libfqfft/polynomial_arithmetic/basic_operations.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Implementation of interfaces for basic polynomial operation routines.

See basic_operations.hpp .

*****************************************************************************
* @author This file is part of libfqfft, developed by SCIPR Lab
* and contributors (see AUTHORS).
Expand All @@ -15,6 +15,7 @@
#define BASIC_OPERATIONS_TCC_

#include <algorithm>
#include <functional>

#include <libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp>
#include <libfqfft/kronecker_substitution/kronecker_substitution.hpp>
Expand Down Expand Up @@ -75,7 +76,7 @@ void _polynomial_addition(std::vector<FieldT> &c, const std::vector<FieldT> &a,
std::copy(b.begin() + a_size, b.end(), c.begin() + a_size);
}
}

_condense(c);
}

Expand All @@ -95,7 +96,7 @@ void _polynomial_subtraction(std::vector<FieldT> &c, const std::vector<FieldT> &
{
size_t a_size = a.size();
size_t b_size = b.size();

if (a_size > b_size)
{
c.resize(a_size);
Expand Down Expand Up @@ -148,7 +149,11 @@ void _polynomial_multiplication_on_fft(std::vector<FieldT> &c, const std::vector
#endif

const FieldT sconst = FieldT(n).inverse();
std::transform(c.begin(), c.end(), c.begin(), std::bind1st(std::multiplies<FieldT>(), sconst));
std::transform(
c.begin(),
c.end(),
c.begin(),
std::bind(std::multiplies<FieldT>(), sconst, std::placeholders::_1));
_condense(c);
}

Expand Down
20 changes: 16 additions & 4 deletions libfqfft/polynomial_arithmetic/xgcd.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Implementation of interfaces for extended GCD routines.

See xgcd.hpp .

*****************************************************************************
* @author This file is part of libfqfft, developed by SCIPR Lab
* and contributors (see AUTHORS).
Expand Down Expand Up @@ -58,9 +58,21 @@ void _polynomial_xgcd(const std::vector<FieldT> &a, const std::vector<FieldT> &b
_polynomial_division(V1, R, V3, b);

FieldT lead_coeff = G.back().inverse();
std::transform(G.begin(), G.end(), G.begin(), std::bind1st(std::multiplies<FieldT>(), lead_coeff));
std::transform(U.begin(), U.end(), U.begin(), std::bind1st(std::multiplies<FieldT>(), lead_coeff));
std::transform(V1.begin(), V1.end(), V1.begin(), std::bind1st(std::multiplies<FieldT>(), lead_coeff));
std::transform(
G.begin(),
G.end(),
G.begin(),
std::bind(std::multiplies<FieldT>(), lead_coeff, std::placeholders::_1));
std::transform(
U.begin(),
U.end(),
U.begin(),
std::bind(std::multiplies<FieldT>(), lead_coeff, std::placeholders::_1));
std::transform(
V1.begin(),
V1.end(),
V1.begin(),
std::bind(std::multiplies<FieldT>(), lead_coeff, std::placeholders::_1));

g = G;
u = U;
Expand Down