Mathc matrices/038
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rdefinite_positive_mR( i_mR(r,r), 99);
clrscrn();
printf(" Copy/Past into the octave windows \n\n");
p_Octave_mR(A,"a",P9);
printf(" [U] = chol (a,\"upper\")\n\n"
" inva = chol2inv(U)\n\n"
" a*inva\n\n"
" inva*a\n\n");
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R4)+R1);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Calcul plus rapidement l'inverse d'une matrice définie positive. U doit être la matrice triangulaire supérieure.
Exemple de sortie écran :
Copy/Past into the octave windows
a=[
+42.251901442,-4.047968591,+26.662831054;
-4.047968591,+60.449936427,+3.395211361;
+26.662831054,+3.395211361,+40.298162131]
[U] = chol (a,"upper")
inva = chol2inv(U)
a*inva
inva*a
Press return to continue
Press X return to stop