Package org.renjin.primitives.matrix

Examples of org.renjin.primitives.matrix.Matrix


    return sourceDim.length() == subscriptDim.getElementAsInt(1);
  }
 
  public CoordinateMatrixSelection(SEXP source, SEXP subscript) {
    super(source);
    this.coordinateMatrix = new Matrix((Vector)subscript);
    this.sourceDim = dimAsIntArray(source);
   
    if(sourceDim.length != coordinateMatrix.getNumCols()) {
      throw new EvalException("The number of dimensions in the source (%d) does not " +
          "match the number of columns in the provided coordinate matrix (%d)",
View Full Code Here


public class ContrastMatrix {

  private Matrix matrix;
 
  public ContrastMatrix(SEXP matrix) {
    this.matrix = new Matrix((Vector) matrix);
  }
View Full Code Here

    if(numColumns == 1) {
      return Collections.singletonList(new UnivariateColumn(name, vector));
    } else {
      List<ModelMatrixColumn> columns = Lists.newArrayList();
      for(int i=0;i!=numColumns;++i) {
        columns.add(new MultivariateColumn(name + "." + (i+1), new Matrix(vector, numColumns), i));
      }
      return columns;
    }
  }
View Full Code Here

  public static Vector Rrowsum_matrix(Vector x, int ncol, AtomicVector groups, AtomicVector ugroup, boolean naRm) {
   
    int numGroups = ugroup.length();
   
    Matrix source = new Matrix(x, ncol);
    MatrixBuilder result = source.newBuilder(numGroups, ncol);
   
    for(int col=0;col!=ncol;++col) {
     
      // sum the rows in this column by group
     
      double groupSums[] = new double[numGroups];
      for(int row=0;row!=source.getNumRows();++row) {
        int group = ugroup.indexOf(groups, row, 0);
        groupSums[group] += source.getElementAsDouble(row, col);
      }
     
      // copy sums to matrix
      for(int group=0;group!=ugroup.length();++group) {
        result.setValue(group, col, groupSums[group]);
View Full Code Here

    this.object = object;
    this.frame = frame;
    this.intercept = getIntAttribute(INTERCEPT);
    this.response = getIntAttribute(RESPONSE);
    try {
      this.factorMatrix = new Matrix((Vector)object.getAttribute(FACTORS));
      this.variableNames = (StringVector) factorMatrix.getRowNames();
    } catch(Exception e) {
      throw new EvalException("invalid 'factors' attribute");
    }
   
View Full Code Here

TOP

Related Classes of org.renjin.primitives.matrix.Matrix

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.