parent
a791ad6b0a
commit
d2ae4895c4
@ -188,6 +188,23 @@ namespace Exa
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ExaArray1D from this instance, respecting the given range.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// When <c>T</c> is a value type, data gets copied as values. When <c>T</c> is a reference type, the pointers
|
||||
/// to the original objects are copied. Thus, this factory method does not create a deep copy.
|
||||
///
|
||||
/// Performance: O(n)
|
||||
///
|
||||
/// The indices are inclusive.
|
||||
/// </remarks>
|
||||
/// <param name="indexFrom">The first source element which should be part of the new array.</param>
|
||||
/// <param name="indexTo">The last source element which should be part of the new array.</param>
|
||||
/// <returns>The new instance</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">Throws, when one or both of the indices are out of range.</exception>
|
||||
public ExaArray1D<T> this[ulong indexFrom, ulong indexTo] => ExaArray1D<T>.CreateFrom(this, indexFrom, indexTo);
|
||||
|
||||
/// <summary>
|
||||
/// Yields an enumerator across all elements.
|
||||
/// </summary>
|
||||
|
@ -539,13 +539,15 @@ namespace ExaArrayTests
|
||||
var exPerf = new ExaArray1D<byte>(Strategy.MAX_PERFORMANCE);
|
||||
exPerf.Extend(3 * MAX); // more than one chunk
|
||||
|
||||
var next = ExaArray1D<byte>.CreateFrom(exPerf, 0, exPerf.Length - 1);
|
||||
var next1 = ExaArray1D<byte>.CreateFrom(exPerf, 0, exPerf.Length - 1);
|
||||
var next2 = exPerf.Clone();
|
||||
var next3 = exPerf.Clone(0, exPerf.Length - 1);
|
||||
var next4 = exPerf[0, exPerf.Length - 1];
|
||||
|
||||
Assert.That(next.Length, Is.EqualTo(exPerf.Length));
|
||||
Assert.That(next1.Length, Is.EqualTo(exPerf.Length));
|
||||
Assert.That(next2.Length, Is.EqualTo(exPerf.Length));
|
||||
Assert.That(next3.Length, Is.EqualTo(exPerf.Length));
|
||||
Assert.That(next4.Length, Is.EqualTo(exPerf.Length));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
Loading…
Reference in New Issue
Block a user