Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Prepare an ID card of the continent Antarctica?

Answered: 1 week ago