Aller au contenu

Mathc complexes/Fichiers h : vbtm

Un livre de Wikilivres.

Bibliothèque

Installer ce fichier dans votre répertoire de travail.

wbtm.h
/* ------------------------------------ */
/*  Save as :  wbtm.h                   */
/* ------------------------------------ */
double **conj_mZ(
double **A,
double **cA
)
{
nb_Z z;
int r;
int c;

  dif_sizes_mZ(A,cA,"conj_mZ();","(A or cA)");

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

            z = conj_Z(z);

            cA[r][c   ] = z.r;
            cA[r][c+C1] = z.i;
         }
         
return(cA);
}
/* ------------------------------------ */
double **transpose_mZ(
double **A,
double **A_t
)
{
int r,m;
int c,n;

  canItranspose_mZ(A,A_t,"transpose_mZ();","(A or A_t)");

  for (   r=R1, m=C1; r<A[R_SIZE][C0]; r++,   m+=C2)
    for ( c=C1, n=R1; c<A[C_SIZE][C0]; c+=C2, n++)
        {
         A_t[n][m]    = A[r][c];;
         A_t[n][m+C1] = A[r][c+C1];;
        }
        
return(A_t);
}
/* ------------------------------------ */
double **ctranspose_mZ(
double **A,
double **cA_t
)
{
int r,m;
int c,n;

  canItranspose_mZ(A,cA_t,"ctranspose_mZ();","(A or cA_t)");

  for (   r=R1, m=C1; r<A[R_SIZE][C0]; r++, m+=C2)
    for ( c=C1, n=R1; c<A[C_SIZE][C0]; c+=C2 ,n++)
        {
         cA_t[n][m]    =  A[r][c];;
         cA_t[n][m+C1] = -A[r][c+C1];;
        }
        
 return(cA_t);
}
/* ------------------------------------ */
nb_Z trace_Z(
double **A
)
{
nb_Z trace;
nb_Z z;

int    r,c;

  isquare_mZ(A,"trace_mZ();","(A)");

  trace = i_Z(0,0);

  for (   r=R1,c=C1; r<A[R_SIZE][C0]; r++,c+=C2)
        {
         z = i_Z(A[r][c],A[r][c+C1]);
         trace = add_Z(trace,z);
        }

  return(trace);
}
/* ------------------------------------ */
/* ------------------------------------ */


Il y a les fonctions qui permettent de calculer la transposée et la conjuguée transposée d'une matrice.