Create() public method

Creates matrix.
public Create ( int alphabetCardinality, int i ) : object
alphabetCardinality int /// Alphabet cardinality. ///
i int /// The dimensionality of the matrix. ///
return object
        /// <summary>
        /// The teach.
        /// </summary>
        /// <param name="chain">
        /// The chain.
        /// </param>
        /// <param name="method">
        /// The method.
        /// </param>
        public override void Teach(BaseChain chain, TeachingMethod method)
        {
            var builder = new MatrixBuilder();
            var absoluteMatrix = (IAbsoluteMatrix)builder.Create(chain.Alphabet.Cardinality, Rank);
            for (int i = 0; i < chain.Alphabet.Cardinality; i++)
            {
                int[] temp = new int[1];
                temp[0] = chain.Alphabet.IndexOf(chain.Alphabet[i]);

                absoluteMatrix.Add(temp);
            }

            ProbabilityMatrixes[0] = absoluteMatrix.ProbabilityMatrix();
        }
        /// <summary>
        /// Teaches markov chain using provided sequence.
        /// </summary>
        /// <param name="chain">
        /// Sequence used for teaching.
        /// </param>
        /// <param name="method">
        /// Chain preprocessing method.
        /// </param>
        public virtual void Teach(BaseChain chain, TeachingMethod method)
        {
            var builder = new MatrixBuilder();
            var absMatrix = new IAbsoluteMatrix[HeterogeneityRank + 1];
            Alphabet = chain.Alphabet;
            for (int i = 0; i < HeterogeneityRank + 1; i++)
            {
                absMatrix[i] = (IAbsoluteMatrix)builder.Create(Alphabet.Cardinality, Rank);
            }

            SpaceReorganizer reorganizer = GetRebuilder(method);
            chain = (BaseChain)reorganizer.Reorganize(chain);

            var it = new IteratorStart(chain, Rank, 1);
            it.Reset();

            int k = 0;

            // filling matrixes
            while (it.Next())
            {
                ++k;
                int m = k % (HeterogeneityRank + 1);
                if (m == 0)
                {
                    m = HeterogeneityRank + 1;
                }

                BaseChain chainToTeach = (BaseChain)it.Current();
                var indexedChain = new int[Rank];
                for (int i = 0; i < Rank; i++)
                {
                    indexedChain[i] = chain.Alphabet.IndexOf(chainToTeach[i]);
                }

                absMatrix[m - 1].Add(indexedChain);
            }

            for (int i = 0; i < HeterogeneityRank + 1; i++)
            {
                ProbabilityMatrixes[i] = absMatrix[i].ProbabilityMatrix();
            }
        }