public Dictionary <FermionTermType, Double> ComputeOneNorms()
 {
     return(FermionTerms.ToDictionary(
                (termTypePair) => termTypePair
                .Key,
                (termTypePair) => termTypePair
                .Value
                .AsParallel()
                .Select(o => Abs(o.coeff))
                .Sum()
                ));
 }
        /// <summary>
        /// This approximates the Hamiltonian ground state by a greedy algorithm
        /// that minimizes only the PP term energies. If there are no PP terms,
        /// states will be occupied in lexicographic order.
        /// </summary>
        /// <returns>
        /// Greedy trial state for minimizing Hamiltonian diagonal one-electron energy.
        /// </returns>
        public InputState GreedyStatePreparation()
        {
            var label = "Greedy";

            (Double, Double)coeff = (1.0, 0.0);
            var conjugate = Enumerable.Range(0, (int)NElectrons).Select(o => (Int64)1).ToArray();

            if (FermionTerms.ContainsKey(PPTermType))
            {
                var hPPTermSortedByCoeff = FermionTerms[PPTermType];
                var spinOrbitals         = hPPTermSortedByCoeff.OrderBy(o => o.coeff).Select(o => o.SpinOrbitalIndices.First()).Take((int)NElectrons).ToArray();
                var fermionTerm          = new FermionTerm(conjugate, spinOrbitals, 1.0);
                fermionTerm.ToSpinOrbitalCanonicalOrder();
                fermionTerm.coeff = 1.0;

                var superposition = new((Double, Double), FermionTerm)[] {