Examples of Matrix


Examples of org.pdfbox.util.Matrix

            if( xobject instanceof PDXObjectImage )
            {
                try
                {
                    PDPage page = getCurrentPage();
                    Matrix ctm = getGraphicsState().getCurrentTransformationMatrix();
                    double rotationInRadians =(page.findRotation() * Math.PI)/180;
                    
                   
                    AffineTransform rotation = new AffineTransform();
                    rotation.setToRotation( rotationInRadians );
                    AffineTransform rotationInverse = rotation.createInverse();
                    Matrix rotationInverseMatrix = new Matrix();
                    rotationInverseMatrix.setFromAffineTransform( rotationInverse );
                    Matrix rotationMatrix = new Matrix();
                    rotationMatrix.setFromAffineTransform( rotation );
                   
                    Matrix unrotatedCTM = ctm.multiply( rotationInverseMatrix );
                   
                    System.out.println( "Found image[" + objectName.getName() + "] " +
                            "at " + unrotatedCTM.getXPosition() + "," + unrotatedCTM.getYPosition() );
                }
                catch( NoninvertibleTransformException e )
                {
                    throw new WrappedIOException( e );
                }
View Full Code Here

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

Examples of org.saiku.olap.dto.resultset.Matrix

    // corner.
    final int yOffset = columnsAxisInfo.getWidth();
    final int xOffsset = rowsAxisInfo.getWidth();

    // Populate a string matrix
    final Matrix matrix = new Matrix(xOffsset + (columnsAxis == null ? 1 : columnsAxis.getPositions().size()),
        yOffset + (rowsAxis == null ? 1 : rowsAxis.getPositions().size()));

    // Populate corner
    List<Level> levels = new ArrayList<Level>();
    if (rowsAxis != null && rowsAxis.getPositions().size() > 0) {
      Position p = rowsAxis.getPositions().get(0);
      for (int m = 0; m < p.getMembers().size(); m++) {
        AxisOrdinalInfo a = rowsAxisInfo.ordinalInfos.get(m);
        for (Integer depth : a.getDepths()) {
          levels.add(a.getLevel(depth));
        }
      }
      for (int x = 0; x < xOffsset; x++) {
        Level xLevel = levels.get(x);
        String s = xLevel.getCaption();
        for (int y = 0; y < yOffset; y++) {
          final MemberCell memberInfo = new MemberCell(x > 0);
          if (y == yOffset - 1) {
            memberInfo.setRawValue(s);
            memberInfo.setFormattedValue(s);
            memberInfo.setProperty("__headertype", "row_header_header");
            memberInfo.setProperty("levelindex", "" + levels.indexOf(xLevel));
            memberInfo.setHierarchy(xLevel.getHierarchy().getUniqueName());
            memberInfo.setParentDimension(xLevel.getDimension().getName());
            memberInfo.setLevel(xLevel.getUniqueName());
          }
          matrix.set(x, y, memberInfo);
        }

      }
    }
    // Populate matrix with cells representing axes
    // noinspection SuspiciousNameCombination
    populateAxis(matrix, columnsAxis, columnsAxisInfo, true, xOffsset);
    populateAxis(matrix, rowsAxis, rowsAxisInfo, false, yOffset);

    // Populate cell values
    for (final Cell cell : cellIter(pageCoords, cellSet)) {
      final List<Integer> coordList = cell.getCoordinateList();
      int x = xOffsset;
      if (coordList.size() > 0) {
        x += coordList.get(0);
      }
      int y = yOffset;
      if (coordList.size() > 1) {
        y += coordList.get(1);
      }
      final DataCell cellInfo = new DataCell(true, coordList);
      cellInfo.setCoordinates(cell.getCoordinateList());

      if (cell.getValue() != null) {
        try {
          cellInfo.setRawNumber(cell.getDoubleValue());
        } catch (Exception e1) {
          LOG.error("Could not get double", e1);
        }
      }
      String cellValue = cell.getFormattedValue(); // First try to get a
      // formatted value

      if (cellValue == null || cellValue.equals("null")) { //$NON-NLS-1$
        cellValue = ""; //$NON-NLS-1$
      }
      if (cellValue.length() < 1) {
        final Object value = cell.getValue();
        if (value == null || value.equals("null")) { //$NON-NLS-1$
          cellValue = ""; //$NON-NLS-1$
        } else {
          try {
            // TODO this needs to become query / execution specific
            DecimalFormat myFormatter = new DecimalFormat(SaikuProperties.FORMATDEFAULTNUMBERFORMAT); //$NON-NLS-1$
            DecimalFormatSymbols dfs = new DecimalFormatSymbols(SaikuProperties.LOCALE);
            myFormatter.setDecimalFormatSymbols(dfs);
            String output = myFormatter.format(cell.getValue());
            cellValue = output;
          } catch (Exception e) {
            // TODO: handle exception
          }
        }
        // the raw value
      }

      // Format string is relevant for Excel export
      // xmla cells can throw an error on this
      try {

        String formatString = (String) cell.getPropertyValue(Property.StandardCellProperty.FORMAT_STRING);
        if (formatString != null && !formatString.startsWith("|")) {
          cellInfo.setFormatString(formatString);
        } else {
          formatString = formatString.substring(1, formatString.length());
          cellInfo.setFormatString(formatString.substring(0, formatString.indexOf("|")));
        }
      } catch (Exception e) {
        // we tried
      }

      Map<String, String> cellProperties = new HashMap<String, String>();
      String val = Olap4jUtil.parseFormattedCellValue(cellValue, cellProperties);
      if (!cellProperties.isEmpty()) {
        cellInfo.setProperties(cellProperties);
      }
      cellInfo.setFormattedValue(val);
      matrix.set(x, y, cellInfo);
    }
    return matrix;

  }
