Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <sys/times.h>
- #include <unistd.h>
- #include <time.h>
- #include <unistd.h>
- double** naive(double** A, int sizeA1, int sizeA2, double** B, int sizeB1, int sizeB2){
- if(sizeA2!=sizeB1){
- printf("nie da sie wymnozyc");
- return NULL;
- }
- double tab[sizeA1][sizeB2];
- int i, j, k;
- for (i=0; i<sizeA1; i++){
- for (j=0; j<sizeB2; j++){
- for (k=0; k<sizeA2; k++){
- tab[i][j]=tab[i][j]+A[i][k]*B[k][j];
- }
- }
- }
- return tab;
- }
- int main(){
- double A[2][2]={{1.0, 2.0},{3.0, 2.0}};
- double B[2][2]={{3.0, 2.0},{1.0, 0.0}};
- naive(A, 2, 2, B, 2, 2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement