public double[][] MatrixExpCached(EigenPair eigenPair, double t)
        {
            Pair <EigenPair, double> key = new Pair <EigenPair, double>(eigenPair, t);

            double[][] result;

            result = MatrixExp(eigenPair, t);
            //if (_matrixExpCache.ContainsKey(key))
            //{
            //    result = _matrixExpCache[key];
            //    _hits++;
            //}
            //else
            //{
            //    result = MatrixExp(eigenPair, t);

            //    if (_matrixExpCache.Count >= 1000)
            //    {
            //        Console.WriteLine("Clearing EIGENPAIR/BRANCH LENGTH cache. {0}/{1} ({2}%) were hits", _hits, _total, (double)_hits / _total);
            //        _matrixExpCache.Clear();
            //    }

            //    _matrixExpCache.Add(key, result);
            //}

            return(result);
        }
        public static double[][] MatrixExp(EigenPair eigenPair, double t)
        {
            ComplexNumber[] values    = eigenPair.EigenValues;
            ComplexNumber[] newValues = new ComplexNumber[values.Length];
            for (int i = 0; i < values.Length; i++)
            {
                newValues[i] = ComplexNumber.Exp(values[i] * t);
            }

            return(eigenPair.GetRaggedMatrixWithModifiedEigenValues(newValues));
        }