YAMP.MaxFunction.GetVectorMax C# (CSharp) Method

GetVectorMax() static private method

static private GetVectorMax ( MatrixValue vec ) : ScalarValue
vec MatrixValue
return ScalarValue
        static ScalarValue GetVectorMax(MatrixValue vec)
        {
            var buf = ScalarValue.Zero;
            var max = Double.MinValue;
            var temp = 0.0;

            for (var i = 1; i <= vec.Length; i++)
            {
                temp = vec.IsComplex ? vec[i].Abs() : vec[i].Re;

                if (temp > max)
                {
                    buf = vec[i];
                    max = temp;
                }
            }

            return buf;
        }