Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Linear Algebra and the C Language/a0ma

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

__NOTOC__ Install and compile this file in your working directory. /* ------------------------------------ */ /* Save as : c04c.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define RCA RC4 /* ------------------------------------ */ #define EV R1 /* ------------------------------------ */ int main(void) { double a[RCA*RCA]={ +9.825339522090, +7.309094034726, -3.954100051573, -1.198212136840, +7.309094034726, +5.437252879491, -2.941464672512, -0.891352931064, -3.954100051573, -2.941464672512, +1.591284167096, +0.482207323363, -1.198212136840, -0.891352931064, +0.482207323363, +0.146123431322 }; double evalue[RCA*C1]={ +17, -0, -0, -0 }; double **A = ca_A_mR(a, i_mR(RCA,RCA)); double **EValue = ca_A_mR(evalue, i_mR(RCA,C1)); double **Ide = eye_mR( i_mR(RCA,RCA)); double **sIde = smul_mR(EValue[EV][C1],Ide, i_mR(RCA,RCA)); double **AmnssIde = sub_mR(A,sIde, i_mR(RCA,RCA)); double **b = m0_mR(i_mR(RCA,C1)); double **Ab = c_A_b_Ab_mR(AmnssIde,b, i_Abr_Ac_bc_mR(RCA,RCA,C1)); double **Ab_free = i_Abr_Ac_bc_mR(RCA,RCA,RCA); double **b_free = i_mR(RCA,RCA); double **V = i_mR(RCA,RCA); clrscrn(); printf(" An eigenvector associated with an eigenvalue\n" " with single multiplicity is unique, up to a\n" " change in the sign. \n\n\n" " A:"); p_mR(A,S10,P5,C10); gj_PP_mR(Ab,NO); put_zeroR_mR(Ab,Ab_free); put_freeV_mR(Ab_free); gj_PP_mR(Ab_free,YES); c_Ab_b_mR(Ab_free,b_free); c_c_mR(b_free,C2,V,EV); Normalize_mR(V); printf("\n\n\n" " Copy V%d into the last file\n\n" " V%d:",EV,EV); P_mR(V,S10,P12,C10); stop(); f_mR(A); f_mR(EValue); f_mR(Ide); f_mR(sIde); f_mR(AmnssIde); f_mR(Ab); f_mR(b); f_mR(Ab_free); f_mR(b_free); f_mR(V); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: An eigenvector associated with an eigenvalue with single multiplicity is unique, up to a change in the sign. A: +9.82534 +7.30909 -3.95410 -1.19821 +7.30909 +5.43725 -2.94146 -0.89135 -3.95410 -2.94146 +1.59128 +0.48221 -1.19821 -0.89135 +0.48221 +0.14612 Copy V1 into the last file V1: -0.760237560476, -nan, -nan, -nan, -0.565542575476, -nan, -nan, -nan, +0.305949262143, -nan, -nan, -nan, +0.092711897619, -nan, -nan, -nan Press return to continue.