[SOLVED] COMP1011 Assignment 8-Array

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon A8-vgymwt.zip (771.4 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (1 vote)

Laboratory Seven: Array
Problem: Matrix Power
Problem description
The power of a square matrix An is defined as follows:

I is an identify matrix (https://en.wikipedia.org/wiki/Identity_matrix).
Design a function as follows to calculate the power of a square matrix under a given module base. void matrix_power(int A[][N], int d, int n, int x, int res[][N])
• Input & output requirements
Input the dimension d, the matrix A, the power n and the module base x.
Note that 2 <= d <= 50, 0 <= n <= 1000, 2 <= x <= 104 and 0 <= A[i][j] <= 100 for any 0 <= i, j < d.
Ouput the An mod x.
• Sample results
Sample Input I:
2
1 1
1 1
0 10
Sample Ouput I:
1 0
0 1
Sample Input II:
5
1 2 3 4 5
6 7 8 9 1
1 2 3 4 5
4 5 6 7 8
6 7 8 9 1
1000 1007
Sample Ouput II:
142 432 722 5 360
889 786 683 580 530
142 432 722 5 360
970 772 574 376 504
889 786 683 580 530

  • A8-vgymwt.zip