# Struct extendr_api::prelude::diag::Diag

```
pub struct Diag<E>where
E: Entity,{
pub(crate) inner: Col<E>,
}
```

## Expand description

Diagonal matrix.

## Fields§

§`inner: Col<E>`

## Implementations§

§### impl<E> Diag<E>where
E: Entity,

### impl<E> Diag<E>where
E: Entity,

#### pub fn column_vector(&self) -> ColRef<'_, E>

#### pub fn column_vector(&self) -> ColRef<'_, E>

Returns the diagonal as a column vector view.

#### pub fn column_vector_mut(&mut self) -> ColMut<'_, E>

#### pub fn column_vector_mut(&mut self) -> ColMut<'_, E>

Returns the diagonal as a mutable column vector view.

#### pub fn into_column_vector(self) -> Col<E>

#### pub fn into_column_vector(self) -> Col<E>

Returns the diagonal as a column vector.

## Trait Implementations§

§### impl<LhsE, RhsE> AddAssign<&Diag<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> AddAssign<&Diag<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn add_assign(&mut self, other: &Diag<RhsE>)

#### fn add_assign(&mut self, other: &Diag<RhsE>)

Performs the

`+=`

operation. Read more§### impl<LhsE, RhsE> AddAssign<&Diag<RhsE>> for DiagMut<'_, LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> AddAssign<&Diag<RhsE>> for DiagMut<'_, LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn add_assign(&mut self, other: &Diag<RhsE>)

#### fn add_assign(&mut self, other: &Diag<RhsE>)

Performs the

`+=`

operation. Read more§### impl<LhsE, RhsE> AddAssign<&DiagMut<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> AddAssign<&DiagMut<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn add_assign(&mut self, other: &DiagMut<'_, RhsE>)

#### fn add_assign(&mut self, other: &DiagMut<'_, RhsE>)

Performs the

`+=`

operation. Read more§### impl<LhsE, RhsE> AddAssign<&DiagRef<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> AddAssign<&DiagRef<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn add_assign(&mut self, other: &DiagRef<'_, RhsE>)

#### fn add_assign(&mut self, other: &DiagRef<'_, RhsE>)

Performs the

`+=`

operation. Read more§### impl<LhsE, RhsE> AddAssign<Diag<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> AddAssign<Diag<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn add_assign(&mut self, other: Diag<RhsE>)

#### fn add_assign(&mut self, other: Diag<RhsE>)

Performs the

`+=`

operation. Read more§### impl<LhsE, RhsE> AddAssign<Diag<RhsE>> for DiagMut<'_, LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> AddAssign<Diag<RhsE>> for DiagMut<'_, LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn add_assign(&mut self, other: Diag<RhsE>)

#### fn add_assign(&mut self, other: Diag<RhsE>)

Performs the

`+=`

operation. Read more§### impl<LhsE, RhsE> AddAssign<DiagMut<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> AddAssign<DiagMut<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn add_assign(&mut self, other: DiagMut<'_, RhsE>)

#### fn add_assign(&mut self, other: DiagMut<'_, RhsE>)

Performs the

`+=`

operation. Read more§### impl<LhsE, RhsE> AddAssign<DiagRef<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> AddAssign<DiagRef<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn add_assign(&mut self, other: DiagRef<'_, RhsE>)

#### fn add_assign(&mut self, other: DiagRef<'_, RhsE>)

Performs the

`+=`

operation. Read more§### impl<LhsE, RhsE> DivAssign<Scale<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> DivAssign<Scale<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn div_assign(&mut self, other: Scale<RhsE>)

#### fn div_assign(&mut self, other: Scale<RhsE>)

Performs the

`/=`

operation. Read more§### impl<LhsE> DivAssign<f32> for Diag<LhsE>where
LhsE: ComplexField,

### impl<LhsE> DivAssign<f32> for Diag<LhsE>where
LhsE: ComplexField,

§#### fn div_assign(&mut self, other: f32)

#### fn div_assign(&mut self, other: f32)

Performs the

`/=`

operation. Read more§### impl<LhsE> DivAssign<f64> for Diag<LhsE>where
LhsE: ComplexField,

### impl<LhsE> DivAssign<f64> for Diag<LhsE>where
LhsE: ComplexField,

§#### fn div_assign(&mut self, other: f64)

#### fn div_assign(&mut self, other: f64)

Performs the

`/=`

operation. Read more§### impl<LhsE, RhsE> MulAssign<Scale<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> MulAssign<Scale<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn mul_assign(&mut self, other: Scale<RhsE>)

#### fn mul_assign(&mut self, other: Scale<RhsE>)

Performs the

`*=`

operation. Read more§### impl<LhsE> MulAssign<f32> for Diag<LhsE>where
LhsE: ComplexField,

