Private Attributes

Friends

class

DynamicSparsityPatternIterators::Accessor

Detailed Description

This class acts as an intermediate form of the SparsityPattern class. From the interface it mostly represents a SparsityPattern object that is kept compressed at all times. However, since the final sparsity pattern is not known while constructing it, keeping the pattern compressed at all times can only be achieved at the expense of either increased memory or run time consumption upon use. The main purpose of this class is to avoid some memory bottlenecks, so we chose to implement it memory conservative. The chosen data format is too unsuited to be used for actual matrices, though. It is therefore necessary to first copy the data of this object over to an object of type SparsityPattern before using it in actual matrices.

Another viewpoint is that this class does not need up front allocation of a certain amount of memory, but grows as necessary. An extensive description of sparsity patterns can be found in the documentation of the Sparsity patterns module.

This class is an example of the "dynamic" type of Sparsity patterns. It is used in most tutorial programs in one way or another.

Interface

Since this class is intended as an intermediate replacement of the SparsityPattern class, it has mostly the same interface, with small changes where necessary. In particular, the add() function, and the functions inquiring properties of the sparsity pattern are the same.

Copy constructor. This constructor is only allowed to be called if the sparsity structure to be copied is empty. This is so in order to prevent involuntary copies of objects for temporaries, which can use large amounts of computing time. However, copy constructors are needed if you want to place a DynamicSparsityPattern in a container, e.g. to write such statements like v.push_back (DynamicSparsityPattern());, with v a vector of DynamicSparsityPattern objects.

Initialize a rectangular sparsity pattern with m rows and n columns. The rowset restricts the storage to elements in rows of this set. Adding elements outside of this set has no effect. The default argument keeps all entries.

Reallocate memory and set up data structures for a new sparsity pattern with m rows and n columns. The rowset restricts the storage to elements in rows of this set. Adding elements outside of this set has no effect. The default argument keeps all entries.

Print the sparsity pattern in a format that gnuplot understands and which can be used to plot the sparsity pattern in a graphical way. The format consists of pairs i j of nonzero elements, each representing one entry, one per line of the output file. Indices are counted from zero on, as usual. Since sparsity patterns are printed in the same way as matrices are displayed, we print the negative of the column index, which means that the (0,0) element is in the top left rather than in the bottom left corner.

Print the sparsity pattern in gnuplot by setting the data style to dots or points and use the plot command.

Iterator starting at the first entry of the matrix. The resulting iterator can be used to walk over all nonzero entries of the sparsity pattern.

Note the discussion in the general documentation of this class about the order in which elements are accessed.

Note

If the sparsity pattern has been initialized with an IndexSet that denotes which rows to store, then iterators will simply skip over rows that are not stored. In other words, they will look like empty rows, but no exception will be generated when iterating over such rows.

Note that if the given row is empty, i.e. does not contain any nonzero entries, then the iterator returned by this function equals end(r). Note also that the iterator may not be dereferenceable in that case.

Note also the discussion in the general documentation of this class about the order in which elements are accessed.

Note

If the sparsity pattern has been initialized with an IndexSet that denotes which rows to store, then iterators will simply skip over rows that are not stored. In other words, they will look like empty rows, but no exception will be generated when iterating over such rows.

return whether this object stores only those entries that have been added explicitly, or if the sparsity pattern contains elements that have been added through other means (implicitly) while building it. For the current class, the result is always true.

This function mainly serves the purpose of describing the current class in cases where several kinds of sparsity patterns can be passed as template arguments.