Mathc matrices/c22l
Installer et compiler ces fichiers dans votre répertoire de travail.
c00f.c |
---|
/* ------------------------------------ */
/* Save as : c00f.c */
/* ------------------------------------ */
#include "v_a.h"
#include "dot_au.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mR(i_mR(r,r ),9.);
double **u = r_mR(i_mR(r,C1),9.);
double **v = r_mR(i_mR(r,C1),9.);
double **projuv = i_mR(r,C1);
double **umnsprojuv = i_mR(r,C1);
clrscrn();
printf(" A :");
p_mR(A,S3,P0,C6);
printf(" u :");
p_mR(u,S3,P0,C6);
printf(" v :");
p_mR(v,S3,P0,C6);
proj_Au_mR(A,u,v,projuv);
printf(" vector component of u along v \n\n");
printf(" projuv :");
p_mR(projuv,S8,P4,C6);
stop();
clrscrn();
printf(" vector component of u orthogonal to v \n\n");
printf(" u-projuv :");
sub_mR(u,projuv,umnsprojuv);
p_mR(umnsprojuv,S8,P4,C6);
printf(" <v, u-projuv> = %.12f \n\n", dot_Au_R(A,v,umnsprojuv));
f_mR(A);
f_mR(u);
f_mR(v);
f_mR(projuv);
f_mR(umnsprojuv);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R3);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Nous vérifions une propriètée du projeté de u sur v.
Exemple de sortie écran :
------------------------------------
A :
-5 +8 +2
-3 +4 +2
+2 -5 +6
u :
-7
+4
-9
v :
-1
-5
-9
vector component of u along v
projuv :
+0
+1
+1
Press return to continue.
vector component of u orthogonal to v
u-projuv :
-7
+3
-10
<v, u-projuv> = 0.000000000001
Press return to continue
Press X to stop