Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how to fix this error #include #include #include #include #include mat.h int mmult(double *C, double *a, int a Rows, int acols, double *b, int brows,

image text in transcribed

image text in transcribedhow to fix this error

#include #include #include #include #include "mat.h" int mmult(double *C, double *a, int a Rows, int acols, double *b, int brows, int bols); int mmult_omp (double *C, double *a, int a Rows, int acols, double *b, int brows, int bols); double* gen_matrix(int n, int m); void compare_matrices (double* a, double* b, int nRows, int nCols); double deltaTime (struct timespec* start, struct timespec* end) { double delta = (end->tv_sec - start->tv_sec) + (end->tv_nsec - start->tv_nsec)/1e9; return delta; } int main(int argc, char* argv[]) { struct timespec start; struct timespec end; struct timespec res; double *a, *b, *c1, *c2; int n; double times [2]; if (argc > 1) { n = atoi(argv[1]); a = gen_matrix(n, n); b = gen_matrix(n, n); c1 = malloc(sizeof(double) * n * n); c2 = malloc(sizeof(double) * n *n); clock_gettime (CLOCK_REALTIME, &start); mmult(c1, a, n, n, b, n, n); clock_gettime (CLOCK_REALTIME, &end); times [0] = deltaTime(&start, &end); printf("%d %f", n, times[0]); clock_gettime(CLOCK_REALTIME, &start); mmult_omp (c2, a, n, n, b, n, n); clock_gettime (CLOCK_REALTIME, &end); times[1] = deltaTime(&start, &end); printf("%f", times[1]); printf(" "); compare_matrices(c1, c2, n, n); } else { fprintf(stderr, "Usage %s ", argv[0]); } } mmult_omp_timing.c:21:6: error: conflicting types for "compare_matrices' void compare_matrices (double* a, double* b, int nRows, int nCols); A ./mat.h:5:5: note: previous declaration is here int compare_ _matrices (double* a, double* b, int nRows, int nCols); 1 error generated<>

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

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions