Accessing column elements in a 2D array

In reply to kuki2002:


bit arr[5] = {1,0,1,0,1};

arr.and() // and operation of all the element of arr ,  ans = 1 & 0 & 1 & 0 & 1
arr.and(x) with (x) //This is same as above, here x represent the element , ans  = 1 & 0 & 1 & 0 & 1
arr.and(x) with (x.index) //and operation of all the index, x represent the element , x.index represent the index of that element , ans = 0 & 1 & 2 & 3 & 4
arr.and(x) with (x.index > 2) // and operation of all the index higher than 2, ans = 3 & 4


bit matrix[3][3] = '{'{1,0,1},'{0,1,1},'{0,0,1}};

matrix.and(col) with (matrix[col.index][k] == 1)   

matrix.and(col) // Here col is 1st dimension values of matrix  
// col = {1,0,1} when matrix[0] -> here col.index = 0
// col = {0,1,1} when matrix[1] -> here col.index = 1
// col = {0,0,1} when matrix[2] -> here col.index = 2 

matrix[col.index][k] //lets assume k = 0;
//matrix[col.index][0] -> col.index= 0 -> matrix[0][0] = 1
//matrix[col.index][0] -> col.index= 1 -> matrix[1][0] = 0
//matrix[col.index][0] -> col.index= 2 -> matrix[2][0] = 0

(matrix[col.index][k] == 1)  
// {1==1, 0==1, 0==1} 

matrix.and(col) with (matrix[col.index][k] == 1) 
// and of {1==1, 0==1, 0==1}
// and of {1, 0, 0} which is 0



https://www.linkedin.com/in/patel-rahulkumar/