/// <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="other">The instance from which the new instance is to be created.</param> /// <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 static ExaArray1D <T> Clone <T>(this ExaArray1D <T> other, ulong indexFrom, ulong indexTo) => ExaArray1D <T> .CreateFrom(other, indexFrom, indexTo);
/// <summary> /// Creates a new ExaArray1D from this enumerable sequence of items. The number of items in the sequence is __unknown__. /// </summary> /// <remarks> /// This method is slow because the number of items in this sequence is unknown. When you know the /// number of items, you should use another factory method, where the number of items can be provided. /// /// Performance: O(n) /// </remarks> /// <param name="sequence">The sequence to consume in order to create the array.</param> /// <param name="strategy">The optional optimization strategy.</param> /// <returns>The desired instance</returns> public static ExaArray1D <T> AsExaArray <T>(this IEnumerable <T> sequence, Strategy strategy = Strategy.MAX_PERFORMANCE) => ExaArray1D <T> .CreateFrom(sequence, strategy);
/// <summary> /// Creates a new ExaArray1D from this instance. /// </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) /// </remarks> /// <param name="other">The instance from which the new instance is to be created.</param> /// <returns>The new instance</returns> public static ExaArray1D <T> Clone <T>(this ExaArray1D <T> other) => ExaArray1D <T> .CreateFrom(other);
/// <summary> /// Creates a new ExaArray1D from this collection of items. /// </summary> /// <remarks> /// Performance: O(n) /// </remarks> /// <param name="collection">The collection to use</param> /// <param name="strategy">The optional optimization strategy.</param> /// <returns>The desired instance</returns> public static ExaArray1D <T> AsExaArray <T>(this ICollection <T> collection, Strategy strategy = Strategy.MAX_PERFORMANCE) => ExaArray1D <T> .CreateFrom(collection, strategy);