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/a04s

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

__NOTOC__ + Pinv_Rn_mR(); Pinv_Cn_mR(); /* ------------------------------------ */ /* ------------------------------------ */ double **Pinv_Rn_mR( double **A, double **Pinv, double FACTOR ) { int r = rsize_R(A); int c = csize_R(A); double **FA = smul_mR(FACTOR,A, i_mR(r,c)); double **tFA = transpose_mR(FA, i_mR(c,r)); double **U = i_mR(r,c); double **tU = i_mR(c,r); double **V = i_mR(c,c); double **tUA = i_mR(c,c); double **EValue = i_mR(c,c); double **invEValue = i_mR(c,c); double **VinvEValue = i_mR(c,c); svd_U_Rn_mR(tFA,U); svd_V_Rn_mR(tFA,V); /* EValue = tU A V */ transpose_mR(U,tU); mul_mR(tU,A,tUA); mul_mR(tUA,V,EValue); inv_svd_mR(EValue,invEValue); /* PseudoInverse = V invEValue tU */ mul_mR(V,invEValue,VinvEValue); mul_mR(VinvEValue,tU,Pinv); f_mR(FA); f_mR(tFA); f_mR(U); f_mR(tU); f_mR(tUA); f_mR(V); f_mR(EValue); f_mR(invEValue); f_mR(VinvEValue); return(Pinv); } /* ------------------------------------ */ /* ------------------------------------ */ /* ------------------------------------ */ /* ------------------------------------ */ double **Pinv_Cn_mR( double **A, double **Pinv, double FACTOR ) { int r = rsize_R(A); int c = csize_R(A); double **FA = smul_mR(FACTOR,A, i_mR(r,c)); double **U = i_mR(r,r); double **tU = i_mR(r,r); double **V = i_mR(c,c); double **tUA = i_mR(r,c); double **EValue = i_mR(r,c); double **tEValue = i_mR(c,r); double **invtEValue = i_mR(c,r); double **VinvtEValue = i_mR(c,r); svd_U_Cn_mR(FA,U); svd_V_Cn_mR(FA,V); /* EValue = tU A V */ transpose_mR(U,tU); mul_mR(tU,A,tUA); mul_mR(tUA,V,EValue); transpose_mR(EValue,tEValue); inv_svd_mR(tEValue,invtEValue); /* PseudoInverse = V invtEValue tU */ mul_mR(V,invtEValue,VinvtEValue); mul_mR(VinvtEValue,tU,Pinv); f_mR(FA); f_mR(U); f_mR(tU); f_mR(tUA); f_mR(V); f_mR(EValue); f_mR(tEValue); f_mR(invtEValue); f_mR(VinvtEValue); return(Pinv); } /* ------------------------------------ */ /* ------------------------------------ */