/** * Construct and returns a new 1-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix2D</tt> the new matrix must be of type <tt>DenseDoubleMatrix1D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix2D</tt> the new matrix must be of type <tt>SparseDoubleMatrix1D</tt>, etc. * * @param size the number of cells the matrix shall have. * @return a new matrix of the corresponding dynamic type. */ public DoubleMatrix1D like1D(int size) { return new DenseDoubleMatrix1D(size); } /**
/** * Construct and returns a new 1-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix2D</tt> the new matrix must be of type <tt>DenseDoubleMatrix1D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix2D</tt> the new matrix must be of type <tt>SparseDoubleMatrix1D</tt>, etc. * * @param size the number of cells the matrix shall have. * @return a new matrix of the corresponding dynamic type. */ public DoubleMatrix1D like1D(int size) { return new DenseDoubleMatrix1D(size); } /**
/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified size. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix1D</tt> the new matrix must also be of type <tt>DenseDoubleMatrix1D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix1D</tt> the new matrix must also be of type <tt>SparseDoubleMatrix1D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @param size the number of cell the matrix shall have. * @return a new empty matrix of the same dynamic type. */ public DoubleMatrix1D like(int size) { return new DenseDoubleMatrix1D(size); } /**
/** * Construct and returns a new 1-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix2D</tt> the new matrix must be of type <tt>DenseDoubleMatrix1D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix2D</tt> the new matrix must be of type <tt>SparseDoubleMatrix1D</tt>, etc. * * @param size the number of cells the matrix shall have. * @return a new matrix of the corresponding dynamic type. */ public DoubleMatrix1D like1D(int size) { return new DenseDoubleMatrix1D(size); } /**
public void initialize() { disp = new DenseDoubleMatrix1D(2); distance = 0; visited = false; }
/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified size. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix1D</tt> the new matrix must also be of type <tt>DenseDoubleMatrix1D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix1D</tt> the new matrix must also be of type <tt>SparseDoubleMatrix1D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @param size the number of cell the matrix shall have. * @return a new empty matrix of the same dynamic type. */ public DoubleMatrix1D like(int size) { return new DenseDoubleMatrix1D(size); } /**
/** * Construct and returns a new 1-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix2D</tt> the new matrix must be of type <tt>DenseDoubleMatrix1D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix2D</tt> the new matrix must be of type <tt>SparseDoubleMatrix1D</tt>, etc. * * @param size the number of cells the matrix shall have. * @return a new matrix of the corresponding dynamic type. */ public DoubleMatrix1D like1D(int size) { return new DenseDoubleMatrix1D(size); } /**
/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified size. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix1D</tt> the new matrix must also be of type <tt>DenseDoubleMatrix1D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix1D</tt> the new matrix must also be of type <tt>SparseDoubleMatrix1D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @param size the number of cell the matrix shall have. * @return a new empty matrix of the same dynamic type. */ public DoubleMatrix1D like(int size) { return new DenseDoubleMatrix1D(size); } /**
/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified size. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix1D</tt> the new matrix must also be of type <tt>DenseDoubleMatrix1D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix1D</tt> the new matrix must also be of type <tt>SparseDoubleMatrix1D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @param size the number of cell the matrix shall have. * @return a new empty matrix of the same dynamic type. */ public DoubleMatrix1D like(int size) { return new DenseDoubleMatrix1D(size); } /**
/** * Construct and returns a new 1-d matrix <i>of the corresponding dynamic type</i>, sharing the same cells. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix2D</tt> the new matrix must be of type <tt>DenseDoubleMatrix1D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix2D</tt> the new matrix must be of type <tt>SparseDoubleMatrix1D</tt>, etc. * * @param size the number of cells the matrix shall have. * @param zero the index of the first element. * @param stride the number of indexes between any two elements, i.e. <tt>index(i+1)-index(i)</tt>. * @return a new matrix of the corresponding dynamic type. */ protected DoubleMatrix1D like1D(int size, int zero, int stride) { return new DenseDoubleMatrix1D(size,this.elements,zero,stride); } /**
/** * Construct and returns a new 1-d matrix <i>of the corresponding dynamic type</i>, sharing the same cells. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix2D</tt> the new matrix must be of type <tt>DenseDoubleMatrix1D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix2D</tt> the new matrix must be of type <tt>SparseDoubleMatrix1D</tt>, etc. * * @param size the number of cells the matrix shall have. * @param zero the index of the first element. * @param stride the number of indexes between any two elements, i.e. <tt>index(i+1)-index(i)</tt>. * @return a new matrix of the corresponding dynamic type. */ protected DoubleMatrix1D like1D(int size, int zero, int stride) { return new DenseDoubleMatrix1D(size,this.elements,zero,stride); } /**
/** */ public static void testMax() { double[] temp = new double[2]; temp[0] = 8.9; temp[1] = 1; DenseDoubleMatrix1D d1Double = new DenseDoubleMatrix1D(temp); // hep.aida.bin.DynamicBin1D d1ynamicBin = cern.colt.matrix.doublealgo.Statistic.bin(d1Double); // double max = d1ynamicBin.max(); //FIXME: Should this test exist without hep.aida System.out.println("FIXME: Should this test exist without hep.aida"); // System.out.println("max = "+ max); } }
/** */ public static void testMax() { double[] temp = new double[2]; temp[0] = 8.9; temp[1] = 1; DenseDoubleMatrix1D d1Double = new DenseDoubleMatrix1D(temp); // hep.aida.bin.DynamicBin1D d1ynamicBin = cern.colt.matrix.doublealgo.Statistic.bin(d1Double); // double max = d1ynamicBin.max(); //FIXME: Should this test exist without hep.aida System.out.println("FIXME: Should this test exist without hep.aida"); // System.out.println("max = "+ max); } }
/** * Constructs a matrix with the given cell values. * The values are copied. So subsequent changes in <tt>values</tt> are not reflected in the matrix, and vice-versa. * * @param values The values to be filled into the new matrix. */ public DoubleMatrix1D make(double[] values) { if (this==sparse) return new SparseDoubleMatrix1D(values); else return new DenseDoubleMatrix1D(values); } /**
/** * Constructs a matrix with the given shape, each cell initialized with zero. */ public DoubleMatrix1D make(int size) { if (this==sparse) return new SparseDoubleMatrix1D(size); return new DenseDoubleMatrix1D(size); } /**
/** * Constructs a matrix with the given shape, each cell initialized with zero. */ public DoubleMatrix1D make(int size) { if (this==sparse) return new SparseDoubleMatrix1D(size); return new DenseDoubleMatrix1D(size); } /**
/** * Constructs a matrix with the given cell values. * The values are copied. So subsequent changes in <tt>values</tt> are not reflected in the matrix, and vice-versa. * * @param values The values to be filled into the new matrix. */ public DoubleMatrix1D make(double[] values) { if (this==sparse) return new SparseDoubleMatrix1D(values); else return new DenseDoubleMatrix1D(values); } /**
/** */ public static void doubleTest30() { double[][] data = { { 6, 5 }, { 7, 6 }, }; double[] x = { 1, 2 }; double[] y = { 3, 4 }; DoubleMatrix2D A = new DenseDoubleMatrix2D(data); SeqBlas.seqBlas.dger(1,new DenseDoubleMatrix1D(x), new DenseDoubleMatrix1D(y), A); System.out.println(A); } /**
DoubleMatrix1D a = new DenseDoubleMatrix1D(new double[]{1,0.5}}); DoubleMatrix1D b = new DenseDoubleMatrix1D(new double[]{0.5,1}}); double cosineDistance = a.zDotProduct(b)/Math.sqrt(a.zDotProduct(a)*b.zDotProduct(b))
public static TetradMatrix multOuter(TetradVector v1, TetradVector v2) { DoubleMatrix2D m = new Algebra().multOuter(new DenseDoubleMatrix1D(v1.toArray()), new DenseDoubleMatrix1D(v2.toArray()), null); return new TetradMatrix(m.toArray()); }