Aller au contenu

Mathc matrices/a70 : vbtm

Un livre de Wikilivres.


Bibliothèque


Installer ce fichier dans votre répertoire de travail.

vrm_sym.h
/* ------------------------------------ */
/*  Save as :   vrm_sym.h               */
/* ------------------------------------ */
double **rsymmetric_mR(
double **A,
int n)
{
int r;
int c;
double x;

  isquare_mR(A,"rsymmetric_mR();","(A)");

  for   ( r=R1; r<A[R_SIZE][C0]; r++)
    for ( c=C1; c<A[C_SIZE][C0]; c++)
        {
         x = r_I (n);
         A[r][c] = x;
         A[c][r] = x;
        }
        
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **mul_sDA_mR(
double    s,
double  **A,
double **sA
)
{
int      r;
  
  c_mR(A,sA);
  
  for(r=R1; r<A[R_SIZE][C0]; r++)
  
//     if( r <= csize_R(A) )
     
             sA[r][r] = abs(s * A[r][r]);
             
 return(sA);
}
/* ------------------------------------ */
double **rPsymmetric_mR(
double **A,
int n)
{
int r;
int c;
double x;

double **B = i_mR(rsize_R(A),csize_R(A));

  isquare_mR(A,"rsymmetric_mR();","(A)");
  
  for   ( r=R1; r<A[R_SIZE][C0]; r++)
    for ( c=C1; c<A[C_SIZE][C0]; c++)
        {
         x = r_I (n);
         B[r][c] = x;
         B[c][r] = x;
        }
        
        
  mul_sDA_mR(111.,B,A);
        
  f_mR(B);        
        
return(A);
}
/* ------------------------------------ */
double **rEsymmetric_mR(
double **A,
int      n,
double   E                                        /*  1E-1  1E-0  1E+1 */
)
{
int r = rsize_R(A);
int c = csize_R(A);	
	
double **B   =        rE_mR(  i_mR(r,c),n,E);
double **B_T = transpose_mR(B,i_mR(c,r));

         mul_mR(B,B_T, A);        
         
   f_mR(B);
   f_mR(B_T);

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

  isquare_mR(A,"rskewsymmetric_mR();","(A)");

  for   ( r=R1; r<A[R_SIZE][C0]; r++)
    for ( c=C1; c<A[C_SIZE][C0]; c++)
        {
		 if(r==c) 
		    A[r][c] = 0.;
		    
		 else{       x = r_I (n);
               A[r][c] = -x;
               A[c][r] =  x;
	         }
        }
      
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **rcentrosymmetric_mR(
double **A,
int k)
{
int r;
int c;
int n = rsize_R(A);

double x;

  isquare_mR(A,"rcentrosymmetric_mR();","(A)");

  for   ( r=R1; r<A[R_SIZE][C0]; r++)
    for ( c=C1; c<A[C_SIZE][C0]; c++)
        {
         x = r_I(k);
         A[n-r+1][n-c+1] = x;
         A[r][c] = x;
        }
        
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */