Package org.renjin.primitives.summary

Examples of org.renjin.primitives.summary.DeferredMean


  @Test
  public void testSimpleArray() {

    DoubleArrayVector vector = new DoubleArrayVector(1,2,3);
    DeferredMean mean = new DeferredMean(vector, AttributeMap.EMPTY);
    DeferredGraph graph = new DeferredGraph(mean);

    DeferredJitter jitter = new DeferredJitter();
    JittedComputation computation = jitter.compile(graph.getRoot());
View Full Code Here


  public void nestedDistance() {

    DoubleArrayVector vector = new DoubleArrayVector(5,10,3,2,1);
    DistanceMatrix matrix = new DistanceMatrix(vector);
    System.out.println(Deparse.deparseExp(null, matrix));
    DeferredMean mean = new DeferredMean(matrix, AttributeMap.EMPTY);
    DeferredGraph graph = new DeferredGraph(mean);

    compute(graph);

  }
View Full Code Here

    DoubleArrayVector vector = new DoubleArrayVector(5,10,3,2,1);
    DistanceMatrix matrix = new DistanceMatrix(vector);
    System.out.println(Deparse.deparseExp(null, matrix));
    Vector negative = new R$primitive$$minus$deferred_d(matrix, AttributeMap.EMPTY);
    DeferredMean mean = new DeferredMean(negative, AttributeMap.EMPTY);
    DeferredGraph graph = new DeferredGraph(mean);

    DeferredJitter jitter = new DeferredJitter();
    JittedComputation computation = jitter.compile(graph.getRoot());
View Full Code Here

  public void transposed() {

    DoubleArrayVector vector = new DoubleArrayVector(new double[] { 1,2,3,4,5,6,7,8,9,10,11,12 } ,
            AttributeMap.dim(4,3));
    TransposingMatrix t = new TransposingMatrix(vector, AttributeMap.dim(3,4));
    DeferredMean mean = new DeferredMean(t, AttributeMap.EMPTY);
    DeferredGraph graph = new DeferredGraph(mean);

    compute(graph);
  }
View Full Code Here

    DoubleArrayVector a = new DoubleArrayVector(1,2,3,4);
    DoubleArrayVector b = new DoubleArrayVector(10,20,30,40,50,60,70,80);

    Vector times = new R$primitive$$times$deferred_dd(a, b, AttributeMap.EMPTY);
    DeferredMean mean = new DeferredMean(times, AttributeMap.EMPTY);
    DeferredGraph graph = new DeferredGraph(mean);

    Vector x = compute(graph);
    System.out.println(x);
  }
View Full Code Here

  @Deferrable
  @Internal
  public static DoubleVector mean(Vector x) {

    if(x instanceof DeferredComputation || x.length() > 100000) {
      return new DeferredMean(x, AttributeMap.EMPTY);
    }

    double mean = 0;
    for (int i=0;i<x.length();i++){
      mean+=x.getElementAsDouble(i);
View Full Code Here

TOP

Related Classes of org.renjin.primitives.summary.DeferredMean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.