Exemple #1
0
 public SobolRsg(uint dimensionality, int seed, SobolRsg.DirectionIntegers directionIntegers) : this(NQuantLibcPINVOKE.new_SobolRsg__SWIG_0(dimensionality, seed, (int)directionIntegers), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public SobolBrownianGeneratorFactory(SobolBrownianGenerator.Ordering ordering, ulong seed = 0,
                                      SobolRsg.DirectionIntegers integers = SobolRsg.DirectionIntegers.Jaeckel)
 {
     ordering_ = ordering;
     seed_     = seed;
     integers_ = integers;
 }
 public SobolBrownianBridgeRsg(int factors, int steps,
                               SobolBrownianGenerator.Ordering ordering = SobolBrownianGenerator.Ordering.Diagonal,
                               ulong seed = 0,
                               SobolRsg.DirectionIntegers directionIntegers = SobolRsg.DirectionIntegers.JoeKuoD7)
 {
     factors_ = factors;
     steps_   = steps;
     dim_     = factors * steps;
     seq_     = new Sample <List <double> >(new InitializedList <double>(factors * steps), 1.0);
     gen_     = new SobolBrownianGenerator(factors, steps, ordering, seed, directionIntegers);
 }
        public SobolBrownianGenerator(int factors, int steps, Ordering ordering, ulong seed = 0,
                                      SobolRsg.DirectionIntegers directionIntegers          = SobolRsg.DirectionIntegers.Jaeckel)
        {
            factors_   = factors;
            steps_     = steps;
            ordering_  = ordering;
            generator_ = new InverseCumulativeRsg <SobolRsg, InverseCumulativeNormal>(
                new SobolRsg(factors * steps, seed, directionIntegers), new InverseCumulativeNormal());
            bridge_          = new BrownianBridge(steps);
            lastStep_        = 0;
            orderedIndices_  = new InitializedList <List <int> >(factors);
            bridgedVariates_ = new InitializedList <List <double> >(factors);
            for (int i = 0; i < factors; i++)
            {
                orderedIndices_[i]  = new InitializedList <int>(steps);
                bridgedVariates_[i] = new InitializedList <double>(steps);
            }

            switch (ordering_)
            {
            case Ordering.Factors:
                fillByFactor(orderedIndices_, factors_, steps_);
                break;

            case Ordering.Steps:
                fillByStep(orderedIndices_, factors_, steps_);
                break;

            case Ordering.Diagonal:
                fillByDiagonal(orderedIndices_, factors_, steps_);
                break;

            default:
                Utils.QL_FAIL("unknown ordering");
                break;
            }
        }
Exemple #5
0
    //typedef SobolRsg generator_type;

    public SobolFactory(SobolRsg.DirectionIntegers unit)
    {
        unit_ = unit;
    }
 //typedef SobolRsg generator_type;
 public SobolFactory(SobolRsg.DirectionIntegers unit)
 {
     unit_=unit;
 }
 public SobolBrownianGeneratorFactory(SobolBrownianGenerator.Ordering ordering, uint seed, SobolRsg.DirectionIntegers directionIntegers) : this(NQuantLibcPINVOKE.new_SobolBrownianGeneratorFactory__SWIG_0((int)ordering, seed, (int)directionIntegers), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }