Linear Algebra and the C Language/a0aa
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00g.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **U = r_mR(i_mR(r,r),9.);
double **Orth = i_mR(r,r);
double **Orth_Normal_T = i_mR(r,r);
clrscrn();
printf(" U :");
p_mR(U, S8,P4, C6);
printf(" Orth : orth_mR(U,Orth,NO);");
orth_mR(U,Orth,NO);
p_mR(Orth, S8,P4, C6);
stop();
clrscrn();
printf(" Orth_Normal : Normalize_mR(Orth);");
Normalize_mR(Orth);
p_mR(Orth, S8,P4, C6);
printf(" Orth_Normal_T : transpose_mR(Orth,Orth_Normal_T);");
transpose_mR(Orth,Orth_Normal_T);
p_mR(Orth_Normal_T, S8,P4, C6);
printf(" Orth_Normal_T Orth_Normal :");
mul_mR(Orth_Normal_T,Orth, U);
p_mR(U, S8,P4, C6);
f_mR(U);
f_mR(Orth);
f_mR(Orth_Normal_T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R2)+R2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
U :
-1.0000 +6.0000 -3.0000 -6.0000
-6.0000 -9.0000 +8.0000 +6.0000
-2.0000 -8.0000 -1.0000 -8.0000
-1.0000 +5.0000 -5.0000 -3.0000
Orth : orth_mR(U,Orth,NO);
-1.0000 +7.4048 -0.6799 -3.6063
-6.0000 -0.5714 +2.3226 +0.4873
-2.0000 -5.1905 -5.0700 -1.2562
-1.0000 +6.4048 -3.1155 +3.1948
Press return to continue.
Orth_Normal : Normalize_mR(Orth);
-0.1543 +0.6673 -0.1058 -0.7209
-0.9258 -0.0515 +0.3615 +0.0974
-0.3086 -0.4678 -0.7892 -0.2511
-0.1543 +0.5772 -0.4850 +0.6386
Orth_Normal_T : transpose_mR(Orth,Orth_Normal_T);
-0.1543 -0.9258 -0.3086 -0.1543
+0.6673 -0.0515 -0.4678 +0.5772
-0.1058 +0.3615 -0.7892 -0.4850
-0.7209 +0.0974 -0.2511 +0.6386
Orth_Normal_T Orth_Normal :
+1.0000 +0.0000 +0.0000 -0.0000
+0.0000 +1.0000 +0.0000 -0.0000
+0.0000 +0.0000 +1.0000 -0.0000
-0.0000 -0.0000 -0.0000 +1.0000
Press return to continue
Press X return to stop