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.
使用 dlib 库如何进行元素特定操作?例如
A = [1 2 3; 4 5 6]
而不是它去A * A,我可以让它对矩阵的元素进行平方,以便答案是
答案 = [1 4 9; 16 25 36]
在matlab中你可以简单地去A.^2
谢谢
您可以使用位于“matrix.h”库中的 pointwise_multiply()。例如
matrix<double> A(3,2); A = 1, 2, 3, 4, 5, 6; matrix<double> B(3,2); B = 1, 2, 3, 4, 5, 6; matrix<double> answer = pointwise_multiply(A,B);
或者,
matrix<double> answer = squared(A);