public void Dispose() { if (_disposed) { return; } _disposed = true; if (_rowMajor) { foreach (var pair in _arrayMap) { var matrix = pair.Item1; var storage = DenseColumnMajorMatrixStorage <T> .OfRowMajorArray(matrix.RowCount, matrix.ColumnCount, pair.Item2); storage.CopyTo(matrix.Storage); } _arrayMap.Clear(); } for (int i = 0; i < _handles.Length; i++) { _handles[i].Free(); } }
protected static void MutateMatrixRowMajor(Matrix <float> matrix) { var la = matrix.ToRowMajorArray(); for (int row = 0; row < matrix.RowCount; row++) { for (int col = 0; col < matrix.ColumnCount; col++) { la[row * matrix.ColumnCount + col] += row - col; } } DenseColumnMajorMatrixStorage <float> .OfRowMajorArray(matrix.RowCount, matrix.ColumnCount, la).CopyTo(matrix.Storage); }