示例#1
0
        public override bool same(Vector av)
        {
            VectorJust v = (VectorJust)av;

            for (int pi = 1; pi < powers.Length; pi++)
            {
                if (powers[pi] != v.powers[pi])
                {
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
        public override bool same_interval(Vector v, Vector w1, Vector w2)
        {
            VectorJust vc  = (VectorJust)v;
            VectorJust w1c = (VectorJust)w1;
            VectorJust w2c = (VectorJust)w2;

            for (int d = 0; d < powers.Length; d++)
            {
                if (primes[d] - vc.primes[d] != w1c.primes[d] - w2c.primes[d])
                {
                    return(false);
                }
            }
            return(true);
        }
示例#3
0
        public override double concordance(Vector av)
        {
            VectorJust v = (VectorJust)av;

            double dist   = 0.0;
            double weight = 1.0;

            for (int pi = 1; pi < powers.Length; pi++)
            {
                double di = (double)(powers[pi] - v.powers[pi]);
                dist   += weight * di * di;
                weight *= 1.3;
            }

            double result = 0.8 * (double)dist;

            return(result);
        }
示例#4
0
        public override Vector[] jostle()
        {
            int option_count = 1;

            for (int d = 0; d < powers.Length; d++)
            {
                option_count += 2 * factory.deltas[d].Length;
            }


            Vector[] options = new Vector[option_count];
            options[0] = new VectorJust(factory, powers);

            int oi = 1;

            for (int d = 0; d < powers.Length; d++)
            {
                int[][] ddels = factory.deltas[d];
                for (int dd = 0; dd < ddels.Length; dd++)
                {
                    for (int sign = -1; sign < 2; sign += 2)
                    {
                        int[] op = new int[powers.Length];
                        for (int pi = 0; pi < powers.Length; pi++)
                        {
                            op[pi] = powers[pi];
                        }
                        for (int pi = 0; pi < ddels[dd].Length; pi++)
                        {
                            op[pi] += sign * ddels[dd][pi];
                        }

                        options[oi] = new VectorJust(factory, op);
                        oi++;
                    }
                }
            }


            return(options);
        }