Using Binary numbers to create a matrix

Joined
Mar 20, 2010
Messages
1
Reaction score
0
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top