/// <summary> /// Shift (offset) the elements in the array /// </summary> /// <param name="array"></param> /// <param name="offset"></param> static public void Shift(ComplexFloat[] array, int offset) { Debug.Assert(array != null); Debug.Assert(offset >= 0); Debug.Assert(offset < array.Length); if (offset == 0) { return; } int length = array.Length; ComplexFloat[] workspace = null; ComplexArray.LockWorkspaceF(length, ref workspace); for (int i = 0; i < length; i++) { workspace[(i + offset) % length] = array[i]; } for (int i = 0; i < length; i++) { array[i] = workspace[i]; } ComplexArray.UnlockWorkspaceF(ref workspace); }
/// <summary> /// Shift (offset) the elements in the array /// </summary> /// <param name="array"></param> /// <param name="offset"></param> public static void Shift(ComplexFloat[] array, int offset) { if (!(array != null)) { throw new ArgumentNullException(nameof(array)); } if (!(offset >= 0)) { throw new ArgumentOutOfRangeException(nameof(offset) + " should be >= 0"); } if (!(offset < array.Length)) { throw new ArgumentOutOfRangeException(nameof(offset) + " should be < array.Length"); } if (offset == 0) { return; } int length = array.Length; ComplexFloat[] workspace = null; ComplexArray.LockWorkspaceF(length, ref workspace); for (int i = 0; i < length; i++) { workspace[(i + offset) % length] = array[i]; } for (int i = 0; i < length; i++) { array[i] = workspace[i]; } ComplexArray.UnlockWorkspaceF(ref workspace); }
/// <summary> /// Divide each element in target array with corresponding element in rhs array /// </summary> /// <param name="target"></param> /// <param name="rhs"></param> public static void Divide(ComplexFloat[] target, ComplexFloat[] rhs) { ComplexArray.Divide(target, rhs, target); }
/// <summary> /// Multiply each element in target array with corresponding element in rhs array /// </summary> /// <param name="target"></param> /// <param name="rhs"></param> public static void Multiply(ComplexFloat[] target, ComplexFloat[] rhs) { ComplexArray.Multiply(target, rhs, target); }