Ejemplo 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);
 }
Ejemplo 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;
		}
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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;
		}
Ejemplo 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;
		}