Package edu.ucla.sspace.util

Examples of edu.ucla.sspace.util.SparseDoubleArray$SparseDoubleArrayIterator


    /**
     * Creates a {@code CompactSparseVector} that grows to the maximum size set
     * by {@link Double#MAX_VALUE}.
     */
    public CompactSparseVector() {
        vector = new SparseDoubleArray();
        magnitude = 0;
    }
View Full Code Here


     * non-zero values.
     *
     * @param length The length of this {@code CompactSparseVector}.
     */
    public CompactSparseVector(int length) {
        vector = new SparseDoubleArray(length);
        magnitude = 0;
    }
View Full Code Here

     * zero entries.
     *
     * @param array The double array to produce a sparse vector from.
     */
    public CompactSparseVector(double[] array) {
        vector = new SparseDoubleArray(array);
        magnitude = -1;
    }
View Full Code Here

        int length = v.length();
        int[] nz = v.getNonZeroIndices();
        double[] values = new double[nz.length];
        for (int i = 0; i < nz.length; ++i)
            values[i] = v.get(nz[i]);
        vector = new SparseDoubleArray(nz, values, length);
        magnitude = -1;
    }
View Full Code Here

     *        have different lengths or if {@code indices} contains duplicate
     *        elements or those not in sorted order
     */
    public CompactSparseVector(int[] nonZeroIndices, double[] values,
                               int length) {
        vector = new SparseDoubleArray(nonZeroIndices, values, length);
        magnitude = -1;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void set(double[] values) {
        vector = new SparseDoubleArray(values);
        magnitude = -1;
    }
View Full Code Here

    public static void testSparseArrayBuild(MatrixBuilder builder,
                                            Matrix m,
                                            boolean transposed) {
            // Write the matrix to the file using the given builder.
            for (int r = 0; r < m.rows(); ++r)
                builder.addColumn(new SparseDoubleArray(m.getRow(r)));
            builder.finish();

            if (transposed)
                checkMatrixTransposed(builder, m);
            else
View Full Code Here

TOP

Related Classes of edu.ucla.sspace.util.SparseDoubleArray$SparseDoubleArrayIterator

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.