/// <summary>
        /// Logarithm of all intervals multiplied.
        /// </summary>
        /// <param name="chain">
        /// Source sequence.
        /// </param>
        /// <param name="link">
        /// Link of intervals in chain.
        /// </param>
        /// <returns>
        /// <see cref="double"/> value of alphabetic average remoteness.
        /// </returns>
        /// <exception cref="InvalidOperationException">
        /// Thrown if method is called not from <see cref="Calculate(Chain,Link)"/> and alphabet cardinality is unknown.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Thrown if link is unknown.
        /// </exception>
        private double Calculate(CongenericChain chain, Link link)
        {
            int[] intervals = chain.GetIntervals(link);

            return intervals.Length == 0 ? 0 : intervals.Sum(interval => Math.Log(interval, alphabetCardinality));
        }
Пример #2
0
        /// <summary>
        /// Calculated as product of all intervals in sequence.
        /// </summary>
        /// <param name="chain">
        /// Source sequence.
        /// </param>
        /// <param name="link">
        /// Redundant parameter, not used in calculations.
        /// </param>
        /// <returns>
        /// Volume characteristic of chain as <see cref="double"/>.
        /// </returns>
        public double Calculate(CongenericChain chain, Link link)
        {
            var intervals = chain.GetIntervals(link);

            return intervals.Length == 0 ? 1 : intervals.Aggregate((result, interval) => result * interval);
        }
Пример #3
0
        /// <summary>
        /// Calculated as base 2 logarithm of multiplication 
        /// of intervals between nearest elements 
        /// in congeneric sequence.
        /// </summary>
        /// <param name="chain">
        /// Congeneric sequence.
        /// </param>
        /// <param name="link">
        /// Link of intervals in chain.
        /// </param>
        /// <returns>
        /// <see cref="double"/> value of depth.
        /// </returns>
        public double Calculate(CongenericChain chain, Link link)
        {
            var intervals = chain.GetIntervals(link);

            return intervals.Length == 0 ? 0 : intervals.Sum(interval => Math.Log(interval, 2));
        }
 /// <summary>
 /// If link is to start, to end or cycle then intervals count equals elements count.
 /// If link is to start and end then intervals count equals elements count + 1.
 /// If link is none then intervals count equals elements count - 1.
 /// </summary>
 /// <param name="chain">
 /// Source sequence.
 /// </param>
 /// <param name="link">
 /// Link of intervals in chain.
 /// </param>
 /// <returns>
 /// Intervals count in chain as <see cref="double"/>.
 /// </returns>
 public double Calculate(CongenericChain chain, Link link)
 {
     return chain.GetIntervals(link).Length;
 }