On Wed, Oct 3, 2012 at 3:37 PM, Antonio Cervone <ant.cervone@...> wrote:
> hi all,
> looking at Sparsematrix.hpp i saw this comment (line237)
>
> /**
> * Return the value of the entry
> * \p (i,j). This may be an
> * expensive operation and you
> * should always take care where
> * to call this function. In
> * order to avoid abuse, this
> * function throws an exception
> * if the required element does
> * not exist in the matrix.
> *
> * In case you want a function
> * that returns zero instead (for
> * entries that are not in the
> * sparsity pattern of the
> * matrix), use the \p el
> * function.
> */
> virtual T operator () (const unsigned int i,
> const unsigned int j) const = 0;
>
> that refers to a an el() metho that i can't find... has it been removed?
> it seems that now the operator()() methods behaves like that el()
> method that has disappeared, while there is no functionality that
> returns the (i,j) element only if the position is in the sparsity
> pattern.
> the comment seems to be outdated.
I agree, I'll remove the comment.
The history of the petsc_matrix.h file (PetscMatrix is a concrete
subclass of SparseMatrix, and would probably have implemented el() if
it ever existed) goes back to r509, at which point the include
directory structure was reorganized, and I don't see any
implementation of an el() method in that version either.
> by the way, the reason why i came up to this is bacause i was trying
> to print out a sparse matrix having the complete graph on output, even
> if the value is zero.
> is there a better way than using the operator()() method to travel
> lines getting just the positions in the sparsity graph?
> thanks
If you just want to print out the matrix with zeroes, you can call
print_matlab() and read the resulting sparse matrix into
Matlab/Octave, then convert it to a dense matrix...

John
