示例#1
0
 internal Enumerator(FullVector <T> vector)
 {
     m_Vector  = vector;
     m_Index   = -1;
     m_Version = vector.m_Version;
     m_Current = default(Element <T>);
 }
示例#2
0
        private static bool EqualsHelper(FullVector <T> a, Vector <T> b)
        {
            if (a.m_Count != b.Count)
            {
                return(false);
            }
            var fullMatrix = b as FullVector <T>;

            if (((object)fullMatrix) != null)
            {
                for (int i = 0; i < a.m_Values.Length; ++i)
                {
                    if (!a.m_Values[i].Equals(fullMatrix.m_Values[i]))
                    {
                        return(false);
                    }
                }
            }
            else
            {
                T[] val = new T[a.m_Count];
                b.CopyTo(val);
                for (int i = 0; i < val.Length; ++i)
                {
                    if (!a.m_Values[i].Equals(val[i]))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
示例#3
0
        public static Vector <T> operator /(Vector <T> value1, Matrix <T> value2)
        {
            FullVector <T> returnValue = null;
            var            solver      = SolversResolver.GetMatrixSolver <T>();

            solver.Division(value1, value2, ref returnValue);
            return(returnValue);
        }
示例#4
0
        public static Vector <T> operator *(Vector <T> value1, Vector <T> value2)
        {
            FullVector <T> returnValue = null;
            var            solver      = SolversResolver.GetMatrixSolver <T>();

            solver.Multiply(value1, value2, ref returnValue);
            return(returnValue);
        }
示例#5
0
        public static Vector <T> operator -(Vector <T> value)
        {
            FullVector <T> returnValue = null;
            var            solver      = SolversResolver.GetMatrixSolver <T>();

            solver.Negation(value, ref returnValue);
            return(returnValue);
        }
示例#6
0
        public static Vector <T> operator -(Vector <T> value1, Vector <T> value2)
        {
            FullVector <T> returnValue = null;
            var            solver      = SolversResolver.GetMatrixSolver <T>();

            solver.Substraction(value1, value2, ref returnValue);
            return(returnValue);
        }
示例#7
0
        public override void CopyTo(Vector <T> vector, int index = 0, int arrayIndex = 0, int length = int.MaxValue)
        {
            FullVector <T> fullVector = vector as FullVector <T>;

            if (fullVector == null)
            {
                throw new NotSupportedException(vector.GetType().ToString());
            }
            CopyTo(fullVector.m_Values, index, arrayIndex, length);
        }
示例#8
0
        public static Vector <T> operator /(Vector <T> value1, T value2)
        {
            FullVector <T> returnValue = null;
            var            gSolver     = SolversResolver.GetGenericSolver <T>();
            T   value2Inverted         = gSolver.Inversion(value2);
            var solver = SolversResolver.GetMatrixSolver <T>();

            solver.Multiply(value1, value2Inverted, ref returnValue);
            return(returnValue);
        }
示例#9
0
            public override void CopyTo(Vector <T> vector, int index = 0, int arrayIndex = 0, int length = int.MaxValue)
            {
                if (m_Version != m_Matrix.m_Version)
                {
                    throw new InvalidOperationException();
                }
                ThrowHelper <T> .ThrowIfNull(vector, "vector");

                FullVector <T> fullVector = vector as FullVector <T>;

                if (fullVector == null)
                {
                    throw new NotSupportedException(vector.GetType().ToString());
                }
                CopyTo(fullVector.m_Values, index, arrayIndex, length);
            }
示例#10
0
            /// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.List`1" />.</summary>
            /// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
            /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
            public bool MoveNext()
            {
                if (m_Version != m_Vector.m_Version)
                {
                    throw new InvalidOperationException();
                }
                FullVector <T> vector = m_Vector;

                m_Index++;
                for (; m_Index < vector.m_Count; ++m_Index)
                {
                    T value = vector.m_Values[m_Index];
                    if (object.Equals(value, default(T)))
                    {
                        continue;
                    }
                    m_Current = new Element <T>(m_Index, value);
                    return(true);
                }
                m_Index   = m_Vector.m_Count;
                m_Current = default(Element <T>);
                return(false);
            }