#include<iostream>
#include<armadillo>
using namespace std;
using namespace arma;
int main()
{
vec x = (1.0/5) * ones<vec>(N); //x is N sized uniformly distributed vector
vec xold(5);
mat v = randu<mat>(3,3);
mat b =randu<mat>(3,3);
mat c = v .* b; //element-wise matrix multiplication
xold = x .* x; // element-wise vector multiplication
}
//----------------------------this is the error message --------------------------------
/*
In function ‘int main()’:
SimilarityMatrix.cpp:182:17: error: ‘b’ cannot be used as a member pointer, since it is of type ‘arma::mat {aka arma::Mat<double>}’
mat c = (v.*b);
^
SimilarityMatrix.cpp:183:14: error: 'x' cannot be used as a member pointer, since it is of type 'arma::vec {aka arma::Col}' xold = x.* x; ^ */ //I would appreciate any immediate response.
It's explained in the Armadillo documentation . You should read all relevant documentation before posting questions on Stackoverflow.
See the section on operators , which states that %
is used for element-wise multiplication:
mat c = v % b;
It's explained in the Armadillo documentation .
See the section on operators , which states that %
is used for element-wise multiplication:
mat = v % b;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.