Mathc matrices/Fichiers h : vsm
Apparence
Installer ce fichier dans votre répertoire de travail.
vism.h |
---|
/* ------------------------------------ */
/* Save as : vism.h */
/* ------------------------------------ */
/* ------------------------------------ */
/* ------------------------------------ */
double **m0_mR(
double **Zer
)
{
int r;
int c;
for ( r=R1; r<Zer[R_SIZE][C0]; r++)
for ( c=C1; c<Zer[C_SIZE][C0]; c++)
Zer[r][c] = 0.;
return(Zer);
}
/* ------------------------------------ */
double **m1_mR(
double **One
)
{
int r;
int c;
for ( r=R1; r<One[R_SIZE][C0]; r++)
for ( c=C1; c<One[C_SIZE][C0]; c++)
One[r][c] = 1.;
return(One);
}
/* ------------------------------------ */
/* ------------------------------------ */
/* ------------------------------------ */
/* ------------------------------------ */
double **eye_mR(
double **ID
)
{
int r;
int c;
isquare_mR(ID,"eye_mR();","(ID)");
for ( r=R1; r<ID[R_SIZE][C0]; r++)
for ( c=C1; c<ID[C_SIZE][C0]; c++)
if(r==c) ID[r][c] = 1.;
else ID[r][c] = 0.;
return(ID);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **clean_eye_mR(
double **ID
)
{
int r;
int c;
isquare_mR(ID,"eye_mR();","(ID)");
for ( r=R1; r<ID[R_SIZE][C0]; r++)
for ( c=C1; c<ID[C_SIZE][C0]; c++)
if(r!=c) ID[r][c] = 0.;
return(ID);
}
/* ------------------------------------ */
/* ------------------------------------ */
/* ------------------------------------ */
/* ------------------------------------
A[5][5]
A[n-i+1][n-j+1]
A[5-i+1][5-j+1] A[5-(1)+1][5-(1)+1]
A[ i ][ j ] A[ (1) ][ (1) ]
------------------------------------ */
double **J_mR(
double **J
)
{
int r;
int c;
isquare_mR(J,"J_mR();","(J)");
m0_mR(J);
for( r=R1,c=csize_R(J); r<J[R_SIZE][C0]; r++, c--)
J[r][c] = 1.;
return(J);
}
/* ------------------------------------ */
/* ------------------------------------ */
/* ------------------------------------ */
/* ------------------------------------ */
double **rot2D_mR(
double **A,
double alpha
)
{
A[R1][C1] = cos(alpha);A[R1][C2] = -sin(alpha);
A[R2][C1] = sin(alpha);A[R2][C2] = cos(alpha);
return(A);
}
/* ------------------------------------ */
double **Rot2D_mR(
double **A,
double alpha
)
{
m0_mR(A);
A[R1][C1] = cos(alpha);A[R1][C2] = -sin(alpha);
A[R2][C1] = sin(alpha);A[R2][C2] = cos(alpha);
A[R3][C3] = 1.;
return(A);
}
/* ------------------------------------ */
void Rot2D_P_mR(
double **A,
double **P,
double alpha
)
{
m0_mR(A);
A[R1][C1] = cos(alpha);
A[R1][C2] = -sin(alpha);
A[R1][C3] = P[1][1]*(1-cos(alpha))+P[2][1]*sin(alpha);
A[R2][C1] = sin(alpha);
A[R2][C2] = cos(alpha);
A[R2][C3] = P[2][1]*(1-cos(alpha))-P[1][1]*sin(alpha);
A[R3][C3] = 1.;
}
/* ------------------------------------ */
/* ------------------------------------ */
Dans ce fichieron introduit la construction de quelques matrices spécifiques, la matrice zéro, la matrice identité.