Question: In C Programmming, Assume a file, called data.txt, resides in the local directory. (The data.txt file can be downloaded from ELMs; follow the link under

In C Programmming,

Assume a file, called data.txt, resides in the local directory. (The data.txt file can be downloaded from ELMs; follow the link under Homework #1). This file contains integers for a matrix and a vector. The matrix is specified in 10 lines of 10 integers each, providing the values for a 10 x 10 matrix. (Each line is terminated by a new-line character, and within each line the integers are separated by white space characters). After the matrix values, a vector is specified in a single line of 10 integers, providing the values for a 10- element vector. Write a C program that opens the data.txt file, reads in the 10 x 10 matrix and the 10-element vector into arrays, and then computes the matrix-vector product. The matrix-vector product of an NxN input matrix and an N-element input vector is itself an N-element vector in which the ith element of the solution vector is the inner product of the ith row of the input matrix and input vector. (The inner product is the sum of the products between pairwise elements of 2 vectors). After computing the matrix-vector product, your program should print the resulting vec- tor. Here is the sample output of the program: z: hw1.2 554912 121387 17341 52023 138728 173410 398843 190751 242774 537571

INPUT FILE (DATA.TXT):

32 704 96 768 3040 2112 384 256 288 1632 7 154 21 168 665 462 84 56 63 357 1 22 3 24 95 66 12 8 9 51 3 66 9 72 285 198 36 24 27 153 8 176 24 192 760 528 96 64 72 408 10 220 30 240 950 660 120 80 90 510 23 506 69 552 2185 1518 276 184 207 1173 11 242 33 264 1045 726 132 88 99 561 14 308 42 336 1330 924 168 112 126 714 31 682 93 744 2945 2046 372 248 279 1581 1 22 3 24 95 66 12 8 9 51

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!