Package org.renjin.sexp

Examples of org.renjin.sexp.Vector$Order


    private Vector vector;
   
    public MatrixAdapter(Vector vector) {
      this.vector = vector;
     
      Vector dim = vector.getAttributes().getDim();
      if(dim == Null.INSTANCE) {
        throw new IllegalArgumentException("the vector has no 'dim' attribute");
      }
      if(dim.length() != 2) {
        throw new IllegalArgumentException("the vector has is not a matrix; it has " + dim.length() + " dimension(s).");
      }
      nrows = dim.getElementAsInt(0);
      ncols = dim.getElementAsInt(1);
    }
View Full Code Here


    }
    return n;
  }
 
  private static int numCases(AtomicVector vector) {
    Vector dim = vector.getAttributes().getDim();
    if(dim.length() == 2) {
      return dim.getElementAsInt(1);
    } else {
     
      // even if there is no dim attribute, or
      // there are more than 2 dimensions, we treat the input
      // as a plain vector
View Full Code Here

    private int variables;
    private int observations;

    public VariableSet(AtomicVector vector) {
      this.vector = vector;
      Vector dim = (Vector) vector.getAttribute(Symbols.DIM);
      if(dim == Null.INSTANCE) {
        this.observations = vector.length();
        this.variables = 1;
      } else {
        if(dim.length() != 2) {
          throw new EvalException("must be vector or matrix, not higher-order array");
        }
        this.observations = dim.getElementAsInt(0);
        this.variables = dim.getElementAsInt(1);
      }   
    }
View Full Code Here

    return vector + "[" + index + "]";
  }

  @Override
  public Object retrieveValue(Context context, Object[] temps) {
    Vector vectorValue = (Vector) vector.retrieveValue(context, temps);
    Integer indexValue = (Integer)index.retrieveValue(context, temps);
    return vectorValue.getElementAsSEXP(indexValue);
  }
View Full Code Here

TOP

Related Classes of org.renjin.sexp.Vector$Order

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.