Mathc matrices/c25c
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c01a.c |
---|
/* ------------------------------------ */
/* Save as : c01a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define RCQ RC3
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **Q = r_Q_mR(i_mR(RCQ,RCQ), 9);
double **u[RCQ];
int c,c2;
/* ------------------------------------ */
/* ------------------------------------ */
for(c=C0; c<csize_R(Q); c++)
{
u[c] = i_mR(RCQ,C1);
c_c_mR(Q,(c+C1),u[c],C1); }
/* ------------------------------------ */
/* ------------------------------------ */
clrscrn();
printf(" Orthonormal bases :\n\n");
for(c=C0; c<csize_R(Q); c++)
{
printf(" u[%d] :",c);
p_mR(u[c],S5,P4,C6);
}
stop();
/* ------------------------------------ */
/* ------------------------------------ */
clrscrn();
printf(" <u,u> = ||u||^2\n"
" (<u,u>)^(1/2) = ||u|| \n\n");
for(c=C0; c<csize_R(Q); c++)
printf(" ||u[%d]|| = %.4f :\n",c,norm_R(u[c]));
printf(" \n\n\n"
" <u,v> = v^t u\n\n");
for(c=C0; c<csize_R(Q); c++)
for(c2=C0; c2<csize_R(Q); c2++)
if(c!=c2)
printf(" <u[%d],u[%d]> = %+.4f\n",c,c2, dot_R(u[c],u[c2]));
/* ------------------------------------ */
/* ------------------------------------ */
for(c=C0; c<csize_R(Q); c++)
f_mR(u[c]);
f_mR(Q);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Vérifions les propriétés d'une matrice orthonormale.
Exemple de sortie écran :
--------------------------------
Orthonormal bases :
u[0] :
-0.6937
+0.6070
-0.1734
-0.3468
u[1] :
-0.2404
+0.1778
-0.2550
+0.9195
u[2] :
-0.0995
+0.2611
+0.9422
+0.1848
u[3] :
+0.6717
+0.7292
-0.1308
-0.0017
Press return to continue.
--------------------------------
<u,u> = ||u||^2
(<u,u>)^(1/2) = ||u||
||u[0]|| = 1.0000 :
||u[1]|| = 1.0000 :
||u[2]|| = 1.0000 :
||u[3]|| = 1.0000 :
<u,v> = v^t u
<u[0],u[1]> = +0.0000
<u[0],u[2]> = +0.0000
<u[0],u[3]> = +0.0000
<u[1],u[0]> = +0.0000
<u[1],u[2]> = +0.0000
<u[1],u[3]> = +0.0000
<u[2],u[0]> = +0.0000
<u[2],u[1]> = +0.0000
<u[2],u[3]> = -0.0000
<u[3],u[0]> = +0.0000
<u[3],u[1]> = +0.0000
<u[3],u[2]> = -0.0000
Press return to continue
Press X to stop