1 package baseCode.dataStructure.matrix;
2
3
4 /***
5 * Use this class when fast iteration over the matrix is of primary interest. The primary change
6 * is that getQuick is faster, and toArray returns the actual elements, not a copy. The latter
7 * is an important change to the contract of DouleMatrix1D, the former might have some unintended consequences
8 * because it hasn't been tested thoroughly.
9 *
10 * <hr>
11 * <p>Copyright (c) 2004 Columbia University
12 * @author pavlidis
13 * @version $Id: DenseDoubleMatrix1D.java,v 1.3 2004/08/17 21:17:41 pavlidis Exp $
14 */
15 public class DenseDoubleMatrix1D extends
16 cern.colt.matrix.impl.DenseDoubleMatrix1D {
17
18 /***
19 * @param size
20 * @param elements
21 * @param zero
22 * @param stride
23 */
24 protected DenseDoubleMatrix1D( int size, double[] elements, int zero, int stride ) {
25 super( size, elements, zero, stride );
26 }
27
28 /***
29 * @param values
30 */
31 public DenseDoubleMatrix1D( double[] values ) {
32 super( values );
33 }
34
35 /***
36 * @param size
37 */
38 public DenseDoubleMatrix1D( int size ) {
39 super( size );
40 }
41
42
43
44 /***
45 * This is an optimized version of getQuick. Implementation note: the superclass uses an add and a multiply.
46 * This is faster, but there might be unforseen consequences...
47 *
48 * @see cern.colt.matrix.DoubleMatrix1D#getQuick(int)
49 */
50 public double getQuick(int i) {
51 return elements[i];
52 }
53
54
55 /***
56 * WARNING unlike the superclass, this returns the actual underlying array, not a copy.
57 *
58 * @return the elements
59 * @see cern.colt.matrix.DoubleMatrix1D#toArray()
60 */
61 public double[] toArray() {
62 return elements;
63 }
64
65 }