---
name: "diag"
section: "4rheolef"
platform: "linux"
package: "librheolef-dev"
version: "7.0-2+b1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/diag"
---

# diag(4rheolef)

get diagonal part of a matrix

## NAME

**diag** - get diagonal part of a matrix

## DESCRIPTION

This function get the diagonal part of a matrix.

```
        csr<Float> a;
        dia<Float> d = diag(a);

```

## TODO

Build a csr matrix from a diagonal one or from a vector:

```
        dia<Float> d;
        csr<Float> a = diag(d);
        vec<Float> u;
        csr<Float> b = diag(u);

```

## IMPLEMENTATION

```
template<class T, class M>
dia<T,M> diag (const csr<T,M>& a)

```

## COPYRIGHT

Copyright (C) 2000-2018 Pierre Saramito \<Pierre.Saramito@imag.fr\> GPLv3+: GNU GPL version 3 or later \<http://gnu.org/licenses/gpl.html\>. This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.
