Matrix<T>.Protect Method
Returns a shallow protected copy of the matrix with the requested mutability.
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.8.0
C#
A reference to the protected matrix. If this matrix's recorded mutability is exactly Immutable, returns this instance. A live view may require another protected result even when its elements cannot be written through that view.
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.8.0
public Matrix<T> Protect(
ArrayMutability mutability = ArrayMutability.Immutable
)Parameters
- mutability ArrayMutability (Optional)
- The desired degree of mutability of the result.
Return Value
Matrix<T>A reference to the protected matrix. If this matrix's recorded mutability is exactly Immutable, returns this instance. A live view may require another protected result even when its elements cannot be written through that view.
Remarks
The result initially shares element storage with this matrix. Copy-on-write bookkeeping prevents a later write through this matrix from changing an immutable protected result.
If this matrix is itself a live view of writable storage, an immutable request produces a read-only live view rather than an immutable snapshot.