Examples of AVector


Examples of mikera.vectorz.AVector

      return;
    if ((i < 0) || (i >= cols))
      throw new IndexOutOfBoundsException(ErrorMessages.invalidSlice(this, 1, i));
    if ((j < 0) || (j >= cols))
      throw new IndexOutOfBoundsException(ErrorMessages.invalidSlice(this, 1, j));
    AVector a = unsafeGetVec(i);
    AVector b = unsafeGetVec(j);
    unsafeSetVec(i, b);
    unsafeSetVec(j, a);
  }
View Full Code Here

Examples of mikera.vectorz.AVector

 
  @Override
  public void add(AMatrix a) {
    int count=columnCount();
    for (int i=0; i<count; i++) {
      AVector myVec=unsafeGetVec(i);
      AVector aVec=a.getColumn(i);
      if (myVec==null) {
        if (!aVec.isZero()) {
          unsafeSetVec(i,aVec.copy());
        }
      } else if (myVec.isMutable()) {
        myVec.add(aVec);
      } else {
        unsafeSetVec(i,myVec.addCopy(aVec));
View Full Code Here

Examples of mikera.vectorz.AVector

 
  @Override
  public void copyRowTo(int row, double[] targetData, int offset) {
    Arrays.fill(targetData, offset,offset+ cols,0.0);
        for (int i = 0; i < cols; ++i) {
            AVector e = unsafeGetVec(i);
            if (e != null)
          targetData[offset+i]=e.unsafeGet(row);
    }   
  }
View Full Code Here

Examples of mikera.vectorz.AVector

 
  @Override
  public AMatrix multiplyCopy(double a) {
    AVector[] ndata=new AVector[lineCount()];
    for (int i = 0; i < lineCount(); ++i) {
            AVector v = unsafeGetVec(i);
            if (v != null)
                ndata[i] = v.innerProduct(a);
    }
    return wrap(ndata,rows,cols);
  }
View Full Code Here

Examples of mikera.vectorz.AVector

  }
 
  @Override
  public void applyOp(Op op) {
    for (int i=0; i<cols; i++) {
      AVector col=getColumn(i);
      if (col.isFullyMutable()) {
        col.applyOp(op);
      } else {
        col=col.mutable();
        col.applyOp(op);
        replaceColumn(i,col);
      }
    }
  }
View Full Code Here

Examples of mikera.vectorz.AVector

  @Override
  public double[] toDoubleArray() {
    Matrix m=Matrix.create(rows, cols);
    for (int i=0; i<cols; i++) {
      AVector v = unsafeGetVec(i);
      if (v != null)
                m.getColumn(i).set(v);
    }
    return m.getArray();
  }
View Full Code Here

Examples of mikera.vectorz.AVector

 
  @Override
  public SparseColumnMatrix exactClone() {
    SparseColumnMatrix result= new SparseColumnMatrix(rows,cols);
        for (int i = 0; i < cols; ++i) {
      AVector col = unsafeGetVec(i);
      if (col != null)
          result.replaceColumn(i, col.exactClone());
    }
    return result;
  }
View Full Code Here

Examples of mikera.vectorz.AVector

  @Override
  public boolean equals(AMatrix m) {
    if (m==this) return true;
    if (!isSameShape(m)) return false;
    for (int i=0; i<cols; i++) {
      AVector v=unsafeGetVec(i);
            AVector ov = m.getColumn(i);
      if (v==null) {
        if (!ov.isZero()) return false;
      } else {
        if (!v.equals(ov)) return false;
      }
    }
    return true;
View Full Code Here

Examples of mikera.vectorz.AVector

  /**
   * Calculates a single element of the output.
   * Not necessarily faster than calculating full output, but can be in some circumstances.
   */
  public double calculateElement(int i, AVector inputVector) {
    AVector r=transform(inputVector);
    return r.unsafeGet(i);
  }
View Full Code Here

Examples of mikera.vectorz.AVector

  public void composeWith(ATranslation t) {
    if (t instanceof Translation) {
      composeWith((Translation) t);
      return;
    }
    AVector v=t.getTranslationVector();
    translationVector.add(v);
  }
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.