Examples of unsafeGet()


Examples of mikera.indexz.Index.unsafeGet()

    if (length==0) throw new IllegalArgumentException("Can't create a length 0 SparseIndexedVector");
    Index ixs=source.nonSparseIndex();
    int n=ixs.length();
    double[] vals=new double[n];
    for (int i=0; i<n; i++) {
      vals[i]=source.unsafeGet(ixs.unsafeGet(i));
    }
    return wrap(length,ixs,vals);
  }
 
  public static SparseIndexedVector create(SparseHashedVector source) {
View Full Code Here

Examples of mikera.indexz.Index.unsafeGet()

    if (length==0) throw new IllegalArgumentException("Can't create a length 0 SparseIndexedVector");
    Index ixs=source.nonSparseIndex();
    int n=ixs.length();
    double[] vals=new double[n];
    for (int i=0; i<n; i++) {
      vals[i]=source.unsafeGet(ixs.unsafeGet(i));
    }
    return wrap(length,ixs,vals);
  }
 
  /** Creates a SparseIndexedVector from a row of an existing matrix */
 
View Full Code Here

Examples of mikera.vectorz.AVector.unsafeGet()

    ISVDResult ans = SVD.decompose(A, true);
    int rank = 0;
    AVector singularValues = ans.getSingularValues();
    int n=singularValues.length();
    for(int i=0; i<n; i++) {
      if( singularValues.unsafeGet(i) >= threshold)
        rank++;
    }
    return rank;
  }
 
View Full Code Here

Examples of mikera.vectorz.AVector.unsafeGet()

  @Override
  public double dotProduct(double[] data, int offset) {
    AVector r=source.getRow(row);
    double result=0.0;
    for (int i=0; i<length; i++) {
      result+=data[offset+i]*r.unsafeGet(i);
    }
    return result;
  }
}
View Full Code Here

Examples of mikera.vectorz.AVector.unsafeGet()

  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);
    }   
  }
 
  @Override
  public SparseRowMatrix getTransposeView() {
View Full Code Here

Examples of mikera.vectorz.AVector.unsafeGet()

   * 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);
  }
 
  /**
   * Transforms a vector destructively. Intended for fast non-allocating transforms
   * @param v
View Full Code Here

Examples of mikera.vectorz.AVector.unsafeGet()

      double[] tmp = new double[n];
      a.getElements(ds, 0);

      boolean nan=false;
      for (int i = 0; i < n; i++) {
        double x= op.apply(v.unsafeGet(i));
        if (Double.isNaN(x)) nan=true;
        tmp[i] = x;
      }
      if (nan) continue; // TODO: compare NaNs properly
      b.validate();
View Full Code Here

Examples of mikera.vectorz.AVector.unsafeGet()

  public void copyColumnTo(int col, double[] targetData, int offset) {
    Arrays.fill(targetData, offset, offset+rows, 0.0);
        for (int i = 0; i < rows; ++i) {
            AVector v = unsafeGetVec(i);
            if (v != null)
          targetData[offset+i] = v.unsafeGet(col);
    }   
  }

  @Override
  public SparseColumnMatrix getTransposeView() {
View Full Code Here

Examples of mikera.vectorz.AVector.unsafeGet()

    if ((!c.isFullyMutable())) return false;
    if ((!c.isMutable())&&(n>0)) return false
   
    for (int i=0; i<n ; i++) {
      double t=v.unsafeGet(i);
      double x=10+Rand.nextDouble()*1000;
      if (t==x) {x=x+1;}
      v.set(i,x);
      if(x!=v.get(i)) return false;
      v.set(i,t);
View Full Code Here

Examples of mikera.vectorz.AVector.unsafeGet()

    AVector a = getRowView(i);
    AVector b = getRowView(j);
    int cc = columnCount();
    for (int k = 0; k < cc; k++) {
      double t = a.unsafeGet(k);
      a.unsafeSet(k, b.unsafeGet(k));
      b.unsafeSet(k, t);
    }
  }

  /**
 
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.