Hello

I'm using Octave 3.0.1, configured for "i686-pc-msdosmsvc".   I've linked the 
libraries into my own program using VS 2005 SP1.

I am trying to copy a TNT::Sparse_Matrix<double> into an Octave SparseMatrix 
object using the following code:

void TNTOctaveInterface::exportSparseMatrix(TNT::Sparse_Matrix<double> 
&sparseTNTMatrix, SparseMatrix *sparseOctaveMatrix)
{
                try
                {
                                for (int i = 0; i < sparseTNTMatrix.num_rows(); 
i++)
                                {
                                                for (int j = 0; j < 
sparseTNTMatrix.num_cols(); j++)
                                                {
                                                                
sparseOctaveMatrix->elem(j,i) = (sparseTNTMatrix)[i][j];
                                                }
                                }

                                return;
                }
                catch (...)
...

My program crashes without being able even to enter the above function.  I 
can't catch an exception, but I receive the error message

fatal: Sparse::SparseRep::elem (octave_idx_type, octave_idx_type): sparse 
matrix filled

I found one online comment suggesting this was an array subscript out-of-bounds 
issue, but I'm not even able to debug inside this function.  I can stop at a 
breakpoint in my code just before the call:

                octaveInterface->exportSparseMatrix(*sparseTNTMatrix, 
sparseOctaveMatrix);

The state of my TNT matrix at that location is:

-                               sparseTNTMatrix  0x05be6718 {S_=[...]() 
num_rows_=12 num_cols_=12 ...}         TNT::Sparse_Matrix<double> *
                                S_            [...]()        
std::vector<TNT::Sparse_Vector<double>,std::allocator<TNT::Sparse_Vector<double>
 > >
                                num_rows_           12           int
                                num_cols_            12           int
                                num_nonzeros_   58           int
                                internal_state_     1              int

Does anyone have an idea what might be wrong here?

Thanks in advance

Tom

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to