Matrix initiation

Discussion in 'C++' started by damiaotomas, Nov 5, 2003.

  1. damiaotomas

    damiaotomas Guest

    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.


    --
    Posted via http://dbforums.com
    damiaotomas, Nov 5, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathaniel Sherman
    Replies:
    5
    Views:
    3,336
  2. irfan
    Replies:
    2
    Views:
    504
    tom fredriksen
    Feb 20, 2006
  3. irfan
    Replies:
    1
    Views:
    336
    tom fredriksen
    Mar 21, 2006
  4. lvcargnini

    Matrix composed by two matrix

    lvcargnini, Jul 4, 2006, in forum: VHDL
    Replies:
    3
    Views:
    2,640
    Jonathan Bromley
    Jul 5, 2006
  5. windandwaves

    initiation not working

    windandwaves, Mar 15, 2006, in forum: Javascript
    Replies:
    4
    Views:
    130
    windandwaves
    Mar 15, 2006
Loading...

Share This Page