SHARE
TWEET

Untitled

a guest Mar 25th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <sys/times.h>
  4. #include <unistd.h>
  5. #include <time.h>
  6. #include <unistd.h>
  7.  
  8. double** naive(double** A, int sizeA1, int sizeA2, double** B, int sizeB1, int sizeB2){
  9.     if(sizeA2!=sizeB1){
  10.         printf("nie da sie wymnozyc");     
  11.         return NULL;
  12.     }
  13.     double tab[sizeA1][sizeB2];
  14.     int i, j, k;   
  15.     for (i=0; i<sizeA1; i++){
  16.         for (j=0; j<sizeB2; j++){
  17.             for (k=0; k<sizeA2; k++){
  18.                 tab[i][j]=tab[i][j]+A[i][k]*B[k][j];
  19.             }
  20.         }  
  21.     }
  22.     return tab;
  23. }
  24.  
  25. int main(){
  26.     double A[2][2]={{1.0, 2.0},{3.0, 2.0}};
  27.     double B[2][2]={{3.0, 2.0},{1.0, 0.0}};
  28.     naive(A, 2, 2, B, 2, 2);
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top