Question: A block-diagonal matrix is a square matrix in which all non-zero elements are in the form of disjoint submatrices (called blocks) on the main diagonal,

 A block-diagonal matrix is a square matrix in which all non-zero

A block-diagonal matrix is a square matrix in which all non-zero elements are in the form of disjoint submatrices (called blocks) on the main diagonal, as shown below (where nonzero elements are represented by asterisks): * * * 0 0 0 0 0 0 0 0 0**** 0 0 0 0 0**** 0 0 kx 0 0 0 0 0 0 0** Write an integer function Blocks(A,n,B) which checks if a real matrix A[1 : n,1: n is block- diagonal and which returns the sizes of consecutive blocks in array B[1 : n] (for the example above the returned values of B are [3,4,2|). The value returned by the function is the number of blocks (i.e., 3 for the example above) Also, write a Fortran program which reads the data, invokes Blocks and prints the results. Hint: Start with the element A[1, 1] and, for consecutive values of k- 1,2, .- check if all elements k +1 to n in the first k rows and the first k columns are equal to zero. If a nonzero element is found, increase k and repeat. When the first block is identified, repeat the same process starting from the next diagonal element, until the whole matrix A is checked A block-diagonal matrix is a square matrix in which all non-zero elements are in the form of disjoint submatrices (called blocks) on the main diagonal, as shown below (where nonzero elements are represented by asterisks): * * * 0 0 0 0 0 0 0 0 0**** 0 0 0 0 0**** 0 0 kx 0 0 0 0 0 0 0** Write an integer function Blocks(A,n,B) which checks if a real matrix A[1 : n,1: n is block- diagonal and which returns the sizes of consecutive blocks in array B[1 : n] (for the example above the returned values of B are [3,4,2|). The value returned by the function is the number of blocks (i.e., 3 for the example above) Also, write a Fortran program which reads the data, invokes Blocks and prints the results. Hint: Start with the element A[1, 1] and, for consecutive values of k- 1,2, .- check if all elements k +1 to n in the first k rows and the first k columns are equal to zero. If a nonzero element is found, increase k and repeat. When the first block is identified, repeat the same process starting from the next diagonal element, until the whole matrix A is checked

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!