comparing matrix values

Status
Not open for further replies.

jess17

Junior Member level 3
Joined
Mar 4, 2011
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,431
I have a matrix X = [a, b ,c ; d ,e ,f; h, i ,j] and the values
a,b,c,d,e,f,g,h,i,j are not pre known. but i need to find out if they hold the same value, ie if a=b=c=d=e=f=h=g etc.
 

could you use a simple loop? e.g.
Code:
     bool same=true;
     for(i=0;i<3;i++)
        for(j=0;j<3;j++)
          if(X[0][0] != X[i][j])
              same= false;
could be made more efficent as a function, return when the comparison fails
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…