dune-community / dune-xt-common

Other
2 stars 3 forks source link

Extend Matrix/Vectorabstractions #59

Closed tobiasleibner closed 6 years ago

tobiasleibner commented 6 years ago

This extends the matrix/vector abstractions by add_to_entry, data (to get pointer to underlying memory) and enhanced create (create vector of same type with different size or scalar type, create matrix with a special pattern) methods. For the pattern creation to work, I had to move DefaultSparsityPattern to dune-xt-common.

ftalbrecht commented 6 years ago

We decided to postpone a merge until we have figured out the relations to the container in dune-xt-la and what to keep where.

tobiasleibner commented 6 years ago

As discussed with @ftalbrecht , the SparsityPatternType for the MatrixAbstraction<...>::create method is now a template argument. The SparsityPatternDefault is moved back to dune-xt-la and only an empty struct FullPattern is kept here to serve as a default for the template argument. The MatrixAbstraction now has a single create method

template <size_t ROWS = static_rows, 
          size_t COLS = static_cols, 
          class SparsityPatternType = FullPattern>
static inline MatrixType create(const size_t rows, 
                                const size_t cols,
                                const ScalarType& val = ScalarType(0),
                                const SparsityPatternType& pattern = SparsityPatternType());

I added the rows and cols template parameters as this greatly simplifies creation of stuff like transposed matrices for matrices with static size.

I also changed the VectorAbstraction accordingly so it only has a single create method now.

In addition to the create method changes, the MatrixAbstraction now has an add_to_entry method, an enum parameter to describe the storage layout and a data method to get a pointer to the underlying data (only meaningful for matrices with contiguous storage layout).

Apart from the abstraction changes, this pull request includes some new lapack wrappers and a lot of warning fixes.

ftalbrecht commented 6 years ago

LGTM!