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

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 : vi_err.h */ /* ------------------------------------ */ /* ------------------------------------ */ void isquare_mR( double **A, char function[], char matrices[] ) { if ( A[R_SIZE][C0] != A[C_SIZE][C0] ) { printf("\n Error : %s\n",function); printf("\n Matrix %s must be square. \n",matrices); stop(); exit(EXIT_FAILURE); } } /* ------------------------------------ */ void dif_sizes_mR( double **A, double **B, char function[], char matrices[] ) { if( A[R_SIZE][C0]!=B[R_SIZE][C0] || A[C_SIZE][C0]!=B[C_SIZE][C0] ) { printf("\n Error : %s\n",function); printf("\n The matrices %s must have the same size. \n",matrices); stop(); exit(EXIT_FAILURE); } } /* ------------------------------------ */ void canItranspose_mR( double **A, double **A_t, char function[], char matrices[] ) { if ((A[R_SIZE][C0] != A_t[C_SIZE][C0]) || (A_t[R_SIZE][C0] != A[C_SIZE][C0])) { printf("\n Error : %s\n",function); printf("\n transpose_mR(); Verify the sizes of the matrices. %s \n", matrices); stop(); exit(EXIT_FAILURE); } } /* ------------------------------------ */ void canImul_mR( double **A, double **B, double **AB, char function[], char matrices[] ) { if ( ( A[C_SIZE][C0] != B[R_SIZE][C0] ) || ( A[R_SIZE][C0] != AB[R_SIZE][C0] ) || ( B[C_SIZE][C0] != AB[C_SIZE][C0] ) ) { printf("\n Error : %s\n",function); printf("\n mul_mR(); Verify the size of the matrices. %s \n", matrices); stop(); exit(EXIT_FAILURE); } } /* ------------------------------------ */ /* ------------------------------------ */ These functions stop the program, if there is an error.