Projet

Général

Profil

« Précédent | Suivant » 

Révision 445

Ajouté par Lilian MEMBRE il y a presque 3 ans

Redaction calcul inverse d'une matrice 2x2 puis tests
tout est ok

Voir les différences:

branch/MEMBRE/sp4a3/sp4a3_kalman.c
#include "sp4a3_kalman_extra.h"
/* Addition de matrices */
void Add_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double B[nb][mb], double R[na][ma]){
......
}
}
}
/* Inversion d'une matrice de taille 2x2 */
void Inverse_Mat_22(int n,int m,double A[n][m],double B[n][m]){
void Inverse_Mat_22(int n,int m,double A[n][m],double R[n][m])
{
int i,j;
int determinant = A[0][0]*A[1][1] - A[1][0]*A[0][1];
R[0][0]=A[1][1]/determinant;
R[0][1]= - A[0][1]/determinant;
R[1][0]= - A[1][0]/determinant;
R[1][1]=A[0][0]/determinant;
}
/* Transposee d'une matrice */
void Transpose_Mat(int n,int m,double A[n][m],double R[m][n]){
void Transpose_Mat(int n,int m,double A[n][m],double R[m][n])
{
int i,j;
for (i=0;i<n;i++)
for (j=0;j<m;j++)
R[j][i]=A[i][j];
for (i=0;i<n;i++)
{
for (j=0;j<m;j++)
{
R[j][i]=A[i][j];
}
}
}
/* Soustraction d'une matrice */
void Sub_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double B[nb][mb], double R[na][ma]){
void Sub_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double B[nb][mb], double R[na][ma])
{
int i,j;
for (int i = 0; i < na; i++)
......
}
}
}
/* Multiplication de deux matrices */
void Mul_Mat_Mat(int na,int ma,double A[na][ma], int nb,int mb,double B[nb][mb], double R[na][mb])
{
......
}
void tests_unitaires(void){
//Matrices d'entrée

Formats disponibles : Unified diff