Argument

We found 10 examples in language CSharp for this search. You will see 52 fragments of code.
using DG.Tools;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Metadata;
using Microsoft.Xrm.Sdk.Query;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.ServiceModel;
using System.Text.RegularExpressions;

namespace DG.Tools.XrmMockup.Metadata
{
    internal static class Arguments {

        public static ArgumentDescription Url = new ArgumentDescription() {
            Name = "url",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription Username = new ArgumentDescription() {
            Name = "username",
            Abbreviations = new string[] { "usr", "u" }
        };

        public static ArgumentDescription Password = new ArgumentDescription() {
            Name = "password",
            Abbreviations = new string[] { "pwd", "p" }
        };

        public static ArgumentDescription Domain = new ArgumentDescription() {
            Name = "domain",
            Abbreviations = new string[] { "dmn", "d" }
        };

        public static ArgumentDescription AuthProvider = new ArgumentDescription() {
            Name = "ap",
            Abbreviations = new string[] { "authenticationprovider", "provider" }
        };

        public static ArgumentDescription OutDir = new ArgumentDescription() {
            Name = "outDir",
            Abbreviations = new string[] { "out", "o" }
        };


        public static ArgumentDescription Entities = new ArgumentDescription() {
            Name = "entities",
            Abbreviations = new string[] { "es" }
        };

        public static ArgumentDescription Solutions = new ArgumentDescription() {
            Name = "solutions",
            Abbreviations = new string[] { "ss" }
        };

        public static ArgumentDescription UnitTestProjectPath = new ArgumentDescription() {
            Name = "projectPath",
            Abbreviations = new string[] { "pp" }
        };

        public static ArgumentDescription fetchFromAssemblies = new ArgumentDescription()
        {
            Name = "fetchFromAssemblies",
            Abbreviations = new string[] { "fa" }
        };

        public static ArgumentDescription Method = new ArgumentDescription()
        {
            Name = "method",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription ClientId = new ArgumentDescription()
        {
            Name = "mfaAppId",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription ReturnUrl = new ArgumentDescription()
        {
            Name = "mfaReturnUrl",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription ClientSecret = new ArgumentDescription()
        {
            Name = "mfaClientSecret",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription ConnectionString = new ArgumentDescription()
        {
            Name = "connectionString",
            Abbreviations = new string[] { }
        };

        public static ArgumentDescription[] ArgList = new ArgumentDescription[] {
            Url,
            Username,
            Password,
            Domain,
            AuthProvider,
            Entities,
            Solutions,
            OutDir,
            UnitTestProjectPath,
            fetchFromAssemblies,
            Method,
            ClientId,
            ReturnUrl,
            ClientSecret,
            ConnectionString
        };
    }
}

			public static void IsNotNull(object argument, string argumentName, string message = "")
			{
				if (string.IsNullOrEmpty(message))
				{
					message = string.Format("[{0}] must not be null or empty", argumentName);
				}

				if (argument == null)
				{
					throw new ArgumentNullException(argumentName, message);
				}
			}

			public static void IsStrNotNullOrEmpty(string argument, string argumentName, string message = null)
			{
				if (string.IsNullOrEmpty(argument))
				{
					if (message == null)
					{
						message = string.Format("[{0}] must not be null or empty", argumentName);
					}
					throw new ArgumentException(message, argumentName);
				}
			}

			public static void IsNotNegative(int argument, string argumentName)
			{
				if (argument < 0)
				{
					throw new ArgumentOutOfRangeException(argumentName, argumentName + " must not be negative.");
				}
			}


        [DebuggerStepThrough]
        public static void ArgumentNotEmpty(Func<string> arg)
        {
			if (arg().IsEmpty())
			{
				string argName = GetParamName(arg);
				throw Error.Argument(argName, "String parameter '{0}' cannot be null or all whitespace.", argName);
			}
        }

        [DebuggerStepThrough]
        public static void ArgumentNotEmpty(Func<Guid> arg)
        {
            if (arg() == Guid.Empty)
            {
                string argName = GetParamName(arg);
                throw Error.Argument(argName, "Argument '{0}' cannot be an empty guid.", argName);
            }
        }

        [DebuggerStepThrough]
        public static void ArgumentNotEmpty(string arg, string argName)
        {
            if (arg.IsEmpty())
                throw Error.Argument(argName, "String parameter '{0}' cannot be null or all whitespace.", argName);
        }

        [DebuggerStepThrough]
        public static void ArgumentNotEmpty<T>(ICollection<T> arg, string argName)
        {
			if (arg == null || !arg.Any())
                throw Error.Argument(argName, "Collection cannot be null and must have at least one item.");
        }
        [DebuggerStepThrough]
        public static void ArgumentNotNullOrEmpty<T>(ICollection<T> arg, string argName)
        {
			if (arg != null && !arg.Any())
                throw Error.Argument(argName, "Collection cannot be null and must have at least one item.");
        }

        [DebuggerStepThrough]
        public static void ArgumentNotEmpty(Guid arg, string argName)
        {
            if (arg == Guid.Empty)
                throw Error.Argument(argName, "Argument '{0}' cannot be an empty guid.", argName);
        }


        /// <summary>
        /// Formats the specified resource string using <see cref="M:CultureInfo.CurrentCulture"/>.
        /// </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An object array that contains zero or more objects to format.</param>
        /// <returns>The formatted string.</returns>
        internal static string Format(string format, params object[] args)
        {
            return String.Format(CultureInfo.CurrentCulture, format, args);
        }

        /// <summary>
        /// Creates an <see cref="ArgumentException"/> with the provided properties.
        /// </summary>
        /// <param name="messageFormat">A composite format string explaining the reason for the exception.</param>
        /// <param name="messageArgs">An object array that contains zero or more objects to format.</param>
        /// <returns>The logged <see cref="Exception"/>.</returns>
        internal static ArgumentException Argument(string messageFormat, params object[] messageArgs)
        {
            return new ArgumentException(Error.Format(messageFormat, messageArgs));
        }

        /// <summary>
        /// Creates an <see cref="ArgumentException"/> with the provided properties.
        /// </summary>
        /// <param name="parameterName">The name of the parameter that caused the current exception.</param>
        /// <param name="messageFormat">A composite format string explaining the reason for the exception.</param>
        /// <param name="messageArgs">An object array that contains zero or more objects to format.</param>
        /// <returns>The logged <see cref="Exception"/>.</returns>
        internal static ArgumentException Argument(string parameterName, string messageFormat, params object[] messageArgs)
        {
            return new ArgumentException(Error.Format(messageFormat, messageArgs), parameterName);
        }

        /// <summary>
        /// Creates an <see cref="ArgumentException"/> with a message saying that the argument must be an "http" or "https" URI.
        /// </summary>
        /// <param name="parameterName">The name of the parameter that caused the current exception.</param>
        /// <param name="actualValue">The value of the argument that causes this exception.</param>
        /// <returns>The logged <see cref="Exception"/>.</returns>
        internal static ArgumentException ArgumentUriNotHttpOrHttpsScheme(string parameterName, Uri actualValue)
        {
            return new ArgumentException(Error.Format(CommonWebApiResources.ArgumentInvalidHttpUriScheme, actualValue, HttpScheme, HttpsScheme), parameterName);
        }

        /// <summary>
        /// Creates an <see cref="ArgumentException"/> with a message saying that the argument must be an absolute URI.
        /// </summary>
        /// <param name="parameterName">The name of the parameter that caused the current exception.</param>
        /// <param name="actualValue">The value of the argument that causes this exception.</param>
        /// <returns>The logged <see cref="Exception"/>.</returns>
        internal static ArgumentException ArgumentUriNotAbsolute(string parameterName, Uri actualValue)
        {
            return new ArgumentException(Error.Format(CommonWebApiResources.ArgumentInvalidAbsoluteUri, actualValue), parameterName);
        }

        /// <summary>
        /// Creates an <see cref="ArgumentException"/> with a message saying that the argument must be an absolute URI 
        /// without a query or fragment identifier and then logs it with <see cref="F:TraceLevel.Error"/>.
        /// </summary>
        /// <param name="parameterName">The name of the parameter that caused the current exception.</param>
        /// <param name="actualValue">The value of the argument that causes this exception.</param>
        /// <returns>The logged <see cref="Exception"/>.</returns>
        internal static ArgumentException ArgumentUriHasQueryOrFragment(string parameterName, Uri actualValue)
        {
            return new ArgumentException(Error.Format(CommonWebApiResources.ArgumentUriHasQueryOrFragment, actualValue), parameterName);
        }


        /// <summary>
        /// Formats the specified resource string using <see cref="M:CultureInfo.CurrentCulture"/>.
        /// </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An object array that contains zero or more objects to format.</param>
        /// <returns>The formatted string.</returns>
        internal static string Format(string format, params object[] args)
        {
            return String.Format(CultureInfo.CurrentCulture, format, args);
        }

        /// <summary>
        /// Creates an <see cref="ArgumentException"/> with the provided properties.
        /// </summary>
        /// <param name="messageFormat">A composite format string explaining the reason for the exception.</param>
        /// <param name="messageArgs">An object array that contains zero or more objects to format.</param>
        /// <returns>The logged <see cref="Exception"/>.</returns>
        internal static ArgumentException Argument(string messageFormat, params object[] messageArgs)
        {
            return new ArgumentException(Error.Format(messageFormat, messageArgs));
        }

        /// <summary>
        /// Creates an <see cref="ArgumentException"/> with the provided properties.
        /// </summary>
        /// <param name="parameterName">The name of the parameter that caused the current exception.</param>
        /// <param name="messageFormat">A composite format string explaining the reason for the exception.</param>
        /// <param name="messageArgs">An object array that contains zero or more objects to format.</param>
        /// <returns>The logged <see cref="Exception"/>.</returns>
        internal static ArgumentException Argument(string parameterName, string messageFormat, params object[] messageArgs)
        {
            return new ArgumentException(Error.Format(messageFormat, messageArgs), parameterName);
        }

        /// <summary>
        /// Creates an <see cref="ArgumentException"/> with a message saying that the argument must be an "http" or "https" URI.
        /// </summary>
        /// <param name="parameterName">The name of the parameter that caused the current exception.</param>
        /// <param name="actualValue">The value of the argument that causes this exception.</param>
        /// <returns>The logged <see cref="Exception"/>.</returns>
        internal static ArgumentException ArgumentUriNotHttpOrHttpsScheme(string parameterName, Uri actualValue)
        {
            return new ArgumentException(Error.Format(CommonWebApiResources.ArgumentInvalidHttpUriScheme, actualValue, HttpScheme, HttpsScheme), parameterName);
        }

        /// <summary>
        /// Creates an <see cref="ArgumentException"/> with a message saying that the argument must be an absolute URI.
        /// </summary>
        /// <param name="parameterName">The name of the parameter that caused the current exception.</param>
        /// <param name="actualValue">The value of the argument that causes this exception.</param>
        /// <returns>The logged <see cref="Exception"/>.</returns>
        internal static ArgumentException ArgumentUriNotAbsolute(string parameterName, Uri actualValue)
        {
            return new ArgumentException(Error.Format(CommonWebApiResources.ArgumentInvalidAbsoluteUri, actualValue), parameterName);
        }

        /// <summary>
        /// Creates an <see cref="ArgumentException"/> with a message saying that the argument must be an absolute URI 
        /// without a query or fragment identifier and then logs it with <see cref="F:TraceLevel.Error"/>.
        /// </summary>
        /// <param name="parameterName">The name of the parameter that caused the current exception.</param>
        /// <param name="actualValue">The value of the argument that causes this exception.</param>
        /// <returns>The logged <see cref="Exception"/>.</returns>
        internal static ArgumentException ArgumentUriHasQueryOrFragment(string parameterName, Uri actualValue)
        {
            return new ArgumentException(Error.Format(CommonWebApiResources.ArgumentUriHasQueryOrFragment, actualValue), parameterName);
        }


		public static void Source (object source)
		{
			if (source == null)
				throw new ArgumentNullException ("source");
		}

		public static void Source1AndSource2 (object source1,object source2)
		{
			if (source1 == null)
				throw new ArgumentNullException ("source1");
			if (source2 == null)
				throw new ArgumentNullException ("source2");
		}

		public static void SourceAndFuncAndSelector ( object source, object func, object selector)
		{
			if (source == null)
				throw new ArgumentNullException ("source");
			if (func == null)
				throw new ArgumentNullException ("func");
			if (selector == null)
				throw new ArgumentNullException ("selector");
		}


		public static void SourceAndFunc (object source, object func)
		{
			if (source == null)
				throw new ArgumentNullException ("source");
			if (func == null)
				throw new ArgumentNullException ("func");
		}

		public static void SourceAndSelector (object source, object selector)
		{
			if (source == null)
				throw new ArgumentNullException ("source");
			if (selector == null)
				throw new ArgumentNullException ("selector");
		}

		public static void SourceAndPredicate (object source, object predicate)
		{
			if (source == null)
				throw new ArgumentNullException ("source");
			if (predicate == null)
				throw new ArgumentNullException ("predicate");
		}


            [TestMethod]
            [TestCategory(TestTiming.CheckIn)]
            public void It_should_not_throw_when_the_value_is_greater_than_the_comparand()
            {
                Action act = () => 5.ArgumentGreaterThan(0, "myParameterName");
                act.Should().NotThrow();
            }

            [TestMethod]
            [TestCategory(TestTiming.CheckIn)]
            public void It_should_throw_with_the_provided_argument_name_when_the_value_equals_the_comparand()
            {
                const string givenParameterName = "myParameterName";
                const int value = 1;
                const int comparand = 1;
                // var expectedMessage = string.Format(CultureInfo.InvariantCulture, ExceptionMessageFmt, comparand, value, givenParameterName);

                Action throwingAction = () => value.ArgumentGreaterThan(comparand, givenParameterName);

                var e = throwingAction.Should().Throw<ArgumentOutOfRangeException>();
                // e.WithMessage(expectedMessage);
                e.And.ActualValue.Should().BeEquivalentTo(value);
                e.And.ParamName.Should().Be(givenParameterName);
            }

            [TestMethod]
            [TestCategory(TestTiming.CheckIn)]
            public void It_should_throw_with_the_provided_argument_name_when_the_value_is_less_than_the_comparand()
            {
                const string givenParameterName = "myParameterName";
                const int value = 1;
                const int comparand = 5;
                // var expectedMessage = string.Format(CultureInfo.InvariantCulture, ExceptionMessageFmt, comparand, value, givenParameterName);

                Action throwingAction = () => value.ArgumentGreaterThan(comparand, givenParameterName);

                var e = throwingAction.Should().Throw<ArgumentOutOfRangeException>();
                // e.WithMessage(expectedMessage);
                e.And.ActualValue.Should().BeEquivalentTo(value);
                e.And.ParamName.Should().Be(givenParameterName);
            }

            [TestMethod]
            [TestCategory(TestTiming.CheckIn)]
            public void
                It_should_throw_with_the_provided_argument_name_when_the_value_is_less_than_the_comparand_and_handle_null_argument_names()
            {
                // When the parameter name is null, the BCL changes the message body.
                const string givenParameterName = null;
                const int value = 1;
                const int comparand = 5;
                var expectedMessage = string.Format(
                    CultureInfo.InvariantCulture,
                    NullParamNameExceptionMessageFmt,
                    comparand,
                    value);

                Action throwingAction = () => value.ArgumentGreaterThan(comparand, givenParameterName);

                var e = throwingAction.Should().Throw<ArgumentOutOfRangeException>();
                e.WithMessage(expectedMessage);
                e.And.ActualValue.Should().BeEquivalentTo(value);
                e.And.ParamName.Should().BeNull();
            }

            [TestMethod]
            [TestCategory(TestTiming.CheckIn)]
            public void It_should_not_throw_when_the_value_is_equal_to_the_comparand()
            {
                Action act = () => 5.ArgumentGreaterThanOrEqualTo(5, "myParameterName");
                act.Should().NotThrow();
            }

            [TestMethod]
            [TestCategory(TestTiming.CheckIn)]
            public void It_should_not_throw_when_the_value_is_greater_than_the_comparand()
            {
                Action act = () => 5.ArgumentGreaterThanOrEqualTo(0, "myParameterName");
                act.Should().NotThrow();
            }


	DynamicMetaObject GetFakeMetaObject (object value)
	{
		Type t = value == null ? typeof (object) : value.GetType ();
		Expression<Func<object>> et = () => value;

		Expression restr = Expression.Constant (true);
		return new DynamicMetaObject (Expression.Convert (et.Body, t), BindingRestrictions.GetExpressionRestriction (restr));
	}

	public override DynamicMetaObject BindBinaryOperation (BinaryOperationBinder binder, DynamicMetaObject arg)
	{
		if (mock.BinaryOperation == null)
			throw new ApplicationException ("Unexpected BindBinaryOperation");

		mock.BinaryOperation (binder, arg.Value);

		return GetFakeMetaObject (new object ());
	}

	public override DynamicMetaObject BindConvert (ConvertBinder binder)
	{
		if (mock.ConvertOperation == null)
			throw new ApplicationException ("Unexpected BindConvert");

		var r = mock.ConvertOperation (binder);

		return GetFakeMetaObject (r);
	}

	public override DynamicMetaObject BindGetIndex (GetIndexBinder binder, DynamicMetaObject[] indexes)
	{
		if (mock.GetIndexOperation == null)
			throw new ApplicationException ("Unexpected TryGetIndex");

		mock.GetIndexOperation (binder, indexes.Select (l => l.Value).ToArray ());

		return GetFakeMetaObject (new object ());
	}

	public override DynamicMetaObject BindGetMember (GetMemberBinder binder)
	{
		if (mock.GetMemberOperation == null)
			throw new ApplicationException ("Unexpected BindGetMember");

		var r = mock.GetMemberOperation (binder);

		return GetFakeMetaObject (r);
	}

	public override DynamicMetaObject BindInvoke (InvokeBinder binder, DynamicMetaObject[] args)
	{
		if (mock.InvokeOperation == null)
			throw new ApplicationException ("Unexpected BindInvoke");

		mock.InvokeOperation (binder, args.Select (l => l.Value).ToArray ());

		return GetFakeMetaObject (new object ());
	}


        /// <summary>
        /// Negates a ciphertext.
        /// </summary>
        /// <param name="encrypted">The ciphertext to negate</param>
        /// <exception cref="ArgumentNullException">if encrypted is null</exception>
        /// <exception cref="ArgumentException">if encrypted is not valid for the encryption parameters</exception>
        /// <exception cref="InvalidOperationException">if result ciphertext is transparent</exception>
        public void NegateInplace(Ciphertext encrypted)
        {
            Negate(encrypted, destination: encrypted);
        }

        /// <summary>
        /// Negates a ciphertext and stores the result in the destination parameter.
        /// </summary>
        /// <param name="encrypted">The ciphertext to negate</param>
        /// <param name="destination">The ciphertext to overwrite with the negated result</param>
        /// <exception cref="ArgumentNullException">if encrypted or destination is null</exception>
        /// <exception cref="ArgumentException">if encrypted is not valid for the encryption parameters</exception>
        /// <exception cref="InvalidOperationException">if result ciphertext is transparent</exception>
        public void Negate(Ciphertext encrypted, Ciphertext destination)
        {
            if (null == encrypted)
                throw new ArgumentNullException(nameof(encrypted));
            if (null == destination)
                throw new ArgumentNullException(nameof(destination));

            NativeMethods.Evaluator_Negate(NativePtr, encrypted.NativePtr, destination.NativePtr);
        }

        /// <summary>
        /// Adds two ciphertexts.
        /// </summary>
        /// <remarks>
        /// This function adds together encrypted1 and encrypted2 and stores the result in encrypted1.
        /// </remarks>
        /// <param name="encrypted1">The first ciphertext to add</param>
        /// <param name="encrypted2">The second ciphertext to add</param>
        /// <exception cref="ArgumentNullException">if encrypted1 or encrypted2 is null</exception>
        /// <exception cref="ArgumentException">if encrypted1 or encrypted2 is not valid for the encryption
        /// parameters</exception>
        /// <exception cref="ArgumentException">if encrypted1 and encrypted2 are in different NTT forms</exception>
        /// <exception cref="ArgumentException">if encrypted1 and encrypted2 are at different level or scale</exception>
        /// <exception cref="InvalidOperationException">if result ciphertext is transparent</exception>
        public void AddInplace(Ciphertext encrypted1, Ciphertext encrypted2)
        {
            Add(encrypted1, encrypted2, destination: encrypted1);
        }

        /// <summary>
        /// Adds two ciphertexts.
        /// </summary>
        /// <remarks>
        /// This function adds together encrypted1 and encrypted2 and stores the result in the destination parameter.
        /// </remarks>
        /// <param name="encrypted1">The first ciphertext to add</param>
        /// <param name="encrypted2">The second ciphertext to add</param>
        /// <param name="destination">The ciphertext to overwrite with the addition result</param>
        /// <exception cref="ArgumentNullException">if encrypted1, encrypted2, or destination is null</exception>
        /// <exception cref="ArgumentException">if encrypted1 or encrypted2 is not valid for the encryption
        /// parameters</exception>
        /// <exception cref="ArgumentException">if encrypted1 and encrypted2 are in different NTT forms</exception>
        /// <exception cref="ArgumentException">if encrypted1 and encrypted2 are at different level or scale</exception>
        /// <exception cref="InvalidOperationException">if result ciphertext is transparent</exception>
        public void Add(Ciphertext encrypted1, Ciphertext encrypted2, Ciphertext destination)
        {
            if (null == encrypted1)
                throw new ArgumentNullException(nameof(encrypted1));
            if (null == encrypted2)
                throw new ArgumentNullException(nameof(encrypted2));
            if (null == destination)
                throw new ArgumentNullException(nameof(destination));

            NativeMethods.Evaluator_Add(NativePtr, encrypted1.NativePtr, encrypted2.NativePtr, destination.NativePtr);
        }

        /// <summary>
        /// Adds together a vector of ciphertexts and stores the result in the destination parameter.
        /// </summary>
        /// <param name="encrypteds">The ciphertexts to add</param>
        /// <param name="destination">The ciphertext to overwrite with the addition result</param>
        /// <exception cref="ArgumentNullException">if encrypteds or destination is null</exception>
        /// <exception cref="ArgumentException">if encrypteds is empty</exception>
        /// <exception cref="ArgumentException">if encrypteds are not valid for the encryption parameters</exception>
        /// <exception cref="ArgumentException">if encrypteds are in different NTT forms</exception>
        /// <exception cref="ArgumentException">if encrypteds are at different level or scale</exception>
        /// <exception cref="InvalidOperationException">if result ciphertext is transparent</exception>
        public void AddMany(IEnumerable<Ciphertext> encrypteds, Ciphertext destination)
        {
            if (null == encrypteds)
                throw new ArgumentNullException(nameof(encrypteds));
            if (null == destination)
                throw new ArgumentNullException(nameof(destination));

            IntPtr[] encarray = encrypteds.Select(c => c.NativePtr).ToArray();
            NativeMethods.Evaluator_AddMany(NativePtr, (ulong)encarray.Length, encarray, destination.NativePtr);
        }

        /// <summary>
        /// Subtracts two ciphertexts.
        /// </summary>
        /// <remarks>
        /// This function computes the difference of encrypted1 and encrypted2, and stores the result in encrypted1.
        /// </remarks>
        /// <param name="encrypted1">The ciphertext to subtract from</param>
        /// <param name="encrypted2">The ciphertext to subtract</param>
        /// <exception cref="ArgumentNullException">if encrypted1 or encrypted2 is null</exception>
        /// <exception cref="ArgumentException">if encrypted1 or encrypted2 is not valid for the encryption
        /// parameters</exception>
        /// <exception cref="ArgumentException">if encrypted1 and encrypted2 are in different NTT forms</exception>
        /// <exception cref="ArgumentException">if encrypted1 and encrypted2 are at different level or scale</exception>
        /// <exception cref="InvalidOperationException">if result ciphertext is transparent</exception>
        public void SubInplace(Ciphertext encrypted1, Ciphertext encrypted2)
        {
            Sub(encrypted1, encrypted2, destination: encrypted1);
        }

        /// <summary>
        /// Computes the dot product of x and y.
        /// </summary>
        /// <param name="x">The vector x.</param>
        /// <param name="y">The vector y.</param>
        /// <returns>The dot product of x and y.</returns>
        /// <remarks>This is equivalent to the DOT BLAS routine.</remarks>
        [SecuritySafeCritical]
        public override Complex DotProduct(Complex[] x, Complex[] y)
        {
            if (y == null)
            {
                throw new ArgumentNullException("y");
            }

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

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

            return SafeNativeMethods.z_dot_product(x.Length, x, y);
        }
        
        /// <summary>
        /// Adds a scaled vector to another: <c>result = y + alpha*x</c>.
        /// </summary>
        /// <param name="y">The vector to update.</param>
        /// <param name="alpha">The value to scale <paramref name="x"/> by.</param>
        /// <param name="x">The vector to add to <paramref name="y"/>.</param>
        /// <param name="result">The result of the addition.</param>
        /// <remarks>This is similar to the AXPY BLAS routine.</remarks>
        [SecuritySafeCritical]
        public override void AddVectorToScaledVector(Complex[] y, Complex alpha, Complex[] x, Complex[] result)
        {
            if (y == null)
            {
                throw new ArgumentNullException("y");
            }

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

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

            if (!ReferenceEquals(y, result))
            {
                Array.Copy(y, 0, result, 0, y.Length);
            }

            if (alpha == Complex.Zero)
            {
                return;
            }

            SafeNativeMethods.z_axpy(y.Length, alpha, x, result);
        }

        /// <summary>
        /// Scales an array. Can be used to scale a vector and a matrix.
        /// </summary>
        /// <param name="alpha">The scalar.</param>
        /// <param name="x">The values to scale.</param>
        /// <param name="result">This result of the scaling.</param>
        /// <remarks>This is similar to the SCAL BLAS routine.</remarks>
        [SecuritySafeCritical]
        public override void ScaleArray(Complex alpha, Complex[] x, Complex[] result)
        {
            if (x == null)
            {
                throw new ArgumentNullException("x");
            } 
            
            if (!ReferenceEquals(x, result))
            {
                Array.Copy(x, 0, result, 0, x.Length);
            }

            if (alpha == Complex.One)
            {
                return;
            }

            SafeNativeMethods.z_scale(x.Length, alpha, result);
        }

        /// <summary>
        /// Multiples two matrices. <c>result = x * y</c>
        /// </summary>
        /// <param name="x">The x matrix.</param>
        /// <param name="rowsX">The number of rows in the x matrix.</param>
        /// <param name="columnsX">The number of columns in the x matrix.</param>
        /// <param name="y">The y matrix.</param>
        /// <param name="rowsY">The number of rows in the y matrix.</param>
        /// <param name="columnsY">The number of columns in the y matrix.</param>
        /// <param name="result">Where to store the result of the multiplication.</param>
        /// <remarks>This is a simplified version of the BLAS GEMM routine with alpha
        /// set to Complex.One and beta set to Complex.Zero, and x and y are not transposed.</remarks>
        public override void MatrixMultiply(Complex[] x, int rowsX, int columnsX, Complex[] y, int rowsY, int columnsY, Complex[] result)
        {
            MatrixMultiplyWithUpdate(Transpose.DontTranspose, Transpose.DontTranspose, Complex.One, x, rowsX, columnsX, y, rowsY, columnsY, Complex.Zero, result);
        }

        /// <summary>
        /// Multiplies two matrices and updates another with the result. <c>c = alpha*op(a)*op(b) + beta*c</c>
        /// </summary>
        /// <param name="transposeA">How to transpose the <paramref name="a"/> matrix.</param>
        /// <param name="transposeB">How to transpose the <paramref name="b"/> matrix.</param>
        /// <param name="alpha">The value to scale <paramref name="a"/> matrix.</param>
        /// <param name="a">The a matrix.</param>
        /// <param name="rowsA">The number of rows in the <paramref name="a"/> matrix.</param>
        /// <param name="columnsA">The number of columns in the <paramref name="a"/> matrix.</param>
        /// <param name="b">The b matrix</param>
        /// <param name="rowsB">The number of rows in the <paramref name="b"/> matrix.</param>
        /// <param name="columnsB">The number of columns in the <paramref name="b"/> matrix.</param>
        /// <param name="beta">The value to scale the <paramref name="c"/> matrix.</param>
        /// <param name="c">The c matrix.</param>
        [SecuritySafeCritical]
        public override void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, Complex alpha, Complex[] a, int rowsA, int columnsA, Complex[] b, int rowsB, int columnsB, Complex beta, Complex[] c)
        {
            if (a == null)
            {
                throw new ArgumentNullException("a");
            }

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

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

            var m = transposeA == Transpose.DontTranspose ? rowsA : columnsA;
            var n = transposeB == Transpose.DontTranspose ? columnsB : rowsB;
            var k = transposeA == Transpose.DontTranspose ? columnsA : rowsA;
            var l = transposeB == Transpose.DontTranspose ? rowsB : columnsB;

            if (c.Length != m * n)
            {
                throw new ArgumentException(Resources.ArgumentMatrixDimensions);   
            }

            if (k != l)
            {
                throw new ArgumentException(Resources.ArgumentMatrixDimensions);
            }

            SafeNativeMethods.z_matrix_multiply(transposeA, transposeB, m, n, k, alpha, a, b, beta, c);
        }

        /// <summary>
        /// Computes the LUP factorization of A. P*A = L*U.
        /// </summary>
        /// <param name="data">An <paramref name="order"/> by <paramref name="order"/> matrix. The matrix is overwritten with the
        /// the LU factorization on exit. The lower triangular factor L is stored in under the diagonal of <paramref name="data"/> (the diagonal is always Complex.One
        /// for the L factor). The upper triangular factor U is stored on and above the diagonal of <paramref name="data"/>.</param>
        /// <param name="order">The order of the square matrix <paramref name="data"/>.</param>
        /// <param name="ipiv">On exit, it contains the pivot indices. The size of the array must be <paramref name="order"/>.</param>
        /// <remarks>This is equivalent to the GETRF LAPACK routine.</remarks>
        [SecuritySafeCritical]
        public override void LUFactor(Complex[] data, int order, int[] ipiv)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

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

            if (data.Length != order * order)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "data");
            }

            if (ipiv.Length != order)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
            }
            
            SafeNativeMethods.z_lu_factor(order, data, ipiv);
        }

BenchmarkDotNet.Jobs.Argument : Object

Methods :

public String get_TextRepresentation()
public String ToString()
public Type GetType()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()

Other methods

Other methods