//-------------------------------------------------------------------------

        /**
         * Hedge a CDS with other CDSs on the same underlying (single-name or index) at different maturities.
         * <p>
         * The hedge is such that the total portfolio (the CDS <b>minus</b> the hedging CDSs, with notionals of the
         * CDS notional times the computed hedge ratios) is insensitive to infinitesimal changes to the the credit curve.
         * <p>
         * Here the credit curve is built using the hedging CDSs as pillars.
         *
         * @param cds  the CDS to be hedged
         * @param coupon  the coupon of the CDS to be hedged
         * @param hedgeCDSs  the CDSs to hedge with - these are also used to build the credit curve
         * @param hedgeCDSCoupons  the coupons of the CDSs to hedge with/build credit curve
         * @param hegdeCDSPUF  the PUF of the CDSs to build credit curve
         * @param yieldCurve  the yield curve
         * @return the hedge ratios,
         *  since we use a unit notional, the ratios should be multiplied by -notional to give the hedge notional amounts
         */
        public double[] getHedgeRatios(
            CDS cds,
            double coupon,
            CDS[] hedgeCDSs,
            double[] hedgeCDSCoupons,
            double[] hegdeCDSPUF,
            YieldTermStructure yieldCurve)
        {
            PiecewiseconstantHazardRate cc = _builder.calibrateCreditCurve(hedgeCDSs, hedgeCDSCoupons, yieldCurve, hegdeCDSPUF);

            return(getHedgeRatios(cds, coupon, hedgeCDSs, hedgeCDSCoupons, cc, yieldCurve));
        }
        /**
         * The analytic CS01 (or credit DV01).
         *
         * @param cds  the analytic description of a CDS traded at a certain time
         * @param coupon  the of the traded CDS  (expressed as <b>fractions not basis points</b>)
         * @param yieldCurve  the yield (or discount) curve
         * @param puf  the points up-front (as a fraction)
         * @return the credit DV01
         */
        public double parallelCS01FromPUF(CDS cds, double coupon, YieldTermStructure yieldCurve, double puf)
        {
            PiecewiseconstantHazardRate cc = _curveBuilder.calibrateCreditCurve(cds, coupon, yieldCurve, puf);
            double a      = _pricer.protectionLeg(cds, yieldCurve, cc);
            double b      = _pricer.annuity(cds, yieldCurve, cc, CdsPriceType.CLEAN);
            double aPrime = _pricer.protectionLegCreditSensitivity(cds, yieldCurve, cc, 0);
            double bPrime = _pricer.pvPremiumLegCreditSensitivity(cds, yieldCurve, cc, 0);
            double s      = a / b;
            double dPVdh  = aPrime - coupon * bPrime;
            double dSdh   = (aPrime - s * bPrime) / b;

            return(dPVdh / dSdh);
        }