Esempio n. 1
0
        /// <summary>
        /// negate elements of array - if applicable
        /// </summary>
        /// <param name="in1">input array</param>
        /// <returns>new solid arrray having the elements of in1 negated</returns>
        public static ILArray <BaseT> operator -(ILArray <BaseT> in1)
        {
            if (object.Equals(in1, null))
            {
                throw new ILArgumentException("operator -(): parameter must not be null!");
            }
            BaseT[]         retArr = ILMemoryPool.Pool.New <BaseT>(in1.Dimensions.NumberOfElements);
            ILArray <BaseT> ret    = new ILArray <BaseT>(retArr, in1.Dimensions);

            if (false)
            {
            }
            else if (in1 is /*!HC:inCls1*/ ILArray <double> )
            {
                ILMath.invert(in1 as ILArray <double>, ret as ILArray <double>);
            }
            else if (in1 is /*!HC:inCls1*/ ILArray <complex> )
            {
                ILMath.invert(in1 as ILArray <complex>, ret as ILArray <complex>);
            }
            else if (in1 is /*!HC:inCls1*/ ILArray <byte> )
            {
                ILMath.invert(in1 as ILArray <byte>, ret as ILArray <byte>);
            }
            else
            {
                throw new ILArgumentException("unary - operator not defined for arrays of type '" + in1.GetType().Name + "'!");
            }
            return(ret);
        }