CS13002 Programming and Data Structures |
(Autumn semester) Section A |
Assignment Set - 8
Please write your Roll Number, Name and Assignment Number at the header of each program.
Assignment 8.a: Filename: a8a.c
You have to write a program that performs the following tasks:
It reads the value of integer N, and then reads in a two matrices of floats, namely A[N][N] and X[N].
It prints a saddle point of the matrix (if it exists). It must print both the value and the position of the saddle point.
Write a function to compute the product of matrices and use it to compute the product of the matrices A and X
It uses the upper triangulation approach to solve the set of linear equations specified by A and X. It must print the upper triangular matrix derived from A
Information:
A saddle point is an element of the matrix which is both the smallest element in its row and the largest element in its column.
For part 4, first construct an augmented matrix and then find the upper triangular matrix, as shown in the following example.
2x + y - z = 8
-3x - y + 2z = -11
-2x + y + 2z = -3
The augmented matrix is:
2 1 -1 8 -3 -1 2 -11 -2 1 2 -3 The upper triangular form is:
2 1 -1 8 0 1/2 1/2 1 0 0 -1 1 The values of x, y and z can now be computed by back substitution. The third row yields the value of z as -1. We can substitute this value and compute the value of y from the second row, and so on. In this example the values are: x=2, y=3, z= -1