D
damiaotomas
Hi I'm trying to write a c++ code in which I create a matrix (no
randomly), and compare every row of this matrix with a vector x in
order to find the distance of every row related to the vector.
Basicaly I want this matrix to be a vector of vectors. So in natural
language it woud be:
define N /number of element in a vector
define M / number of vectors
main
{
int i, E[N], X[N][M], mi[N]
/initialize vectors in X[N][M] and vector mi[N]
x[M]={ E, E[i+1]...........E[i+(N-1)]}
for (i = 0 ; i<N ; i++)
(enter %d element for vector E[%d]: N, i);
scanf ( %d, &E)
for (i = 0 ; i<N ; i++)
(enter %d element for vector mi[%d]: N, i);
scanf ( %d, &E)
/Loop to compare every vector in x[N][M] with mi[N]
d=X[j]-mi
.......................................................................-
....................
Hope you help me with this one because I've been trying hard.
Ps: The result should de a vector d with N elements.
randomly), and compare every row of this matrix with a vector x in
order to find the distance of every row related to the vector.
Basicaly I want this matrix to be a vector of vectors. So in natural
language it woud be:
define N /number of element in a vector
define M / number of vectors
main
{
int i, E[N], X[N][M], mi[N]
/initialize vectors in X[N][M] and vector mi[N]
x[M]={ E, E[i+1]...........E[i+(N-1)]}
for (i = 0 ; i<N ; i++)
(enter %d element for vector E[%d]: N, i);
scanf ( %d, &E)
for (i = 0 ; i<N ; i++)
(enter %d element for vector mi[%d]: N, i);
scanf ( %d, &E)
/Loop to compare every vector in x[N][M] with mi[N]
d=X[j]-mi
.......................................................................-
....................
Hope you help me with this one because I've been trying hard.
Ps: The result should de a vector d with N elements.