Package edu.ucla.sspace.vector

Examples of edu.ucla.sspace.vector.SparseHashDoubleVector


    /**
     * {@inheritDoc}
     */
    @Override public SparseDoubleVector getColumnVector(int column) {
        SparseHashDoubleVector col = new SparseHashDoubleVector(rows);
        for (int r = 0; r < rows(); ++r)
            col.set(r, getRowVector(r).get(column));
        return col;
    }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public SparseDoubleVector getColumnVector(int column) {
        int rows = rows();
        SparseDoubleVector v = new SparseHashDoubleVector(rows);
        for (int row = 0; row < rows; ++row) {
            double d = get(row, column);
            if (d != 0)
                v.set(row, d);
        }
        return v;
    }
View Full Code Here

     * to {@link #rows()}
     */
    public SparseDoubleVector getColumnVector(int column) {
        checkIndices(0, column);
        rowReadLock.lock();
        SparseDoubleVector values = new SparseHashDoubleVector(rows.get());
        for (int row = 0; row < rows.get(); ++row) {
            AtomicSparseVector rowEntry = getRow(row, -1, false);           
            double value = 0;
            if (rowEntry != null && (value = rowEntry.get(column)) != 0)
                values.set(row, value);
        }
        rowReadLock.unlock();
        return values;
    }
View Full Code Here

     * cases where the vector is being accessed at a time when the matrix (or
     * this particular row) will not be modified.
     */
    public SparseDoubleVector getColumnVectorUnsafe(int column) {
        checkIndices(0, column);
        SparseDoubleVector values = new SparseHashDoubleVector(rows.get());
        for (int row = 0; row < rows.get(); ++row) {
            AtomicSparseVector rowEntry = getRow(row, -1, false);           
            double value = 0;
            if (rowEntry != null && (value = rowEntry.get(column)) != 0)
                values.set(row, value);
        }
        return values;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override public SparseDoubleVector getColumnVector(int column) {
        int rows = rows();
        SparseHashDoubleVector col = new SparseHashDoubleVector(rows);
        for (int r = 0; r < rows; ++r)
            col.set(r, get(r, column));
        return col;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override public SparseDoubleVector getRowVector(int row) {
        int cols = columns();
        SparseHashDoubleVector rowVec = new SparseHashDoubleVector(cols);
        for (int c = 0; c < cols; ++c)
            rowVec.set(c, get(row, c));
        return rowVec;
    }
View Full Code Here

     * {@inheritDoc}
     */
    public SparseDoubleVector getColumnVector(int column) {
        checkIndices(0, column);
        SparseDoubleVector columnValues =
            new SparseHashDoubleVector(values.length);
        columnValues.set(column, values[column]);
        return columnValues;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public SparseDoubleVector getRowVector(int row) {
        checkIndices(row, 0);
        SparseDoubleVector vector = new SparseHashDoubleVector(values.length);
        vector.set(row, values[row]);
        return vector;
    }
View Full Code Here

TOP

Related Classes of edu.ucla.sspace.vector.SparseHashDoubleVector

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.