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

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

__NOTOC__ Install this file in your working directory. /* ------------------------------------ */ /* Save as : vism.h */ /* ------------------------------------ */ /* ------------------------------------ */ /* ------------------------------------ */ double **m0_mR( double **Zer ) { int r; int c; for ( r=R1; r<Zer[R_SIZE][C0]; r++) for ( c=C1; c<Zer[C_SIZE][C0]; c++) Zer[r][c] = 0.; return(Zer); } /* ------------------------------------ */ double **m1_mR( double **One ) { int r; int c; for ( r=R1; r<One[R_SIZE][C0]; r++) for ( c=C1; c<One[C_SIZE][C0]; c++) One[r][c] = 1.; return(One); } /* ------------------------------------ */ /* ------------------------------------ */ /* ------------------------------------ */ /* ------------------------------------ */ double **eye_mR( double **ID ) { int r; int c; isquare_mR(ID,"eye_mR();","(ID)"); for ( r=R1; r<ID[R_SIZE][C0]; r++) for ( c=C1; c<ID[C_SIZE][C0]; c++) if(r==c) ID[r][c] = 1.; else ID[r][c] = 0.; return(ID); } /* ------------------------------------ */ /* ------------------------------------ */ double **clean_eye_mR( double **ID ) { int r; int c; isquare_mR(ID,"clean_eye_mR();","(ID)"); for ( r=R1; r<ID[R_SIZE][C0]; r++) for ( c=C1; c<ID[C_SIZE][C0]; c++) if(r!=c) ID[r][c] = 0.; return(ID); } /* ------------------------------------ */ /* ------------------------------------ */ /* ------------------------------------ */ /* ------------------------------------ */ double **J_mR( double **J ) { int r; int c; isquare_mR(J,"J_mR();","(J)"); m0_mR(J); for( r=R1,c=csize_R(J); r<J[R_SIZE][C0]; r++, c--) J[r][c] = 1.; return(J); } /* ------------------------------------ */ /* ------------------------------------ */ /* ------------------------------------ */ /* ------------------------------------ */ double **rot2D_mR( double **A, double alpha ) { A[R1][C1] = cos(alpha);A[R1][C2] = -sin(alpha); A[R2][C1] = sin(alpha);A[R2][C2] = cos(alpha); return(A); } /* ------------------------------------ */ double **Rot2D_mR( double **A, double alpha ) { m0_mR(A); A[R1][C1] = cos(alpha);A[R1][C2] = -sin(alpha); A[R2][C1] = sin(alpha);A[R2][C2] = cos(alpha); A[R3][C3] = 1.; return(A); } /* ------------------------------------ */ void Rot2D_P_mR( double **A, double **P, double alpha ) { m0_mR(A); A[R1][C1] = cos(alpha); A[R1][C2] = -sin(alpha); A[R1][C3] = P[1][1]*(1-cos(alpha))+P[2][1]*sin(alpha); A[R2][C1] = sin(alpha); A[R2][C2] = cos(alpha); A[R2][C3] = P[2][1]*(1-cos(alpha))-P[1][1]*sin(alpha); A[R3][C3] = 1.; } /* ------------------------------------ */ /* ------------------------------------ */