Matrix and Vector Multiplication In C using OpenMP Model
This is a program which will multiply a vector and a matrix and display it. Basically a 1D Dynamic array and another 2D Dynamic array gets created and values are automatically assigned to it using the rand(). Here, OpenMP model is used for parallel computation of the task. Screenshot The Code: #include<stdio.h> #include<malloc.h> #include<omp.h> #include<time.h> int main() { int **a,n,i,j,*b,*c,k; clock_t st,en; double t; printf("Enter the N: "); scanf("%d",&n); // For the A Matrix a=(int**)malloc(sizeof(int*)*n); for(i=0;i<n;i++) a[i]=(int*)malloc(sizeof(int)*n); for(i=0;i<n;i++) { for(j=0;j<n;j++) { a[i][j]=rand()/100000000; } } //For the B Matrix b=(int*)malloc(sizeof(int)*n); for(i=0;i<n;i++) b[i]=rand()/100000000; //For The C Matrix c=(int*)malloc(sizeof(int)*n); for(i=0;i<n;i++) c[i]=0; printf("The A MAtrix :\n"); for(i=0;i<n;i++) { for(j=0;j<n;j++) { ...