Examples of DoubleMatrix1D


Examples of cern.colt.matrix.DoubleMatrix1D

      int tmp = g[b]; g[b] = g[c]; g[c] = tmp;
    }
  };
 
  // compare splitter[a] with columnView[rowIndexes[b]]
  final DoubleMatrix1D columnView = matrix.viewColumn(column);
  IntComparator comp = new IntComparator() {
    public int compare(int a, int b) {
      double av = splitters[a];
      double bv = columnView.getQuick(g[b]);
      return av<bv ? -1 : (av==bv ? 0 : 1);
    }
  };

  // compare columnView[rowIndexes[a]] with columnView[rowIndexes[b]]
  IntComparator comp2 = new IntComparator() {
    public int compare(int a, int b) {
      double av = columnView.getQuick(g[a]);
      double bv = columnView.getQuick(g[b]);
      return av<bv ? -1 : (av==bv ? 0 : 1);
    }
  };

  // compare splitter[a] with splitter[b]
View Full Code Here

Examples of cern.colt.matrix.DoubleMatrix1D

  if (isNoView && other.isNoView) { // quickest
    System.arraycopy(other.elements, 0, this.elements, 0, this.elements.length);
    return this;
  }
  if (haveSharedCells(other)) {
    DoubleMatrix1D c = other.copy();
    if (! (c instanceof DenseDoubleMatrix1D)) { // should not happen
      return super.assign(source);
    }
    other = (DenseDoubleMatrix1D) c;
  }
View Full Code Here

Examples of cern.colt.matrix.DoubleMatrix1D

The returned view is backed by this matrix, so changes in the returned view are reflected in this matrix, and vice-versa.

@return a new flip view.
*/
public DoubleMatrix1D viewFlip() {
  DoubleMatrix1D view = new WrapperDoubleMatrix1D(this) {
    public double getQuick(int index) {
      return content.get(size-1-index);
    }
    public void setQuick(int index, double value) {
      content.set(size-1-index,value);
View Full Code Here

Examples of cern.colt.matrix.DoubleMatrix1D

@return the new view.
   
*/
public DoubleMatrix1D viewPart(final int index, int width) {
  checkRange(index,width);
  DoubleMatrix1D view = new WrapperDoubleMatrix1D(this) {
    public double getQuick(int i) {
      return content.get(index+i);
    }
    public void setQuick(int i, double value) {
      content.set(index+i,value);
View Full Code Here

Examples of cern.colt.matrix.DoubleMatrix1D

  }
 
  checkIndexes(indexes);
  final int[] idx = indexes;

  DoubleMatrix1D view = new WrapperDoubleMatrix1D(this) {
    public double getQuick(int i) {
      return content.get(idx[i]);
    }
    public void setQuick(int i, double value) {
      content.set(idx[i],value);
View Full Code Here

Examples of cern.colt.matrix.DoubleMatrix1D

@return the new view.
   
*/
public DoubleMatrix1D viewStrides(final int _stride) {
  if (stride<=0) throw new IndexOutOfBoundsException("illegal stride: "+stride);
  DoubleMatrix1D view = new WrapperDoubleMatrix1D(this) {
    public double getQuick(int index) {
      return content.get(index*_stride);
    }
    public void setQuick(int index, double value) {
      content.set(index*_stride,value);
View Full Code Here

Examples of com.opengamma.analytics.math.matrix.DoubleMatrix1D

public class DavidonFletcherPowellInverseHessianUpdate implements QuasiNewtonInverseHessianUpdate {
  private static final MatrixAlgebra MA = MatrixAlgebraFactory.getMatrixAlgebra("OG");

  @Override
  public void update(final QuasiNewtonVectorMinimizer.DataBundle data) {
    final DoubleMatrix1D hDeltaGrad = (DoubleMatrix1D) MA.multiply(data.getInverseHessianEsimate(), data.getDeltaGrad());
    final double deltaXdeltaGrad = MA.getInnerProduct(data.getDeltaX(), data.getDeltaGrad());
    final double deltaGradHdeltaGrad = MA.getInnerProduct(data.getDeltaGrad(), hDeltaGrad);
    if (deltaXdeltaGrad == 0.0) {
      throw new MathException("The dot product of the change in position and the change in gradient is zero");
    }
View Full Code Here

Examples of org.apache.mahout.math.matrix.DoubleMatrix1D

    return Math.sqrt(Algebra.norm2(x));
  }

  public void drot(DoubleMatrix1D x, DoubleMatrix1D y, double c, double s) {
    x.checkSize(y);
    DoubleMatrix1D tmp = x.copy();

    x.assign(Functions.mult(c));
    x.assign(y, Functions.plusMult(s));

    y.assign(Functions.mult(c));
View Full Code Here

Examples of org.apache.mahout.math.matrix.DoubleMatrix1D

    Property.checkSquare(A);
    int size = A.rows();
    if (size != x.size() && size != y.size()) {
      throw new IllegalArgumentException(A.toStringShort() + ", " + x.toStringShort() + ", " + y.toStringShort());
    }
    DoubleMatrix1D tmp = x.like();
    for (int i = 0; i < size; i++) {
      double sum = 0;
      for (int j = 0; j <= i; j++) {
        sum += A.getQuick(i, j) * x.getQuick(j);
      }
      for (int j = i + 1; j < size; j++) {
        sum += A.getQuick(j, i) * x.getQuick(j);
      }
      tmp.setQuick(i, alpha * sum + beta * y.getQuick(i));
    }
    y.assign(tmp);
  }
View Full Code Here

Examples of org.apache.mahout.math.matrix.DoubleMatrix1D

    int size = A.rows();
    if (size != x.size()) {
      throw new IllegalArgumentException(A.toStringShort() + ", " + x.toStringShort());
    }

    DoubleMatrix1D b = x.like();
    DoubleMatrix1D y = x.like();
    if (isUnitTriangular) {
      y.assign(1);
    } else {
      for (int i = 0; i < size; i++) {
        y.setQuick(i, A.getQuick(i, i));
      }
    }

    for (int i = 0; i < size; i++) {
      double sum = 0;
      if (!isUpperTriangular) {
        for (int j = 0; j < i; j++) {
          sum += A.getQuick(i, j) * x.getQuick(j);
        }
        sum += y.getQuick(i) * x.getQuick(i);
      } else {
        sum += y.getQuick(i) * x.getQuick(i);
        for (int j = i + 1; j < size; j++) {
          sum += A.getQuick(i, j) * x.getQuick(j);
        }
      }
      b.setQuick(i, sum);
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.