is this a good practice ?


B

bernard

Hi

is this a good practice ?

double **AT = mul_mR(A,T,i_mR(R2,C3));

example:

/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
double t[R2*C3]=
{ 1,0, 1,
0,1, 2};

double **T = c_a_A_mR(t,i_mR(R2,C3));
double **A = r_mR( i_mR(R2,C2),999.);
double **AT = mul_mR(A,T,i_mR(R2,C3));
double **Ab = c_mR(AT, i_AbR0_mR(R2,C2,C1));


printf(" Find a matrice, that has this reduced row-echelon form :
\n");
p_mR(T,5,0,6);
getchar();

printf(" I suggest this matrix : \n");
p_mR(AT,5,0,6);
getchar();

printf("\n With the Gauss Jordan function :\n");
p_mR(gj_mR(Ab),10,5,7);
getchar();

f_mR(Ab);
f_mR(A);
f_mR(T);
f_mR(AT);

return 0;
}

test:

Find a matrice, that has this reduced row-echelon form :

+1 +0 +1
+0 +1 +2


I suggest this matrix :

+42 +486 +1014
-341 -527 -1395



With the Gauss Jordan function :

+1.00000 -0.00000 +1.00000
+0.00000 +1.00000 +2.00000

Thank
 
Ad

Advertisements

B

Ben Bacarisse

bernard said:
is this a good practice ?

double **AT = mul_mR(A,T,i_mR(R2,C3));

Your question is not entirely clear because we can't see enough of the
definitions to know what is going on. I find the above, as well as this:

double t[R2*C3]=
{ 1,0, 1,
0,1, 2};

double **T = c_a_A_mR(t,i_mR(R2,C3));
double **A = r_mR( i_mR(R2,C2),999.);
double **AT = mul_mR(A,T,i_mR(R2,C3));
double **Ab = c_mR(AT, i_AbR0_mR(R2,C2,C1));

hard to follow. The names are not very helpful, so from that point of
view I think you can improve things.

If your question is about representing 2D arrays, have you read the C
FAQs on this topic? There is a lot of good advice, though nowadays
you might be able to reply on C99's variably modified arrays. For
scientific computations they simplify array parameter passing
considerably.

<snip>
 
Ad

Advertisements


Top