Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
 /// <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);
 }
Exemple #4
0
 /// <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);
 }