https://github.com/muellan/containers
generic C++ containers; matrix, triangle matrix, crs sparse matrix, etc.
https://github.com/muellan/containers
c-plus-plus collections cpp cpp11 crs generic-containers header-only matrix matrix-library sparse-matrix
Last synced: 10 months ago
JSON representation
generic C++ containers; matrix, triangle matrix, crs sparse matrix, etc.
- Host: GitHub
- URL: https://github.com/muellan/containers
- Owner: muellan
- License: mit
- Created: 2013-11-08T13:06:20.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2018-03-23T14:01:18.000Z (about 8 years ago)
- Last Synced: 2025-04-19T19:50:55.319Z (12 months ago)
- Topics: c-plus-plus, collections, cpp, cpp11, crs, generic-containers, header-only, matrix, matrix-library, sparse-matrix
- Language: C++
- Homepage:
- Size: 226 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
AM containers
==========
Collection of generic containers for C++14.
- [Interfaces](#interfaces)
- [Requirements](#requirements)
## Quick Overview
#### [matrix\_array](#matrix-array)
2-dimensional statically sized array
#### [dynamic\_matrix](#dynamic-matrix)
2-dimensional dynamically sized array
#### [triangle\_matrix](#triangle-matrix)
lower triangle matrix that stores n\*(n-1) elements
Note that indexing excludes the diagonal:
N rows => row indices: 1 ... n, column indices: 0 ... n-1
#### [crs\_matrix](#crs-sparse-matrix)
compressed row storage (crs) sparse matrix
#### [compressed\_multiset](#compressed-multiset)
multiset-like class that stores only one representative (of an equivalence class) per key instead of multiple equivalent values per key
## Interfaces
Note that the descriptions provided here are informal and simplified for better readability.
### common
All containers have the following member functions:
```cpp
any_container::iterator any_container::begin();
any_container::const_iterator any_container::begin();
any_container::const_iterator any_container::cbegin();
any_container::iterator any_container::end();
any_container::const_iterator any_container::end();
any_container::const_iterator any_container::cend();
any_container::size_type any_container::size();
bool any_container::empty();
```
The following free standing function templates are defined for all containers:
```cpp
iterator begin(Container&);
const_iterator begin(const Container&);
const_iterator cbegin(const Container&);
iterator end(Container&);
const_iterator end(const Container&);
const_iterator cend(const Container&);
size_type size(const Container&);
bool empty(const Container&);
```
### triangle matrix
A lower triangle matrix that stores n\*(n-1) elements. The size can be changed at runtime and the container is allocator-aware.
Note that indexing excludes the diagonal: N rows => row indices: 1 ... n, column indices: 0 ... n-1.
One special mechanism provided is the iteration over all elements that share the same index either as row or as column index. Suppose you have the triangle matrix
```
| column
row | 0 1 2 3
----+------------------
1 | 10
2 | 20 21
3 | 30 31 32
4 | 40 41 42 43
```
then all elements that 'share index 2' are: 20, 21, 32, 42
This is especially useful if the matrix cells represent values of a pairwise symmetric relation, like e.g. forces between physical objects.
## Requirements
- requires C++14 conforming compiler
- tested with g++ 6.1.0, 7.2 and clang++ 5.0.1