View Full Code Here

Examples of org.zkoss.zss.model.impl.Matrix

      }
    }
    return orgref;
  }
  public Reference addRef(Sheet sheetFrom, Sheet sheetTo, int left, int top, int right, int bottom) {
    final Matrix matrix = sheetTo == null ?
      ((SheetImpl)sheetFrom).getMatrix() : ((BookImpl)sheetFrom.getBook()).getMatrix();
    return matrix.addRef(sheetFrom, sheetTo, left, top, right, bottom);
  }
View Full Code Here

Examples of parus.data.Matrix

    pane.add(panel);
    //viewer_frame.pack();
    pane.repaint();

    Matrix mtr_data=data.get_matrix_by_length(min);
    Matrix mtr_deviation=null;
   
    if(deviation!=null)
    {
      mtr_deviation=deviation.get_matrix_by_length(min);
    }
View Full Code Here

Examples of quicktime.std.image.Matrix

          throw new SchemeException(new Pair(), null, null);
        } // if (Thread.interrupted())
        Track video = mov.getIndTrackType(1, StdQTConstants.videoMediaType,
          StdQTConstants.movieTrackMediaType);
        Track newTrack = MovieUtils.addVideoTrack(video, temp);
        Matrix mat = new Matrix();
        QDRect from = mov.getBounds();
        QDRect to = null;
        int height = from.getHeight();
        int width = from.getWidth();
        int x = 0;
        int y = 0;
        if ((direction == 0) || (direction == 2))
        {
          height = Math.round(from.getHeight() * (float)1.0f/(i+1));
          y = j * height;
        } // if ((direction == 0) || (direction == 2))
        else if ((direction == 1) || (direction == 3))
        {
          width = Math.round(from.getWidth() * (float)1.0f/(i+1));
          x = j * width;
        } // else if ((direction == 1) || (direction == 3))
        to = new QDRect(x, y, width, height);
        mat.rect(from, to);
        newTrack.setMatrix(mat);
        newTrack.setLayer(-1);
      } // for
      result.add(temp);
    } // for
View Full Code Here

Examples of tv.porst.swfretools.parser.structures.Matrix

   */
  public static DefineTextTag parse(final RecordHeader header, final SWFBinaryParser parser) throws SWFParserException {

    final UINT16 characterId = parseUINT16(parser, 0x00006, "DefineText::CharacterId");
    final Rect textBounds = RectParser.parse(parser, "DefineText::TextBounds");
    final Matrix textMatrix = MatrixParser.parse(parser, "DefineText::TextMatrix");
    final UINT8 glyphBits = parseUINT8(parser, 0x00006, "DefineText::GlyphBits");
    final UINT8 advanceBits = parseUINT8(parser, 0x00006, "DefineText::AdvanceBits");

    final List<TextRecord> textRecords = new ArrayList<TextRecord>();

View Full Code Here

Examples of weka.core.Matrix

  numAttributes++;
      }
    }

    // Check whether there are still attributes left
    Matrix independent = null, dependent = null;
    double[] weights = null;
    if (numAttributes > 0) {
      independent = new Matrix(m_TransformedData.numInstances(),
             numAttributes);
      dependent = new Matrix(m_TransformedData.numInstances(), 1);
      for (int i = 0; i < m_TransformedData.numInstances(); i ++) {
  Instance inst = m_TransformedData.instance(i);
  int column = 0;
  for (int j = 0; j < m_TransformedData.numAttributes(); j++) {
    if (j == m_ClassIndex) {
      dependent.setElement(i, 0, inst.classValue());
    } else {
      if (selectedAttributes[j]) {
        double value = inst.value(j) - m_Means[j];
       
        // We only need to do this if we want to
        // scale the input
        if (!m_checksTurnedOff) {
    value /= m_StdDevs[j];
        }
        independent.setElement(i, column, value);
        column++;
      }
    }
  }
      }
     
      // Grab instance weights
      weights = new double [m_TransformedData.numInstances()];
      for (int i = 0; i < weights.length; i++) {
  weights[i] = m_TransformedData.instance(i).weight();
      }
    }

    // Compute coefficients (note that we have to treat the
    // intercept separately so that it doesn't get affected
    // by the ridge constant.)
    double[] coefficients = new double[numAttributes + 1];
    if (numAttributes > 0) {
      double[] coeffsWithoutIntercept  =
  independent.regression(dependent, weights, m_Ridge);
      System.arraycopy(coeffsWithoutIntercept, 0, coefficients, 0,
           numAttributes);
    }
    coefficients[numAttributes] = m_ClassMean;
    
View Full Code Here

Examples of weka.core.matrix.Matrix

  protected void initVars(Instances data) {
    super.initVars(data);

    try {
      if (m_KernelMatrix == null) {
        m_KernelMatrix = new Matrix(new FileReader(m_KernelMatrixFile));
        //        System.err.println("Read kernel matrix.");
      }
    } catch (Exception e) {
      System.err.println("Problem reading matrix from " + m_KernelMatrixFile);
    }
View Full Code Here

Examples of yb.matrix.Matrix

    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);

        // PREMIERE MATRICE
        System.out.println("Première matrice : ");
        Matrix m1 = new Matrix(readMatrix());
       
        // DEUXIEME MATRICE
        System.out.println("Première matrice : ");
        Matrix m2 = new Matrix(readMatrix());

        // SOMME
        try {
            System.out.println("M1 + M2 = ");
            System.out.println(m1.add(m2));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.