Esempio n. 1
0
        /// <summary>
        /// Does a point wise power of two arrays <c>z = x ^ y</c>. This can be used
        /// to raise elements of vectors or matrices to the powers of another vector or matrix.
        /// </summary>
        /// <param name="x">The array x.</param>
        /// <param name="y">The array y.</param>
        /// <param name="result">The result of the point wise power.</param>
        /// <remarks>There is no equivalent BLAS routine, but many libraries
        /// provide optimized (parallel and/or vectorized) versions of this
        /// routine.</remarks>
        public override void PointWisePowerArrays(double[] x, double[] y, double[] result)
        {
            if (_vectorFunctionsMajor != 0 || _vectorFunctionsMinor < 1)
            {
                base.PointWisePowerArrays(x, y, result);
            }

            if (y == null)
            {
                throw new ArgumentNullException(nameof(y));
            }

            if (x == null)
            {
                throw new ArgumentNullException(nameof(x));
            }

            if (x.Length != y.Length)
            {
                throw new ArgumentException("The array arguments must have the same length.");
            }

            if (x.Length != result.Length)
            {
                throw new ArgumentException("The array arguments must have the same length.");
            }

            SafeNativeMethods.d_vector_power(x.Length, x, y, result);
        }
Esempio n. 2
0
        /// <summary>
        /// Does a point wise power of two arrays <c>z = x ^ y</c>. This can be used
        /// to raise elements of vectors or matrices to the powers of another vector or matrix.
        /// </summary>
        /// <param name="x">The array x.</param>
        /// <param name="y">The array y.</param>
        /// <param name="result">The result of the point wise power.</param>
        /// <remarks>There is no equivalent BLAS routine, but many libraries
        /// provide optimized (parallel and/or vectorized) versions of this
        /// routine.</remarks>
        public override void PointWisePowerArrays(double[] x, double[] y, double[] result)
        {
            if (_vectorFunctionsMajor != 0 || _vectorFunctionsMinor < 1)
            {
                base.PointWisePowerArrays(x, y, result);
            }

            if (y == null)
            {
                throw new ArgumentNullException("y");
            }

            if (x == null)
            {
                throw new ArgumentNullException("x");
            }

            if (x.Length != y.Length)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength);
            }

            if (x.Length != result.Length)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength);
            }

            SafeNativeMethods.d_vector_power(x.Length, x, y, result);
        }