### impl<LhsE> MulAssign<f32> for Diag<LhsE>where
LhsE: ComplexField,

§#### fn mul_assign(&mut self, other: f32)

#### fn mul_assign(&mut self, other: f32)

Performs the

`*=`

operation. Read more§### impl<LhsE> MulAssign<f64> for Diag<LhsE>where
LhsE: ComplexField,

### impl<LhsE> MulAssign<f64> for Diag<LhsE>where
LhsE: ComplexField,

§#### fn mul_assign(&mut self, other: f64)

#### fn mul_assign(&mut self, other: f64)

Performs the

`*=`

operation. Read more§### impl<LhsE, RhsE> SubAssign<&Diag<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> SubAssign<&Diag<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn sub_assign(&mut self, other: &Diag<RhsE>)

#### fn sub_assign(&mut self, other: &Diag<RhsE>)

Performs the

`-=`

operation. Read more§### impl<LhsE, RhsE> SubAssign<&Diag<RhsE>> for DiagMut<'_, LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> SubAssign<&Diag<RhsE>> for DiagMut<'_, LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn sub_assign(&mut self, other: &Diag<RhsE>)

#### fn sub_assign(&mut self, other: &Diag<RhsE>)

Performs the

`-=`

operation. Read more§### impl<LhsE, RhsE> SubAssign<&DiagMut<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> SubAssign<&DiagMut<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn sub_assign(&mut self, other: &DiagMut<'_, RhsE>)

#### fn sub_assign(&mut self, other: &DiagMut<'_, RhsE>)

Performs the

`-=`

operation. Read more§### impl<LhsE, RhsE> SubAssign<&DiagRef<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> SubAssign<&DiagRef<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn sub_assign(&mut self, other: &DiagRef<'_, RhsE>)

#### fn sub_assign(&mut self, other: &DiagRef<'_, RhsE>)

Performs the

`-=`

operation. Read more§### impl<LhsE, RhsE> SubAssign<Diag<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> SubAssign<Diag<RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn sub_assign(&mut self, other: Diag<RhsE>)

#### fn sub_assign(&mut self, other: Diag<RhsE>)

Performs the

`-=`

operation. Read more§### impl<LhsE, RhsE> SubAssign<Diag<RhsE>> for DiagMut<'_, LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> SubAssign<Diag<RhsE>> for DiagMut<'_, LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn sub_assign(&mut self, other: Diag<RhsE>)

#### fn sub_assign(&mut self, other: Diag<RhsE>)

Performs the

`-=`

operation. Read more§### impl<LhsE, RhsE> SubAssign<DiagMut<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> SubAssign<DiagMut<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn sub_assign(&mut self, other: DiagMut<'_, RhsE>)

#### fn sub_assign(&mut self, other: DiagMut<'_, RhsE>)

Performs the

`-=`

operation. Read more§### impl<LhsE, RhsE> SubAssign<DiagRef<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

### impl<LhsE, RhsE> SubAssign<DiagRef<'_, RhsE>> for Diag<LhsE>where
LhsE: ComplexField,
RhsE: Conjugate<Canonical = LhsE>,

§#### fn sub_assign(&mut self, other: DiagRef<'_, RhsE>)

#### fn sub_assign(&mut self, other: DiagRef<'_, RhsE>)

Performs the

`-=`

operation. Read more## Auto Trait Implementations§

### impl<E> Freeze for Diag<E>

### impl<E> RefUnwindSafe for Diag<E>where
<<E as Entity>::Group as ForCopyType>::FaerOfCopy<NonNull<<E as Entity>::Unit>>: RefUnwindSafe,
E: RefUnwindSafe,

### impl<E> Send for Diag<E>

### impl<E> Sync for Diag<E>

### impl<E> Unpin for Diag<E>

### impl<E> UnwindSafe for Diag<E>where
<<E as Entity>::Group as ForCopyType>::FaerOfCopy<NonNull<<E as Entity>::Unit>>: UnwindSafe,
E: UnwindSafe,

## Blanket Implementations§

source§### impl<T> BorrowMut<T> for Twhere
T: ?Sized,

### impl<T> BorrowMut<T> for Twhere
T: ?Sized,

source§#### fn borrow_mut(&mut self) -> &mut T

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

source§### impl<T> IntoEither for T

### impl<T> IntoEither for T

source§#### fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

#### fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts

`self`

into a `Left`

variant of `Either<Self, Self>`

if `into_left`

is `true`

.
Converts `self`

into a `Right`

variant of `Either<Self, Self>`

otherwise. Read moresource§#### fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ

#### fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ

Converts

`self`

into a `Left`

variant of `Either<Self, Self>`

if `into_left(&self)`

returns `true`

.
Converts `self`

into a `Right`

variant of `Either<Self, Self>`

otherwise. Read more