Linear Algebra and the C Language/a0h0
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **X_rsymmetric_mR(
double **A,
int n)
{
int r;
int c;
double x;
isquare_mR(A,"rsymmetric_mR();","(A)");
for ( r=R1; r<A[R_SIZE][C0]; r++)
for ( c=C1; c<A[C_SIZE][C0]; c++)
{
x = r_I (n);
A[r][c] = x;
A[c][r] = x;
}
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int rc)
{
double **A = rsymmetric_mR(i_mR(rc,rc),9);
clrscrn();
printf(" A : ");
p_mR(A, S4,P0,C6);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
fun(rp_I(RC3)+RC1);
while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A :
+7 -4 +9 -9
-4 +5 -3 +1
+9 -3 -9 -3
-9 +1 -3 -1
Press return to continue
Press X return to stop