• Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

Matrix multiplication algorithm

Extracts from this document...

Introduction

Creation and implementation of an algorithm that works the Matrix multiplication n-1 Cij = ?aik * bkj K=0 (a) Basic operations 1) Comparison of number of rows of one matrix and number of columns of another to see if they are compatible 2) Multiplication (b) Work done Running time = ?(n3) (c) Algorithm Input number of rows and columns for each of the matrix { If(columnsofA !=rowsofb) Through invalid argument ("incompatible matrices") ...read more.

Middle

{ printf("matrices are incompatible"); goto start; } printf("enter matrix A\n"); for(i=0;i<nrow;++i) { for(j=0;j<ncol;++j) { scanf("%d",&p); a[i][j]=p; } printf("\n"); } printf("enter matrix B\n"); for(j=0;j<argnrow;++j) { for(k=0;k<argncol;++k) { scanf("%d",&p); b[i][j]=p; } printf("\n"); } printf("product"); for(i=0;i<nrow;++i) { for(j=0;j<ncol;++j) { sum=0; for(k=0;argncol;++k) sum+=a[i][j]*b[j][k]; c[i][k]=sum; } printf("%d",c[i][k]); } return 0; } Sample output 1 enter the value of ncol4 enter the value of nrow3 enter the value of argncol3 enter the value of argnrow4 enter matrix A 1 1 1 1 2 2 2 2 3 3 3 3 enter matrix B 4 4 4 1 ...read more.

Conclusion

value of ncol4 enter the value of nrow3 enter the value of argncol3 enter the value of argnrow4 enter matrix A 1 1 1 1 2 2 2 2 3 3 3 3 enter matrix B 4 4 4 1 2 3 1 1 1 3 2 1 product 9 9 9 18 18 18 27 27 27 Press any key to continue (f) In this case the worst case is when you multiply a20*20 matrix and a20*20 matrix since ma program is designed to accept atmost twenty items refference: http://www.brpreiss.com/books/opus4/html/page104.html ...read more.

The above preview is unformatted text

This student written piece of work is one of many that can be found in our GCSE ICT Systems and Application section.

Found what you're looking for?

  • Start learning 29% faster today
  • 150,000+ documents available
  • Just £6.99 a month

Not the one? Search for your essay title...
  • Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month
  • Over 160,000 pieces
    of student written work
  • Annotated by
    experienced teachers
  • Ideas and feedback to
    improve your own work