Mathc matrices/036
Apparence
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);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **rdefinite_positive_mR(
double **A,
int n
)
{
int r = rsize_R(A);
double **Q = r_Q_mR( i_mR(r,r),n);
double **QT = transpose_mR(Q, i_mR(r,r));
double **D = rpdiag_mR( i_mR(r,r),n);
double **QD = mul_mR(Q,D, i_mR(r,r));
mul_mR(QD,QT,A);
f_mR(Q);
f_mR(QT);
f_mR(D);
f_mR(QD);
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **rdefinite_negative_mR(
double **A,
int n
)
{
int r = rsize_R(A);
double **Q = r_Q_mR( i_mR(r,r),n);
double **QT = transpose_mR(Q, i_mR(r,r));
double **D = rpdiag_mR( i_mR(r,r),n);
double **sD = smul_mR(-1,D, i_mR(r,r));
double **QsD = mul_mR(Q,sD, i_mR(r,r));
mul_mR(QsD,QT,A);
f_mR(Q);
f_mR(QT);
f_mR(D);
f_mR(sD);
f_mR(QsD);
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **rdefpos_diag_mR(
double **D,
double **A,
int n
)
{
int r = rsize_R(A);
double **Q = r_Q_mR( i_mR(r,r),n);
double **QT = invgj_mR(Q, i_mR(r,r));
double **QD = mul_mR(Q,D, i_mR(r,r));
mul_mR(QD,QT,A);
f_mR(Q);
f_mR(QT);
f_mR(QD);
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */