У меня есть пакет, размещенный на CRAN , который использует несколько ядер через структуру RcppParallel. Проблема с его установкой на r-devel- linux -x86_64-fedora-clang и r-patched-solaris-x86 . Я получаю следующие сообщения об ошибках (есть несколько похожих сообщений, связанных с std :: transform, поэтому для краткости я представляю только одно из них):
1. Для r-patched-solaris-x86:
ParallelFunctions.cpp: In member function ‘virtual void ParallelVectorExpStruct::operator()(std::size_t, std::size_t)’:
ParallelFunctions.cpp:134:27: error: no matching function for call to ‘transform(RcppParallel::RVector<double>::const_iterator, RcppParallel::RVector<double>::const_iterator, RcppParallel::RVector<double>::iterator, <unresolved overloaded function type>)’
::exp);
^
In file included from /opt/csw/include/c++/5.2.0/algorithm:62:0,
from /home/ripley/R/Lib32/Rcpp/include/RcppCommon.h:63,
from /home/ripley/R/Lib32/RcppArmadillo/include/RcppArmadilloForward.h:26,
from /home/ripley/R/Lib32/RcppArmadillo/include/RcppArmadillo.h:31,
from ParallelFunctions.h:4,
from ParallelFunctions.cpp:1:
/opt/csw/include/c++/5.2.0/bits/stl_algo.h:4164:5: note: candidate: template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)
transform(_InputIterator __first, _InputIterator __last,
^
/opt/csw/include/c++/5.2.0/bits/stl_algo.h:4164:5: note: template argument deduction/substitution failed:
ParallelFunctions.cpp:134:27: note: couldn't deduce template parameter ‘_UnaryOperation’
::exp);
^
In file included from /opt/csw/include/c++/5.2.0/algorithm:62:0,
from /home/ripley/R/Lib32/Rcpp/include/RcppCommon.h:63,
from /home/ripley/R/Lib32/RcppArmadillo/include/RcppArmadilloForward.h:26,
from /home/ripley/R/Lib32/RcppArmadillo/include/RcppArmadillo.h:31,
from ParallelFunctions.h:4,
from ParallelFunctions.cpp:1:
/opt/csw/include/c++/5.2.0/bits/stl_algo.h:4201:5: note: candidate: template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)
transform(_InputIterator1 __first1, _InputIterator1 __last1,
^
/opt/csw/include/c++/5.2.0/bits/stl_algo.h:4201:5: note: template argument deduction/substitution failed:
ParallelFunctions.cpp:134:27: note: candidate expects 5 arguments, 4 provided
::exp);
^
2. Для r-devel- linux -x86_64-fedora-clang:
hpaML.cpp:754:45: warning: explicitly assigning value of variable of type 'Rcpp::NumericVector' (aka 'Vector<14>') to itself [-Wself-assign-overloaded]
mean_ind, sd_ind = sd_ind,
~~~~~~ ^ ~~~~~~
ParallelFunctions.cpp:46:7: error: no matching function for call to 'transform'
std::transform(input.begin() + begin,
^~~~~~~~~~~~~~
/usr/local/bin/../include/c++/v1/algorithm:1955:1: note: candidate template ignored: couldn't infer template argument '_BinaryOperation'
transform(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
^
/usr/local/bin/../include/c++/v1/algorithm:1945:1: note: candidate function template not viable: requires 4 arguments, but 5 were provided
transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __op)
^
Вот код функции, где std :: tansform и std :: Вызывались функции exp:
// Parallel exp of vectors
struct ParallelVectorExpStruct : public Worker
{
// source matrix
const RVector<double> input;
// destination matrix
RVector<double> output;
// initialize with source and destination
ParallelVectorExpStruct(const NumericVector input, NumericVector output)
: input(input), output(output) {}
// take the exponents of the range of elements requested
void operator()(std::size_t begin, std::size_t end) {
std::transform(input.begin() + begin,
input.begin() + end,
output.begin() + begin,
::exp);
}
};
// Parallel exponent of vector elements
NumericVector ParallelVectorExp(NumericVector x)
{
// allocate the output matrix
NumericVector output(x.size());
// ParallelVectorPowStruct functor
ParallelVectorExpStruct parallelVectorExpStruct(x, output);
// call parallelFor to do the work
parallelFor(0, x.length(), parallelVectorExpStruct);
// return the output matrix
return (output);
}
Мой файл описаний включает SystemRequirements: GNU make
Мой файл makevars имеет следующие флаги
CXX_STD = CXX11
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
PKG_LIBS += $(shell ${R_HOME}/bin/Rscript -e "RcppParallel::RcppParallelLibs()")
Пожалуйста, помогите мне понять как устранить ошибку. Очень буду сыт за помощью!