与模板的 triangularView 关联的特征错误
Eigen error associated with triangularView of template
我有以下函数抛出错误。我可以将问题隔离到行
A.template triangularView<Lower>().solveInPlace(MatrixXd::Identity(p,p)); // the problem line
但我无法弄清楚问题是什么以及如何解决它。
template <typename T, typename RNG>
inline void rInvWishRevCholesky_thread_inplace(Eigen::MatrixBase<T>& A,
const int v,
const Eigen::Ref<const Eigen::MatrixXd>& Psi,
RNG& rng){
int p = Psi.rows();
MatrixXd PsiInv = Psi.llt().solve(MatrixXd::Identity(p,p));
if (v <= p-1)
Rcpp::stop("v must be > Psi.rows - 1");
VectorXd z(p*(p-1)/2);
fillUnitNormal_thread(z, rng);
MatrixXd X = MatrixXd::Zero(p, p);
for (int i=0; i<p; i++){
boost::random::chi_squared_distribution<> rchisq(v-i);
X(i,i) = sqrt(rchisq(rng));
}
int pos = 0;
for (int i=1; i<p; i++){
for (int j=0; j<i; j++){
X(i,j) = z(pos);
pos++;
}
}
A.template noalias() = PsiInv.llt().matrixL()*X;
A.template triangularView<Lower>().solveInPlace(MatrixXd::Identity(p,p)); // the problem line
A.template transposeInPlace();
}
错误信息如下:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:496:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/SolveTriangular.h: In instantiation of 'void Eigen::TriangularViewImpl<_MatrixType, _Mode, Eigen::Dense>::solveInPlace(const Eigen::MatrixBase<OtherDerived>&) const [with int Side = 1; OtherDerived = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >; _MatrixType = Eigen::Matrix<double, -1, -1>; unsigned int _Mode = 1]':
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/TriangularMatrix.h:511:37: required from 'void Eigen::TriangularViewImpl<_MatrixType, _Mode, Eigen::Dense>::solveInPlace(const Eigen::MatrixBase<OtherDerived>&) const [with OtherDerived = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >; _MatrixType = Eigen::Matrix<double, -1, -1>; unsigned int _Mode = 1]'
../inst/include/MatDist_thread.h:153:3: required from 'void rInvWishRevCholesky_thread_inplace(Eigen::MatrixBase<Derived>&, int, const Eigen::Ref<const Eigen::Matrix<double, -1, -1> >&, RNG&) [with T = Eigen::Matrix<double, -1, -1>; RNG = boost::random::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>]'
MongrelCollapsed_Uncollapse.cpp:162:72: required from here
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/SolveTriangular.h:182:11: error: use of deleted function 'Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >& Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >::operator=(const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >&)'
other = otherCopy;
~~~~~~^~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:463:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/CwiseNullaryOp.h:60:7: note: 'Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >& Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >::operator=(const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >&)' is implicitly deleted because the default definition would be ill-formed:
class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type, internal::no_assignment_operator
^~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/CwiseNullaryOp.h:60:7: error: 'Eigen::internal::no_assignment_operator& Eigen::internal::no_assignment_operator::operator=(const Eigen::internal::no_assignment_operator&)' is private within this context
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:367:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:92:29: note: declared private here
no_assignment_operator& operator=(const no_assignment_operator&);
^~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:463:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/CwiseNullaryOp.h:60:7: error: passing 'const Eigen::internal::variable_if_dynamic<long int, -1>' as 'this' argument discards qualifiers [-fpermissive]
class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type, internal::no_assignment_operator
^~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:367:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:115:28: note: in call to 'Eigen::internal::variable_if_dynamic<long int, -1>& Eigen::internal::variable_if_dynamic<long int, -1>::operator=(const Eigen::internal::variable_if_dynamic<long int, -1>&)'
template<typename T> class variable_if_dynamic<T, Dynamic>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:463:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/CwiseNullaryOp.h:60:7: error: passing 'const Eigen::internal::variable_if_dynamic<long int, -1>' as 'this' argument discards qualifiers [-fpermissive]
class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type, internal::no_assignment_operator
^~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:367:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:115:28: note: in call to 'Eigen::internal::variable_if_dynamic<long int, -1>& Eigen::internal::variable_if_dynamic<long int, -1>::operator=(const Eigen::internal::variable_if_dynamic<long int, -1>&)'
template<typename T> class variable_if_dynamic<T, Dynamic>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:463:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/CwiseNullaryOp.h:60:7: error: passing 'const Eigen::internal::scalar_identity_op<double>' as 'this' argument discards qualifiers [-fpermissive]
class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type, internal::no_assignment_operator
^~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:425:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/functors/NullaryFunctors.h:31:34: note: in call to 'Eigen::internal::scalar_identity_op<double>& Eigen::internal::scalar_identity_op<double>::operator=(const Eigen::internal::scalar_identity_op<double>&)'
template<typename Scalar> struct scalar_identity_op {
^~~~~~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:496:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/SolveTriangular.h: In instantiation of 'static void Eigen::internal::triangular_solver_selector<Lhs, Rhs, Side, Mode, 0, -1>::run(const Lhs&, Rhs&) [with Lhs = Eigen::Matrix<double, -1, -1>; Rhs = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >; int Side = 1; int Mode = 1]':
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/SolveTriangular.h:179:21: required from 'void Eigen::TriangularViewImpl<_MatrixType, _Mode, Eigen::Dense>::solveInPlace(const Eigen::MatrixBase<OtherDerived>&) const [with int Side = 1; OtherDerived = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >; _MatrixType = Eigen::Matrix<double, -1, -1>; unsigned int _Mode = 1]'
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/TriangularMatrix.h:511:37: required from 'void Eigen::TriangularViewImpl<_MatrixType, _Mode, Eigen::Dense>::solveInPlace(const Eigen::MatrixBase<OtherDerived>&) const [with OtherDerived = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >; _MatrixType = Eigen::Matrix<double, -1, -1>; unsigned int _Mode = 1]'
../inst/include/MatDist_thread.h:153:3: required from 'void rInvWishRevCholesky_thread_inplace(Eigen::MatrixBase<Derived>&, int, const Eigen::Ref<const Eigen::Matrix<double, -1, -1> >&, RNG&) [with T = Eigen::Matrix<double, -1, -1>; RNG = boost::random::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>]'
MongrelCollapsed_Uncollapse.cpp:162:72: required from here
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/SolveTriangular.h:102:81: error: no matching function for call to 'Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >::coeffRef(int, int)'
::run(size, othersize, &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.outerStride(), blocking);
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:434:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:273:10: note: candidate: void Eigen::DenseCoeffsBase<Derived, 0>::coeffRef() [with Derived = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >]
void coeffRef();
^~~~~~~~
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:273:10: note: candidate expects 0 arguments, 2 provided
make: *** [MongrelCollapsed_Uncollapse.o] Error 1
ERROR: compilation failed for package ‘mongrel’
* removing ‘/private/var/folders/x1/9_lpy_fs0kvg0p88td6_df200000gq/T/Rtmp7seVyi/devtools_install_1385330e7ebb0/mongrel’
Error: Command failed (1)
如有任何建议,我们将不胜感激!
solveInPlace
要求它的参数是可写的,MatrixXd::Identity(p,p)
是一个只读表达式。 (您希望从哪里获得该函数的结果?)
也许你想要的是这个?
A.noalias() = (PsiInv.llt().matrixL()*X).transpose()
.template triangularView<Upper>().solve(MatrixXd::Identity(p,p));
我有以下函数抛出错误。我可以将问题隔离到行
A.template triangularView<Lower>().solveInPlace(MatrixXd::Identity(p,p)); // the problem line
但我无法弄清楚问题是什么以及如何解决它。
template <typename T, typename RNG>
inline void rInvWishRevCholesky_thread_inplace(Eigen::MatrixBase<T>& A,
const int v,
const Eigen::Ref<const Eigen::MatrixXd>& Psi,
RNG& rng){
int p = Psi.rows();
MatrixXd PsiInv = Psi.llt().solve(MatrixXd::Identity(p,p));
if (v <= p-1)
Rcpp::stop("v must be > Psi.rows - 1");
VectorXd z(p*(p-1)/2);
fillUnitNormal_thread(z, rng);
MatrixXd X = MatrixXd::Zero(p, p);
for (int i=0; i<p; i++){
boost::random::chi_squared_distribution<> rchisq(v-i);
X(i,i) = sqrt(rchisq(rng));
}
int pos = 0;
for (int i=1; i<p; i++){
for (int j=0; j<i; j++){
X(i,j) = z(pos);
pos++;
}
}
A.template noalias() = PsiInv.llt().matrixL()*X;
A.template triangularView<Lower>().solveInPlace(MatrixXd::Identity(p,p)); // the problem line
A.template transposeInPlace();
}
错误信息如下:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:496:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/SolveTriangular.h: In instantiation of 'void Eigen::TriangularViewImpl<_MatrixType, _Mode, Eigen::Dense>::solveInPlace(const Eigen::MatrixBase<OtherDerived>&) const [with int Side = 1; OtherDerived = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >; _MatrixType = Eigen::Matrix<double, -1, -1>; unsigned int _Mode = 1]':
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/TriangularMatrix.h:511:37: required from 'void Eigen::TriangularViewImpl<_MatrixType, _Mode, Eigen::Dense>::solveInPlace(const Eigen::MatrixBase<OtherDerived>&) const [with OtherDerived = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >; _MatrixType = Eigen::Matrix<double, -1, -1>; unsigned int _Mode = 1]'
../inst/include/MatDist_thread.h:153:3: required from 'void rInvWishRevCholesky_thread_inplace(Eigen::MatrixBase<Derived>&, int, const Eigen::Ref<const Eigen::Matrix<double, -1, -1> >&, RNG&) [with T = Eigen::Matrix<double, -1, -1>; RNG = boost::random::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>]'
MongrelCollapsed_Uncollapse.cpp:162:72: required from here
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/SolveTriangular.h:182:11: error: use of deleted function 'Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >& Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >::operator=(const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >&)'
other = otherCopy;
~~~~~~^~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:463:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/CwiseNullaryOp.h:60:7: note: 'Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >& Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >::operator=(const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >&)' is implicitly deleted because the default definition would be ill-formed:
class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type, internal::no_assignment_operator
^~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/CwiseNullaryOp.h:60:7: error: 'Eigen::internal::no_assignment_operator& Eigen::internal::no_assignment_operator::operator=(const Eigen::internal::no_assignment_operator&)' is private within this context
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:367:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:92:29: note: declared private here
no_assignment_operator& operator=(const no_assignment_operator&);
^~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:463:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/CwiseNullaryOp.h:60:7: error: passing 'const Eigen::internal::variable_if_dynamic<long int, -1>' as 'this' argument discards qualifiers [-fpermissive]
class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type, internal::no_assignment_operator
^~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:367:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:115:28: note: in call to 'Eigen::internal::variable_if_dynamic<long int, -1>& Eigen::internal::variable_if_dynamic<long int, -1>::operator=(const Eigen::internal::variable_if_dynamic<long int, -1>&)'
template<typename T> class variable_if_dynamic<T, Dynamic>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:463:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/CwiseNullaryOp.h:60:7: error: passing 'const Eigen::internal::variable_if_dynamic<long int, -1>' as 'this' argument discards qualifiers [-fpermissive]
class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type, internal::no_assignment_operator
^~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:367:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:115:28: note: in call to 'Eigen::internal::variable_if_dynamic<long int, -1>& Eigen::internal::variable_if_dynamic<long int, -1>::operator=(const Eigen::internal::variable_if_dynamic<long int, -1>&)'
template<typename T> class variable_if_dynamic<T, Dynamic>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:463:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/CwiseNullaryOp.h:60:7: error: passing 'const Eigen::internal::scalar_identity_op<double>' as 'this' argument discards qualifiers [-fpermissive]
class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type, internal::no_assignment_operator
^~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:425:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/functors/NullaryFunctors.h:31:34: note: in call to 'Eigen::internal::scalar_identity_op<double>& Eigen::internal::scalar_identity_op<double>::operator=(const Eigen::internal::scalar_identity_op<double>&)'
template<typename Scalar> struct scalar_identity_op {
^~~~~~~~~~~~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:496:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/SolveTriangular.h: In instantiation of 'static void Eigen::internal::triangular_solver_selector<Lhs, Rhs, Side, Mode, 0, -1>::run(const Lhs&, Rhs&) [with Lhs = Eigen::Matrix<double, -1, -1>; Rhs = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >; int Side = 1; int Mode = 1]':
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/SolveTriangular.h:179:21: required from 'void Eigen::TriangularViewImpl<_MatrixType, _Mode, Eigen::Dense>::solveInPlace(const Eigen::MatrixBase<OtherDerived>&) const [with int Side = 1; OtherDerived = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >; _MatrixType = Eigen::Matrix<double, -1, -1>; unsigned int _Mode = 1]'
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/TriangularMatrix.h:511:37: required from 'void Eigen::TriangularViewImpl<_MatrixType, _Mode, Eigen::Dense>::solveInPlace(const Eigen::MatrixBase<OtherDerived>&) const [with OtherDerived = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >; _MatrixType = Eigen::Matrix<double, -1, -1>; unsigned int _Mode = 1]'
../inst/include/MatDist_thread.h:153:3: required from 'void rInvWishRevCholesky_thread_inplace(Eigen::MatrixBase<Derived>&, int, const Eigen::Ref<const Eigen::Matrix<double, -1, -1> >&, RNG&) [with T = Eigen::Matrix<double, -1, -1>; RNG = boost::random::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>]'
MongrelCollapsed_Uncollapse.cpp:162:72: required from here
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/SolveTriangular.h:102:81: error: no matching function for call to 'Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >::coeffRef(int, int)'
::run(size, othersize, &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.outerStride(), blocking);
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:434:0,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30,
from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25,
from ../inst/include/MatrixAlgebra.h:4,
from ../inst/include/mongrel.h:17,
from MongrelCollapsed_Uncollapse.cpp:1:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:273:10: note: candidate: void Eigen::DenseCoeffsBase<Derived, 0>::coeffRef() [with Derived = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >]
void coeffRef();
^~~~~~~~
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:273:10: note: candidate expects 0 arguments, 2 provided
make: *** [MongrelCollapsed_Uncollapse.o] Error 1
ERROR: compilation failed for package ‘mongrel’
* removing ‘/private/var/folders/x1/9_lpy_fs0kvg0p88td6_df200000gq/T/Rtmp7seVyi/devtools_install_1385330e7ebb0/mongrel’
Error: Command failed (1)
如有任何建议,我们将不胜感激!
solveInPlace
要求它的参数是可写的,MatrixXd::Identity(p,p)
是一个只读表达式。 (您希望从哪里获得该函数的结果?)
也许你想要的是这个?
A.noalias() = (PsiInv.llt().matrixL()*X).transpose()
.template triangularView<Upper>().solve(MatrixXd::Identity(p,p));