Package mikera.arrayz

Examples of mikera.arrayz.INDArray


  @Override
  public List<INDArray> getSlices() {
    int sc=sliceCount();
    if (sc==0) return Collections.emptyList();
    ArrayList<INDArray> al=new ArrayList<INDArray>(sc);
    INDArray z=slice(0);
    for (int i=0; i<sc; i++) {
      al.add(z);
    }
    return al;
  }
View Full Code Here


    }
    return StridedMatrix.wrap(data, rows, cols, offset, rowStride, colStride);
  }

  public static AMatrix createSparse(Iterable<INDArray> slices) {
    INDArray slice1=slices.iterator().next();
    int cc=slice1.sliceCount();
    ArrayList<AVector> al=new ArrayList<AVector>();
    for (INDArray a:slices) {
      if ((a.dimensionality()!=1)||(a.sliceCount()!=cc)) throw new IllegalArgumentException(ErrorMessages.incompatibleShape(a));
      al.add(a.sparse().asVector());
    }
View Full Code Here

      return (Math.abs(d)<=epsilon);
    } else {
      int sc=sliceCount();
      if (a.sliceCount()!=sc) return false;
      for (int i=0; i<sc; i++) {
        INDArray s=slice(i);
        if (!s.epsilonEquals(a.slice(i),epsilon)) return false;
      }     
      return true;
    }
  }
View Full Code Here

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

    }
  }
 
  @Override
  public INDArray multiplyCopy(double d) {
    INDArray r=clone();
    r.multiply(d);
    return r;
  }
View Full Code Here

    return r;
  }
 
  @Override
  public INDArray applyOpCopy(Op op) {
    INDArray r=clone();
    r.applyOp(op);
    return r;
  }
View Full Code Here

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

    if (dimensionality()==0) {
      set(value);
    } else {
      int sc=sliceCount();
      for (int i=0; i<sc; i++) {
        INDArray s=slice(i);
        s.fill(value);
      }     
    }
  }
View Full Code Here

    }
  }
 
  @Override
  public INDArray innerProduct(double a) {
    INDArray result=clone();
    result.scale(a);
    return result;
  }
View Full Code Here

    for (Object s:this) {
      if (s instanceof INDArray) {
        al.add(((INDArray)s).outerProduct(a));
      } else {
        double x=Tools.toDouble(s);
        INDArray sa=a.clone();
        sa.scale(x);
        al.add(sa);
      }
    }
    return Arrayz.create(al);
  }
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.