* the matrix is going to be
* distributed among different
* processors. This function works in
- * parallel, too, but it is
+ * %parallel, too, but it is
* recommended to manually specify
* the %parallel partioning of the
* matrix using an Epetra_Map. When
- * run in parallel, it is currently
+ * run in %parallel, it is currently
* necessary that each processor
* holds the sparsity_pattern
* structure because each processor
* matrix-vector products. This is a
* collective operation, i.e., it
* needs to be run on all processors
- * when used in parallel.
+ * when used in %parallel.
*
* See @ref GlossCompress "Compressing distributed objects"
* for more information.
* columns. This interface is meant
* to be used for generating
* rectangular matrices, where one
- * map describes the parallel
+ * map describes the %parallel
* partitioning of the dofs
* associated with the matrix rows
* and the other one the partitioning
* columns. This interface is meant
* to be used for generating
* rectangular matrices, where one
- * map specifies the parallel
+ * map specifies the %parallel
* distribution of degrees of freedom
* associated with matrix rows and
* the second one specifies the
* rectangular matrix) are the natural
* way to initialize the matrix size,
* its distribution among the MPI
- * processes (if run in parallel) as
+ * processes (if run in %parallel) as
* well as the locatoin of non-zero
* elements. Trilinos stores the
* sparsity pattern internally, so it
* matrix argument, this function
* takes a %parallel partitioning
* specified by the user instead of
- * internally generating one.
+ * internally generating it.
*
* The optional parameter
* <tt>copy_values</tt> decides
* columns. This interface is meant
* to be used for generating
* rectangular matrices, where one
- * map specifies the parallel
+ * map specifies the %parallel
* distribution of degrees of freedom
* associated with matrix rows and
* the second one specifies the
* natural way to initialize the
* matrix size, its distribution
* among the MPI processes (if run in
- * parallel) as well as the locatoin
+ * %parallel) as well as the locatoin
* of non-zero elements. Trilinos
* stores the sparsity pattern
* internally, so it won't be needed
* matrix argument, this function
* takes a %parallel partitioning
* specified by the user instead of
- * internally generating one.
+ * internally generating it.
*
* The optional parameter
* <tt>copy_values</tt> decides
*/
unsigned int row_length (const unsigned int row) const;
- /**
- * Test whether a matrix is
- * symmetric. Default
- * tolerance is zero. TODO:
- * Not implemented.
- */
- bool is_symmetric (const double tol = 0.0) const;
-
- /**
- * Test whether a matrix is
- * Hermitian, i.e. it is the
- * complex conjugate of its
- * transpose. TODO: Not
- * implemented.
- */
- bool is_hermitian () const;
-
/**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object. Currently not
- * implemented for this class.
+ * Determine an estimate for the memory
+ * consumption (in bytes) of this
+ * object. Note that only the memory
+ * reserved on the current processor is
+ * returned in case this is called in
+ * an MPI-based program.
*/
unsigned int memory_consumption () const;
SparseMatrix & operator /= (const TrilinosScalar factor);
/**
- * Copy the given matrix to this
- * one.
- *
- * The function returns a
- * reference to <tt>*this</tt>.
+ * Copy the given (Trilinos) matrix
+ * (sparsity pattern and entries).
*/
- SparseMatrix &
- copy_from (const SparseMatrix &source);
+ void copy_from (const SparseMatrix &source);
/**
* Add <tt>matrix</tt> scaled by
- SparseMatrix &
+ void
SparseMatrix::copy_from (const SparseMatrix &m)
{
- column_space_map = std::auto_ptr<Epetra_Map>
- (new Epetra_Map (m.domain_partitioner()));
// check whether we need to update the
// partitioner or can just copy the data:
if (local_range() == m.local_range())
*matrix = *m.matrix;
else
- matrix = std::auto_ptr<Epetra_FECrsMatrix>
- (new Epetra_FECrsMatrix(*m.matrix));
+ {
+ column_space_map = std::auto_ptr<Epetra_Map>
+ (new Epetra_Map (m.domain_partitioner()));
+ matrix = std::auto_ptr<Epetra_FECrsMatrix>
+ (new Epetra_FECrsMatrix(*m.matrix));
+ }
+
compress();
- return *this;
}
- bool
- SparseMatrix::is_symmetric (const double tolerance) const
- {
- (void)tolerance;
-
- Assert (false, ExcNotImplemented());
-
- return false;
- }
-
-
-
- bool
- SparseMatrix::is_hermitian () const
- {
- Assert (false, ExcNotImplemented());
- return false;
- }
-
-
-
void
SparseMatrix::write_ascii ()
{
+ unsigned int
+ SparseMatrix::memory_consumption () const
+ {
+ unsigned int static_memory = sizeof(this) + sizeof (*matrix)
+ + sizeof(*matrix->Graph().DataPtr());
+ return ((sizeof(TrilinosScalar)+sizeof(int))*matrix->NumMyNonzeros() +
+ sizeof(int)*local_size() +
+ static_memory);
+ }
+
+
+
// explicit instantiations
//