Révision 466
Ajouté par Enzo LACHEZE il y a presque 3 ans
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;
|
||
na=nb;
|
||
ma=mb;
|
||
for (i=0;i<na;i++)
|
||
{
|
||
for (j=0;j<ma;j++)
|
||
{
|
||
R[i][j]=A[i][j]+B[i][j];
|
||
}
|
||
}
|
||
}
|
||
|
||
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 B[n][m]){
|
||
int i , j;
|
||
double det;
|
||
det=1/(A[0][0]*A[1][1]-A[0][1]*A[1][0]);
|
||
B[0][0]=det*A[1][1];
|
||
B[1][1]=det*A[0][0];
|
||
B[0][1]=-det*A[0][1];
|
||
B[1][0]=-det*A[1][0];
|
||
|
||
}
|
||
|
||
... | ... | |
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;
|
||
na=nb;
|
||
ma=mb;
|
||
for (i=0;i<na;i++)
|
||
{
|
||
for (j=0;j<ma;j++)
|
||
{
|
||
R[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 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++)
|
||
{
|
||
for(j=0;j<mb;j++)
|
||
{
|
||
R[i][j]=0;
|
||
}
|
||
}
|
||
|
||
for (i=0;i<na;i++)
|
||
{
|
||
for(j=0;j<mb;j++)
|
||
{
|
||
for(k=0;k<ma;k++)
|
||
{
|
||
R[i][j]+=A[i][k]*B[k][j];
|
||
}
|
||
printf(" %lf", R[i][j]);
|
||
}
|
||
printf("\n");
|
||
}
|
||
|
||
}
|
||
|
Formats disponibles : Unified diff
tp3 implantation des opérations matricielles basiques,
test et validation des procédures