Aller au contenu

Mathc complexes/Fichiers c : test02b

Un livre de Wikilivres.


Application

Installer et compiler ces fichiers dans votre répertoire de travail.

c00b.c
/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */  
/* ------------------------------------ */
double **xeye_mZ(
double **ID
)
{
int r;
int c;

  isquare_mZ(ID,"eye_mZ();","(ID)");

  for (   r=R1; r<ID[R_SIZE][C0]; r++)
    for ( c=R1; c<ID[C_SIZE][C0]; c+=C2)

        if(((r-R1)*C2)==c-C1)
            {
                 ID[r][c   ] = 1.;
                 ID[r][c+C1] = 0.;
            }
        else{
                 ID[r][c   ] = 0.;
                 ID[r][c+C1] = 0.;
            }
            
return(ID);
}
/* ------------------------------------ */ 
/* ------------------------------------ */
int main(void)
{  
double **A = eye_mZ(i_mZ(R4,C4));

  clrscrn();
  
  printf(" A:");
  p_mZ(A, S5,P0, S2,P0, C5);

  stop();
    
  f_mZ(A);
        
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
La fonction initialise une matrice identité, elle doit être carré.

Exemple de sortie écran :

 A:
   +1+0i    +0+0i    +0+0i    +0+0i 
   +0+0i    +1+0i    +0+0i    +0+0i 
   +0+0i    +0+0i    +1+0i    +0+0i 
   +0+0i    +0+0i    +0+0i    +1+0i 

 Press return to continue.