N
Nangi
Hi, I've got a problem with this code.
I've got a double Matrix A and a vector b, initialized with
DoubleMatr A = new double*[3];
DoubleVect b = new double[3];
where DoubleMatr and DoubleVect are defined as
typedef double* DoubleVect;
typedef double** DoubleMatr;
then i pass the matrix and the vector to a function
void CreateSystemFromPolygon(Polygon *p, double *X, double *Y,
DoubleMatr A, DoubleVect b)
....
for ( int i = 0 ; i < 3 ; i++)
{
for (int j = 0 ; j < 3; j++)
{
A[j] = 0;
}
b = 0.0;
}
A[0][0] = 1.0;
A[1][1] = 1.0;
b[0] = X[0];
b[1] = Y[0];
....
at runtime i watch the values of A[0][0] A[0][1] etc..
I see that the istruction A[0][0] = 1.0 modify A[0][0] but A[1][0] and
A[2][0] too.
Where is the problem?
I've got a double Matrix A and a vector b, initialized with
DoubleMatr A = new double*[3];
DoubleVect b = new double[3];
where DoubleMatr and DoubleVect are defined as
typedef double* DoubleVect;
typedef double** DoubleMatr;
then i pass the matrix and the vector to a function
void CreateSystemFromPolygon(Polygon *p, double *X, double *Y,
DoubleMatr A, DoubleVect b)
....
for ( int i = 0 ; i < 3 ; i++)
{
for (int j = 0 ; j < 3; j++)
{
A[j] = 0;
}
b = 0.0;
}
A[0][0] = 1.0;
A[1][1] = 1.0;
b[0] = X[0];
b[1] = Y[0];
....
at runtime i watch the values of A[0][0] A[0][1] etc..
I see that the istruction A[0][0] = 1.0 modify A[0][0] but A[1][0] and
A[2][0] too.
Where is the problem?