Package mikera.arrayz

Examples of mikera.arrayz.INDArray


    return r;
  }
 
  @Override
  public INDArray divideCopy(INDArray a) {
    INDArray r=this.broadcastCloneLike(a);
    r.divide(a);
    return r;
  }
View Full Code Here


    int dims=dimensionality();
    if (dims ==0) {
      data[offset]+=get();
    } else {
      int n=sliceCount();
      INDArray s0=slice(0);
      int ec=(int) s0.elementCount();
      s0.addToArray(data, offset);
      for (int i=1; i<n; i++) {
        slice(i).addToArray(data, offset+i*ec);
     
    }
  }
 
View Full Code Here

   
    int[] off=new int[n];
    int[] shp=getShapeClone();
   
    shp[dimension]=shift;
    INDArray right=subArray(off,shp);
    shp[dimension]=dlen-shift;
    off[dimension]=shift;
    INDArray left=subArray(off,shp);
    return left.join(right,dimension);
  }
View Full Code Here

      dest[offset]=get();
      return;
    }
    int sc=sliceCount();
    for (int i=0; i<sc; i++) {
      INDArray s=slice(i);
      s.getElements(dest,offset);
      offset+=s.elementCount();
    }
  }
View Full Code Here

 
  @Override
  public void toDoubleBuffer(DoubleBuffer dest) {
    int sc=sliceCount();
    for (int i=0; i<sc; i++) {
      INDArray s=slice(i);
      s.toDoubleBuffer(dest);
    }
  }
View Full Code Here

    } else if (dims==tdims) {
      if (IntArrays.equals(targetShape, this.getShape())) return this;
      throw new IllegalArgumentException(ErrorMessages.incompatibleBroadcast(this, targetShape));
    } else {
      int n=targetShape[0];
      INDArray s=broadcast(Arrays.copyOfRange(targetShape, 1, tdims));
      return SliceArray.repeat(s,n);
    }
  }
View Full Code Here

 
  @Override
  public INDArray broadcastCloneLike(INDArray target) {
    int dims=dimensionality();
    int targetDims=target.dimensionality();
    INDArray r=this;
    if (dims<targetDims) r=r.broadcastLike(target);
    return r.clone();
  }
View Full Code Here

  @Override
  public boolean hasUncountable() {
    if (dimensionality()==0) return Double.isNaN(get()) || Double.isInfinite(get());
    int sc=sliceCount();
    for (int i=0; i<sc; i++) {
      INDArray s=slice(i);
      if (s.hasUncountable()) return true;
    }
    return false;
  }
View Full Code Here

    }
    return a;
  }
 
  public static boolean validateFullyMutable(INDArray m) {
    INDArray c=m.exactClone();
    AVector v=c.asVector();
    int n=v.length();

    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;}
View Full Code Here

    if (o instanceof AVector) {
      return (AVector)o;
    } else if (o instanceof double[]) {
      return Vectorz.create((double[])o);
    } else if (o instanceof INDArray) {
      INDArray a=(INDArray)o;
      if (a.dimensionality()!=1) throw new IllegalArgumentException("Cannot coerce INDArray with shape "+a.getShape().toString()+" to a vector");
      return a.asVector();
    } else if (o instanceof List<?>) {
      return Vectorz.create((List<Object>)o);
    } else if (o instanceof Iterable<?>) {
      return Vectorz.create((Iterable<Object>)o);
    }
View Full Code Here

TOP

Related Classes of mikera.arrayz.INDArray

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.