Package edu.ucla.sspace.vector

Examples of edu.ucla.sspace.vector.DenseVector


    @Test (expected=UnsupportedOperationException.class)
    public void testFailSetRowFull() {
        Matrix base = new ArrayMatrix(VALUES);
        Matrix scaled = new RowScaledMatrix(base, SCALE);
        scaled.setRow(0, new DenseVector(VALUES[0]));
    }
View Full Code Here


     * to {@link #rows()}
     */
    public DoubleVector getColumnVector(int column) {
        checkIndices(0, column);
        rowReadLock.lock();
        DoubleVector values = new DenseVector(rows.get());
        for (int row = 0; row < rows.get(); ++row) {
            double value = get(row, column);
            if (value != 0d)
                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 DoubleVector getColumnVectorUnsafe(int column) {
        checkIndices(0, column);
        DoubleVector values = new DenseVector(rows.get());
        for (int row = 0; row < rows.get(); ++row) {
            AtomicVector 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}
     */
    public DoubleVector getColumnVector(int column) {
        int i = 0;
        DoubleVector columnValues = new DenseVector(vectors.size());

        for (DoubleVector vector : vectors)
            columnValues.set(i++, vector.get(column));
        return columnValues;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public DoubleVector getColumnVector(int column) {
        return new DenseVector(getColumn(column));
    }
View Full Code Here

     */
    public synchronized Vector getVector(String word) {
        try {
            switch (format) {
            case TEXT:
                return new DenseVector(loadTextVector(word));
            case BINARY:
                return new DenseVector(loadBinaryVector(word));
            case SPARSE_TEXT:
                return new CompactSparseVector(loadSparseTextVector(word));
            case SPARSE_BINARY:
                return new CompactSparseVector(loadSparseBinaryVector(word));
            }
View Full Code Here

         * {@inheritDoc}
         */
        public DoubleVector getVector(String word) {
            Double score = wordScores.get(word);
            return (score == null)
                ? new DenseVector(new double[] {0})
                : new DenseVector(new double[] {score});
        }
View Full Code Here

         * {@inheritDoc}
         */
        public DoubleVector getVector(String word) {
            Double score = wordScores.get(word);
            return (score == null)
                ? new DenseVector(new double[] {0})
                : new DenseVector(new double[] {score});
        }
View Full Code Here

TOP

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

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.