Linear Algebra and the C Language/a0ei


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00c.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */   
void x_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);
    }
}
/* ------------------------------------ */
int main(void)
{  
double **A     = i_mR(R4,R5);
double **A_t   = i_mR(R5,R3);

  clrscrn();
  
  printf(" A[R%d,C%d]:",rsize_R(A),csize_R(A));
  p_mR(A, S4,P0,C6);

  printf(" A_t[R%d,C%d]:",rsize_R(A_t),csize_R(A_t));
  p_mR(A_t, S4,P0,C6);
   
  canItranspose_mR(A,A_t,"main();","(A or A_t)");
  
  f_mR(A);
  f_mR(A_t);
        
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Screen output example:

                                                                                       
 A[R4,C5]: 
  +0   +0   +0   +0   +0 
  +0   +0   +0   +0   +0 
  +0   +0   +0   +0   +0 
  +0   +0   +0   +0   +0 

 A_t[R5,C3]: 
  +0   +0   +0 
  +0   +0   +0 
  +0   +0   +0 
  +0   +0   +0 
  +0   +0   +0 


 Error : main();

 transpose_mR(); Verify the sizes of the matrices. (A or A_t) 
 Press return to continue.