Esempio n. 1
0
 public static bool AreCompatible(Vector v1, Vector v2)
 {
     if (!v1.IsValid())
     {
         throw new ArgumentException("Vector 1 is not initialized");
     }
     if (!v2.IsValid())
     {
         throw new ArgumentException("Vector 2 is not initialized");
     }
     return(v1.fNRows == v2.fNRows);
 }
Esempio n. 2
0
		public static bool AreCompatible(Vector v1, Vector v2)
		{
			if (!v1.IsValid())
			{
				throw new ArgumentException("Vector 1 is not initialized");
			}
			if (!v2.IsValid())
			{
				throw new ArgumentException("Vector 2 is not initialized");
			}
			return v1.fNRows == v2.fNRows;
		}
Esempio n. 3
0
        public Vector ElementDiv(Vector target, Vector source)
        {
            if (!source.IsValid())
            {
                throw new ApplicationException("Source vector is not initialized");
            }
            if (!target.IsValid())
            {
                throw new ApplicationException("Target vector is not initialized");
            }
            if (!Vector.AreCompatible(target, source))
            {
                throw new ApplicationException("Vectors are not compatible");
            }
            Vector vector = new Vector(target.fNRows);

            for (int i = 0; i < this.fNRows; i++)
            {
                vector[i] = target[i] / source[i];
            }
            return(vector);
        }
Esempio n. 4
0
        public Vector ElementMult(Vector target, Vector source)
        {
            if (!source.IsValid())
            {
                throw new ApplicationException("Source vector is not initialized");
            }
            if (!target.IsValid())
            {
                throw new ApplicationException("Target vector is not initialized");
            }
            if (!Vector.AreCompatible(target, source))
            {
                throw new ApplicationException("Vectors are not compatible");
            }
            Vector vector = new Vector(target.nrows);

            for (int index = 0; index < this.nrows; ++index)
            {
                vector[index] = target[index] * source[index];
            }
            return(vector);
        }
Esempio n. 5
0
		public Vector ElementDiv(Vector target, Vector source)
		{
			if (!source.IsValid())
				throw new ApplicationException("Source vector is not initialized");
			if (!target.IsValid())
				throw new ApplicationException("Target vector is not initialized");
			if (!Vector.AreCompatible(target, source))
				throw new ApplicationException("Vectors are not compatible");
			Vector vector = new Vector(target.nrows);
			for (int index = 0; index < this.nrows; ++index)
				vector[index] = target[index] / source[index];
			return vector;
		}
Esempio n. 6
0
		public Vector ElementDiv(Vector target, Vector source)
		{
			if (!source.IsValid())
			{
				throw new ApplicationException("Source vector is not initialized");
			}
			if (!target.IsValid())
			{
				throw new ApplicationException("Target vector is not initialized");
			}
			if (!Vector.AreCompatible(target, source))
			{
				throw new ApplicationException("Vectors are not compatible");
			}
			Vector vector = new Vector(target.fNRows);
			for (int i = 0; i < this.fNRows; i++)
			{
				vector[i] = target[i] / source[i];
			}
			return vector;
		}