Using Binary numbers to create a matrix

Discussion in 'C Programming' started by Kaytiana, Mar 20, 2010.

  1. Kaytiana

    Kaytiana

    Joined:
    Mar 20, 2010
    Messages:
    1
    Hello,

    OK, so I am new to this whole C programming thing and, quite frankly, it confuses the hell outta me! So I am hoping someone could help me out, with pretty detailed instructions explaining what each command does!

    Please bear with me as I may not be very clear when I explain this, or concise!

    I want to create a matrix as follows;

    The matrix will be of size NxN, where N=2^n and n is the length of the binary numbers we use.

    So the matrix will be M[i,j] where i,j = 0,...,N-1, and i,j correspond to the n-bit binary representations of that number.

    if i =/= j then the M[i,j] entry will be determined by
    if (the binary form) of j has a 0 in as its first digit and i is differs to j ONLY by having a 1 as its first digit then the entry M[i,j] = alpha
    if j has a 1 as its final (nth) digit and i differs to j ONLY by having a 0 as its final digit then M[i,j] = beta
    if j has a 10 within its binary representation and i differs ONLY by having these two digits switched to 01 then M[i,j] = lambda
    otherwise M[i,j] = 0

    And if i = j then M[i,i] = -sum_{j} M[i,j]

    so, for example, if n=3 we have an 8x8 matrix,
    if j = 1 = 001 and i = 5 = 101 then M[5,1] = alpha
    if j = 1 = 001 and i = 0 = 000 then M[0,1] = beta
    if j = 2 = 010 and i = 1 = 001 then M[1,2] = lambda
    if j = 3 = 011 and i = 5 = 101 then M[5,1] = 0

    I am not sure if this makes sense, but if anyone knows how I could construct this it would be a huge help! Thanks.
    Kaytiana, Mar 20, 2010
    #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. lvcargnini

    Matrix composed by two matrix

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

    Matrix*Vector and Vector*Matrix

    Holgerson, Oct 25, 2007, in forum: C++
    Replies:
    3
    Views:
    407
    Holgerson
    Oct 26, 2007
  3. Terry Reedy
    Replies:
    0
    Views:
    555
    Terry Reedy
    Apr 2, 2009
  4. Robert Kern
    Replies:
    0
    Views:
    593
    Robert Kern
    Apr 2, 2009
  5. Jason Bornhoft

    Create matrix with random numbers

    Jason Bornhoft, Oct 19, 2007, in forum: Ruby
    Replies:
    3
    Views:
    139
    Rob Biedenharn
    Oct 20, 2007
Loading...

Share This Page