Esempio n. 1
0
        /// <summary>
        /// Computes proportion between value of the true dimension and sum of values of all dimensions. If true dimension is unspecified, it will assume that the highest value represents the true dimension
        /// </summary>
        /// <param name="nVector">The n vector.</param>
        /// <param name="TrueDimension">The true dimension.</param>
        /// <returns></returns>
        public static Double CompressByTrueDimension(this IVectorDimensions nVector, Int32 TrueDimension = -1)
        {
            if (TrueDimension == -1)
            {
                TrueDimension = nVector.GetDominantDimension();
            }


            Int32  c = 0;
            Double m = 0;

            Double TValue = 0;
            Double TAll   = 0;

            foreach (Double d in nVector.dimensions)
            {
                if (c == TrueDimension)
                {
                    TValue = d;
                }
                TAll += d;
                c++;
            }


            return(TValue.GetRatio(TAll));
        }
Esempio n. 2
0
        public static List <Double> GetDistinctValuesAtVector(this IVectorDimensions vector)
        {
            List <Double> distinct = new List <Double>();

            foreach (Double d in vector.dimensions)
            {
                if (!distinct.Contains(d))
                {
                    distinct.Add(d);
                }
            }

            return(distinct);
        }
Esempio n. 3
0
        /// <summary>
        /// Returns index of dimension with highest value
        /// </summary>
        /// <returns></returns>
        public static Int32 GetDominantDimension(this IVectorDimensions nVector)
        {
            Int32  i = 0;
            Int32  c = 0;
            Double m = Double.MinValue;

            foreach (Double d in nVector.dimensions)
            {
                if (d > m)
                {
                    m = d;
                    i = c;
                }
                c++;
            }
            return(i);
        }
Esempio n. 4
0
 bool IEquatable <IVectorDimensions> .Equals(IVectorDimensions other)
 {
     return(other.name == name);
 }
Esempio n. 5
0
 /// <summary>
 /// Compresses the numeric vector.
 /// </summary>
 /// <param name="nVector">The n vector.</param>
 /// <param name="operation">Allowed operations: <see cref="operation.multiplication"/>, <see cref="operation.max"/>, <see cref="operation.min"/>, <see cref="operation.plus"/></param>
 /// <returns></returns>
 /// <exception cref="ArgumentOutOfRangeException">Operation [" + operation.ToString() + "] not supported by this method. - operation</exception>
 public static Double CompressNumericVector(this IVectorDimensions nVector, operation operation)
 {
     return(nVector.dimensions.CompressNumericVector(operation));
 }
 public bool Equals(IVectorDimensions other)
 {
     return(name == other.name);
 }