Linear Algebra and the C Language/a0mg
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rsymmetric_mR( i_mR(r,r),99);
double **EigsValue = eigs_mR(A, i_mR(r,C1));
clrscrn();
printf(" Let's calculate the eigenvalues"
" of a symmetric matrix.\n"
" The eigenvalues are positive and negative.\n\n"
" A :");
p_mR(A,S5,P0,C6);
printf(" EigsValue :");
p_mR(EigsValue,S13,P4,C1);
f_mR(A);
f_mR(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
Let's calculate the eigenvalues of a symmetric matrix.
The eigenvalues are positive and negative.
A :
-20 +28 -2
+28 +49 +95
-2 +95 +40
EigsValue :
+141.8404
-61.4747
-11.3657
Press return to continue
Press X return to stop