I am looking at writing a function for the below set of constraints.
We start with a matrix, Z
We want to compare zero and non-zero elements of Z and Z^2.
Hence, need to write a function that will return:
- True if all non-zero elements in a Matrix, Z^2, are accompanied by non-zero (true) elements at the same locations in matrix Z.
As an example:
Z = [1,0,1;1,1,1;1,0,1]
Z^2 = [2,0,2;3,1,3;2,0,2]
From this, we can see if we compare Z and Z^2 by element, all non-zero elements of Z^2 are accompanied by non-zero in Z.
Hence, the function, would be TRUE.