Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个矩阵 A,它是 nxn 矩阵,我有一个向量 b,它是 nx 1 向量,我想在 Eigen 库中计算以下实现。
bsxfun(@rdivide, A, b)
我该如何应用它 Eigen ?
这个怎么样:
Eigen::MatrixXf A(n,n); Eigen::VectorXf b(n); A.cwiseQuotient( b.replicate(1,A.cols()) )
这是一个没有复制的,相当于bsxfun在 MATLAB 中:
bsxfun
A.array().colwise() / b.array()