# cppmat¶

Note

This library is free to use under the MIT license. Any additions are very much appreciated, in terms of suggested functionality, code, documentation, testimonials, word of mouth advertisement, …. Bugs or feature requests can be filed on GitHub. As always, the code comes with no guarantee. None of the developers can be held responsible for possible mistakes.

Tip

This document should be considered as a quick-start guide. A lot effort has been spent on the readability of the code itself (in particular the `*.h`

files should be instructive). One is highly encouraged to answer more advanced questions that arise from this guide directly using the code. Download buttons to the relevant files are included throughout this reader.

This header-only module provides C++ classes and several accompanying methods to work with n-d arrays and/or tensors. It’s usage, programmatically and from a compilation perspective, is really simple. One just has to `#include <cppmat/cppmat.h>`

and tell your compiler where cppmat is located (and to use the C++14 or younger standard). Really, that’s it!

## Overview¶

The following dynamically sized classes can be used.

Class |
Description |
---|---|

cppmat::array | array of arbitrary rank |

cppmat::matrix | matrix (array of rank 2) |

cppmat::vector | vector (array of rank 1) |

cppmat::symmetric::matrix | symmetric, square, matrix |

cppmat::diagonal::matrix | diagonal, square, matrix |

cppmat::cartesian::tensor4 | 4th-order tensor |

cppmat::cartesian::tensor2 | 2nd-order tensor |

cppmat::cartesian::tensor2s | 2nd-order symmetric tensor |

cppmat::cartesian::tensor2d | 2nd-order diagonal tensor |

cppmat::cartesian::vector | 1st-order tensor (a.k.a. vector) |

Each of these classes has a fixed size equivalent (that is usually more efficient):

Each fixed size class has an equivalent which can view a `const`

-pointer (with limited functionality):

## Example¶

```
#include <cppmat/cppmat.h>
int main()
{
cppmat::array<double> A({10,10,10});
A(0,0,0) = ...
...
return 0;
}
```