bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] gsl_eigen_nonsymm_workspace


From: Siji P George
Subject: [Bug-gsl] gsl_eigen_nonsymm_workspace
Date: Wed, 22 Jul 2009 17:10:32 +0530 (IST)
User-agent: SquirrelMail/1.4.13

Hi,

We are using gsl in our program and the version installed is gsl-1.8.exe.

it is giving compilation error ,which is given below:

        : error C2065: 'gsl_eigen_nonsymm_workspace' : undeclared identifier
        : error C2065: 'workspace' : undeclared identifier
        : error C3861: 'gsl_eigen_nonsymm_alloc': identifier not found
        : error C3861: 'gsl_eigen_nonsymm': identifier not found
        : error C3861: 'gsl_eigen_nonsymm_free': identifier not found

i have included the following headers:

        #include <gsl/gsl_errno.h>
        #include <gsl/gsl_vector.h>
        #include <gsl/gsl_matrix.h>
        #include <gsl/gsl_blas.h>
        #include <gsl/gsl_linalg.h>
        #include <gsl/gsl_multiroots.h>
        #include <gsl/gsl_sort.h>
        #include <gsl/gsl_sort_vector.h>
        #include <gsl/gsl_eigen.h>

and the piece of code is also given below:
-------------------------------------------------------------------------------
void SteadyState::classifyState( const double* T )
{
        unsigned int nConsv = nVarMols_ - rank_;
        gsl_matrix* J = gsl_matrix_calloc ( nVarMols_, nVarMols_ );
        // double* yprime = new double[ nVarMols_ ];
        // vector< double > yprime( nVarMols_, 0.0 );
        // Generate an approximation to the Jacobean by generating small
        // increments to each of the molecules in the steady state, one
        // at a time, and putting the resultant rate vector into a column
        // of the J matrix.
        // This needs a bit of heuristic to decide what is a 'small' increment.
        // Use the totals for this.
        double tot = 0.0;
        for ( unsigned int i = 0; i < nConsv; ++i ) {
                tot += T[i];
        }
        tot *= DELTA;

        // Fill up Jacobian
        for ( unsigned int i = 0; i < nVarMols_; ++i ) {
                double orig = s_->S()[i];
                s_->S()[i] = orig + tot;
                s_->updateV();
                s_->S()[i] = orig;
        //      yprime.assign( nVarMols_, 0.0 )
        //      vector< double >::iterator y = yprime.begin();

                // Compute the rates for each mol.
                for ( unsigned int j = 0; j < nVarMols_; ++j ) {
        //              *y++ = N_.computeRowRate( j, s_->velocity() );
                        double temp = s_->N().computeRowRate( j, s_->velocity() 
);
                        gsl_matrix_set( J, i, j, temp );
                }
        }

        // Jacobian is now ready. Find eigenvalues.
        gsl_vector_complex* vec = gsl_vector_complex_alloc( nVarMols_ );
        gsl_eigen_nonsymm_workspace* workspace =
                gsl_eigen_nonsymm_alloc( nVarMols_ );
        int status = gsl_eigen_nonsymm( J, vec, workspace );
        if ( status != GSL_SUCCESS ) {
                cout << "Warning: failed to find eigenvalues. Status = " <<
                        status << endl;
                solutionStatus_ = 2; // Steady state OK, eig classification 
failed
        } else { // Eigenvalues are ready. Classify state.
                nNegEigenvalues_ = 0;
                nPosEigenvalues_ = 0;
                for ( unsigned int i = 0; i < nVarMols_; ++i ) {
                        gsl_complex z = gsl_vector_complex_get( vec, i );
                        double r = GSL_REAL( z );
                        nNegEigenvalues_ += ( r < -EPSILON );
                        nPosEigenvalues_ += ( r > EPSILON );
                }
                if ( nNegEigenvalues_ == rank_ )
                        stateType_ = 0; // Stable
                else if ( nPosEigenvalues_ == rank_ )
                        stateType_ = 1; // Unstable
                else  if (nNegEigenvalues_ == rank_ - 1)
                        stateType_ = 2; // Saddle
                else
                        stateType_ = 3; // Other
        }

        gsl_vector_complex_free( vec );
        gsl_matrix_free ( J );
        gsl_eigen_nonsymm_free( workspace );
}
----------------------------------------------------------------------------------

the same program works fine on linux. no idea what is wrong on windows?
plz help.


thanks & regards,
Siji





reply via email to

[Prev in Thread] Current Thread [Next in Thread]