internal override bool Matches(NArrayStorage <T> other) { var managedOther = other as ManagedStorage <double>; if (managedOther == null) { return(false); } return(managedOther.Length == Length); }
internal override void CopySubMatrixTo(NArrayStorage <T> target, int sourceRowIndex, int targetRowIndex, int rowCount, int sourceColumnIndex, int targetColumnIndex, int columnCount) { var targetManaged = target as ManagedStorage <T>; for (int j = sourceColumnIndex, jj = targetColumnIndex; j < sourceColumnIndex + columnCount; j++, jj++) { System.Array.Copy(_storage, _storageStart + j * _stride + sourceRowIndex, targetManaged._storage, targetManaged._storageStart + jj * targetManaged._stride + targetRowIndex, rowCount); } }
private void CopySubRowTo(NArrayStorage <T> target, int rowIndex, int sourceColumnIndex, int targetColumnIndex, int columnCount) { AssertIsNotReferenceMatrix(this); var targetManaged = target as ManagedStorage <T>; AssertIsNotReferenceMatrix(targetManaged); // optimisation possible where this and target are both vectors if (this._stride == 1 && targetManaged._stride == 1) { System.Array.Copy(_storage, _storageStart + sourceColumnIndex, targetManaged._storage, targetManaged._storageStart + targetColumnIndex, columnCount); } else { for (int j = sourceColumnIndex, jj = targetColumnIndex; j < sourceColumnIndex + columnCount; j++, jj++) { targetManaged._storage[targetManaged._storageStart + targetColumnIndex * _stride] = _storage[_storageStart + sourceColumnIndex * _stride + rowIndex]; } } }
internal override void CopySubMatrixTo(NArrayStorage <T> target, int sourceRowIndex, int targetRowIndex, int rowCount, int sourceColumnIndex, int targetColumnIndex, int columnCount) { throw new NotImplementedException(); }
internal override bool Matches(NArrayStorage <T> other) { throw new NotImplementedException(); }