Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Using Binary numbers to create a matrix

Reply
Thread Tools

Using Binary numbers to create a matrix

 
 
Kaytiana Kaytiana is offline
Junior Member
Join Date: Mar 2010
Posts: 1
 
      03-20-2010
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Matrix operations on character matrix element? Terry Reedy Python 0 04-02-2009 12:12 AM
Matrix*Vector and Vector*Matrix Holgerson C++ 3 10-26-2007 07:38 AM
Create matrix with random numbers Jason Bornhoft Ruby 3 10-20-2007 04:55 AM
Matrix composed by two matrix lvcargnini VHDL 3 07-05-2006 07:21 AM
Re: Matrix DTS and Matrix 2 DTS? PeterTHX DVD Video 0 08-03-2003 05:46 AM



Advertisments