Projet

Général

Profil

« Précédent | Suivant » 

Révision 560

Ajouté par Florentin GAMEL il y a presque 3 ans

Implantation des fonctions et fonctions vérifiées

Voir les différences:

branch/gamel/sp4a3/sp4a3_kalman.c
#include "sp4a3_kalman_extra.h"
void Add_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double B[nb][mb], double R[na][ma]){
void Add_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(i=0;i<na;i++){ // Les boucles for balayent la matrice
for(j=0;j<ma;j++){
R[i][j]=A[i][j]+B[i][j]; // Ici on additionne les elements des 2 matrices A et B
}
}
}
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]){
float det;
//Calcul du determinant
det= (A[0][0]*A[1][1] - A[1][0]*A[0][1]);
//Calcul de chaque valeur de la matrice R avec la méthode des comatrices
R[0][0]= A[1][1]/det;
R[0][1]= -(A[0][1]/det);
R[1][0]= -(A[1][0]/det);
R[1][1]= A[0][0]/det;
}
void Transpose_Mat(int n,int m,double A[n][m],double R[m][n]){
......
R[j][i]=A[i][j];
}
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(i=0;i<na;i++){ // Les boucles for balayent la matrice
for(j=0;j<ma;j++){
R[i][j]=A[i][j]-B[i][j]; // Ici on soustrait les elements des 2 matrices A et B
}
}
}
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 Mul_Mat_Mat(int na,int ma,double A[na][ma], int nb,int mb,double B[nb][mb], double R[na][mb]){
int i,j,k;
for(i=0;i<na;i++){ // Ici on balaye les lignes de la matrice 1 et les colonnes de la matrice 2
for(j=0;j<mb;j++){
R[i][j]=0; // Mise a zero de la matrice R
for(k=0;k<ma;k++){ // La boucle balaye les colonnes de la matrice 1
R[i][j] += A[i][k]*B[k][j]; // Ici on somme tous les produits entre A et B
}
}
}
}

Formats disponibles : Unified diff