Aller au contenu

Mathc complexes/Fichiers h : vrm tri

Un livre de Wikilivres.

Bibliothèque

Installer ce fichier dans votre répertoire de travail.

wrm_tri.h
/* ------------------------------------ */
/*  Save as :   wrm_tri.h               */
/* ------------------------------------ */
double **rdiag_mZ(
double **A,
int      n
)
{
int      r;
int      c;

  isquare_mZ(A,"r_diag_mZ;","(A)");
  
  for(r=R1, c=C1; r<A[R_SIZE][C0]; r++, c+=C2)
     {
             A[r][c  ] = r_I(n);
             A[r][c+1] = r_I(n);
     }
 return(A);
}
/* ------------------------------------ */
double **rpdiag_mZ(
double **A,
int      n
)
{
int      r;
int      c;

  isquare_mZ(A,"r_diag_mZ;","(A)");
  
  for(r=R1, c=C1; r<A[R_SIZE][C0]; r++, c+=C2)
     {
             A[r][c  ] = rp_I(n);
             A[r][c+1] = rp_I(n);
     }
 return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **rlower_mZ(
double **A,
int      n
)
{
int      r;
int      c;

  isquare_mZ(A,"r_lower_mZ;","(A)");
  
  for     (r=R1; r<A[R_SIZE][C0]; r++)
 	  for (c=C1; c<A[C_SIZE][C0]; c+=C2)

             if((2*r)>=c) { A[r][c  ] = r_I(n);
                            A[r][c+1] = r_I(n);}
 return(A);
}
/* ------------------------------------ */
double **rupper_mZ(
double **A,
int      n
)
{
int      r;
int      c;

  isquare_mZ(A,"r_upper_mZ;","(A)");

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

             if(c>=(((2*r)-1))) { A[r][c  ] = r_I(n);
                            A[r][c+1] = r_I(n);}
 return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **rcsymmetric_diag_mZ(
double **A,
int      n
)
{
int      r;
int      c;

  isquare_mZ(A,"r_diag_mZ;","(A)");
  
  for(r=R1, c=C1; r<A[R_SIZE][C0]; r++, c+=C2)
     {
             A[r][c  ] = r_I(n);
             A[r][c+1] =      0;
     }
 return(A);
}
/* ------------------------------------ */
double **rcsymmetric_lower_mZ(
double **A,
int      n
)
{
int      r;
int      c;

  isquare_mZ(A,"r_lower_mZ;","(A)");
  
  for     (r=R1; r<A[R_SIZE][C0]; r++)
 	  for (c=C1; c<A[C_SIZE][C0]; c+=C2)

             if((2*r)>=c) { A[r][c  ] = r_I(n);
                            A[r][c+1] = r_I(n);}
                            
    for(r=R1, c=C1; r<A[R_SIZE][C0]; r++, c+=C2)

             A[r][c+1] =      0;

 return(A);
}
/* ------------------------------------ */
double **rcsymmetric_upper_mZ(
double **A,
int      n
)
{
int      r;
int      c;

  isquare_mZ(A,"r_upper_mZ;","(A)");

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

             if(c>=((2*r)-1)) 
               { A[r][c  ] = r_I(n);
                 A[r][c+1] = r_I(n);}


    for(r=R1,c=C1; r<A[R_SIZE][C0]; r++, c+=C2)

                  A[r][c+1] =      0;
             
 return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */


Dans ce fichier se trouvent les fonctions qui permettront d'initialiser les matrices avec des valeurs aléatoires. Des matrices diagonales, triangulaires inférieures, triangulaires supérieures.