Example usage for org.apache.commons.math3.dfp DfpField DfpField

List of usage examples for org.apache.commons.math3.dfp DfpField DfpField

Introduction

In this page you can find the example usage for org.apache.commons.math3.dfp DfpField DfpField.

Prototype

public DfpField(final int decimalDigits) 

Source Link

Document

Create a factory for the specified number of radix digits.

Usage

From source file:org.matheclipse.commons.parser.client.eval.dfp.DfpEvaluator.java

public DfpEvaluator(final int decimalDigits, ASTNode node, boolean relaxedSyntax) {
    super(relaxedSyntax);
    fASTFactory = new ASTNodeFactory(relaxedSyntax);
    fVariableMap = new HashMap<String, FieldElementVariable<Dfp>>();
    fBooleanVariables = new HashMap<String, BooleanVariable>();
    fNode = node;/*from  w w  w  .  j  a va  2  s. c  o  m*/
    fDfpField = new DfpField(decimalDigits);
    fZERO = new DfpNode(fDfpField.getZero());
    init();
    if (fRelaxedSyntax) {
        if (SYMBOL_MAP.get("pi") == null) {
            // init tables for relaxed mode
            for (String key : SYMBOL_MAP.keySet()) {
                SYMBOL_MAP.put(key.toLowerCase(), SYMBOL_MAP.get(key));
            }
            for (String key : SYMBOL_BOOLEAN_MAP.keySet()) {
                SYMBOL_BOOLEAN_MAP.put(key.toLowerCase(), SYMBOL_BOOLEAN_MAP.get(key));
            }
            for (String key : FUNCTION_MAP.keySet()) {
                FUNCTION_MAP.put(key.toLowerCase(), FUNCTION_MAP.get(key));
            }
            for (String key : FUNCTION_BOOLEAN_MAP.keySet()) {
                FUNCTION_BOOLEAN_MAP.put(key.toLowerCase(), FUNCTION_BOOLEAN_MAP.get(key));
            }
        }
    }
}

From source file:org.orekit.forces.gravity.ReferenceFieldModel.java

public ReferenceFieldModel(NormalizedSphericalHarmonicsProvider provider, int digits) {
    this.dfpField = new DfpField(digits);
    this.provider = provider;
    this.alf = createAlf(provider.getMaxDegree(), provider.getMaxOrder(), true, dfpField);
}

From source file:org.orekit.forces.gravity.ReferenceFieldModel.java

public ReferenceFieldModel(UnnormalizedSphericalHarmonicsProvider provider, int digits) {
    this.dfpField = new DfpField(digits);
    this.provider = provider;
    this.alf = createAlf(provider.getMaxDegree(), provider.getMaxOrder(), false, dfpField);
}

From source file:org.rhwlab.BHC.GammaTest.java

static public void main(String[] args) {
    int n = 1000;
    DfpField field = new DfpField(20);
    for (int i = 0; i < n; ++i) {
        Dfp G = field.newDfp(Gamma.logGamma(i)).exp();
        System.out.printf("%d: %e %e %s\n", i, Gamma.gamma(i), Gamma.logGamma(i), G.toString());
    }/*from  w  w  w . j  av  a 2 s. c o m*/
}

From source file:org.rhwlab.BHCnotused.GaussianGIWPrior.java

static public void main(String[] args) throws Exception {
    System.out.println("GaussianGIWPrior");
    field = new DfpField(20); // 20 decimal digits
    Cluster.setDfpField(field);//  www.ja va 2 s  .  c o m
    ThreadedAlgorithm.setDfpField(field);
    GaussianGIWPrior.setDfpField(field);

    //        SegmentedTiffDataSource source = new SegmentedTiffDataSource("/nfs/waterston/pete/Segmentation/Cherryimg75.tif",
    //                "/nfs/waterston/pete/Segmentation/Cherryimg75_SimpleSegmentation.tiff",1);  // background is seg=1
    //       source = new MicroClusterDataSource("/nfs/waterston/pete/Segmentation/Cherryimg_SimpleSegmentationMulti0350.xml");
    source = new MicroClusterDataSource(
            "/nfs/waterston/pete/Segmentation/Cherryimg_SimpleSegmentation0075.save");
    RealVector mean = source.getDataMean();
    Dfp[] mu = new Dfp[mean.getDimension()];
    for (int i = 0; i < mu.length; ++i) {
        mu[i] = field.newDfp(mean.getEntry(i));
    }
    GaussianGIWPrior.setParameters(4.0, 0.001, mu, 200.0);
    Cluster.setAlpha(30);
    ThreadedAlgorithm alg = new ThreadedAlgorithm();
    alg.setSource(source);
    alg.init(2);
    alg.run();
    alg.saveResultAsXML("/nfs/waterston/pete/Segmentation/Cherryimg_SimpleSegmentation0075_BHC.xml");
    int hfuis = 0;
}