Projet

Général

Profil

« Précédent | Suivant » 

Révision 349

Ajouté par dgmbadinga il y a presque 4 ans

TP3: Implantation des fonction :Transposée,Addition,Soustraction,inverse, et multiplication pour vérification des test unitaires.

Voir les différences:

branch/MBADINGA/sp4a3/sp4a3_kalman.c
// Pour compiler : gcc sp4a3_kalman.c -lm
/* Pour compiler : gcc sp4a3_kalman.c -lm*/
#include <stdlib.h>
#include <stdio.h>
......
void Add_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double b[nb][mb], double out[na][ma]){
int i, j;
for (i=0; i<na; i++)
for (j=0; j<ma; j++)
out[i][j] = A[i][j]+b[i][j];
}
void Inverse_Mat_22(int n,int m,double A[n][m],double B[n][m]){
double det_A;
det_A= A[0][0]*A[1][1]-A[1][0]*A[0][1];
B[0][0]= A[1][1]*(1/(det_A));
B[0][1]= -A[0][1]*(1/(det_A));
B[1][0]= -A[1][0]*(1/(det_A));
B[1][1]= A[0][0]*(1/(det_A));
}
......
}
void Sub_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double b[nb][mb], double out[na][ma]){
int i, j;
for (i=0; i<na; i++)
for (j=0; j<ma; j++)
out[i][j] = A[i][j]-b[i][j];
}
void Mul_Mat_Mat(int na,int ma,double A[na][ma], int nb,int mb,double B[nb][mb], double out[na][mb]){
int i, j , k;
for (i=0; i<na; i++)
for (j=0; j<mb; j++)
{
out[i][j]=0;
for (k=0; k<ma; k++)
out[i][j] += A[i][k]*B[k][j];
}
}

Formats disponibles : Unified diff