Search in sources :

Example 61 with Vector

use of com.tencent.angel.ml.math2.vector.Vector in project angel by Tencent.

the class RBCompIntDoubleMatrix method diag.

@Override
public Vector diag() {
    double[] resArr = new double[rows.length];
    for (int i = 0; i < rows.length; i++) {
        if (null == rows[i]) {
            resArr[i] = 0;
        } else {
            resArr[i] = rows[i].get(i);
        }
    }
    IntDoubleDenseVectorStorage storage = new IntDoubleDenseVectorStorage(resArr);
    return new IntDoubleVector(getMatrixId(), 0, getClock(), resArr.length, storage);
}
Also used : IntDoubleDenseVectorStorage(com.tencent.angel.ml.math2.storage.IntDoubleDenseVectorStorage) IntDoubleVector(com.tencent.angel.ml.math2.vector.IntDoubleVector) CompIntDoubleVector(com.tencent.angel.ml.math2.vector.CompIntDoubleVector)

Example 62 with Vector

use of com.tencent.angel.ml.math2.vector.Vector in project angel by Tencent.

the class RBCompIntIntMatrix method diag.

@Override
public Vector diag() {
    int[] resArr = new int[rows.length];
    for (int i = 0; i < rows.length; i++) {
        if (null == rows[i]) {
            resArr[i] = 0;
        } else {
            resArr[i] = rows[i].get(i);
        }
    }
    IntIntDenseVectorStorage storage = new IntIntDenseVectorStorage(resArr);
    return new IntIntVector(getMatrixId(), 0, getClock(), resArr.length, storage);
}
Also used : IntIntVector(com.tencent.angel.ml.math2.vector.IntIntVector) CompIntIntVector(com.tencent.angel.ml.math2.vector.CompIntIntVector) IntIntDenseVectorStorage(com.tencent.angel.ml.math2.storage.IntIntDenseVectorStorage)

Example 63 with Vector

use of com.tencent.angel.ml.math2.vector.Vector in project angel by Tencent.

the class BlasDoubleMatrix method getRow.

@Override
public Vector getRow(int i) {
    double[] row = new double[numCols];
    System.arraycopy(data, i * numCols, row, 0, numCols);
    IntDoubleDenseVectorStorage storage = new IntDoubleDenseVectorStorage(row);
    return new IntDoubleVector(getMatrixId(), i, getClock(), numCols, storage);
}
Also used : IntDoubleDenseVectorStorage(com.tencent.angel.ml.math2.storage.IntDoubleDenseVectorStorage) IntDoubleVector(com.tencent.angel.ml.math2.vector.IntDoubleVector)

Example 64 with Vector

use of com.tencent.angel.ml.math2.vector.Vector in project angel by Tencent.

the class BlasDoubleMatrix method getCol.

@Override
public Vector getCol(int j) {
    double[] col = new double[numRows];
    for (int i = 0; i < numRows; i++) {
        col[i] = data[i * numCols + j];
    }
    IntDoubleDenseVectorStorage storage = new IntDoubleDenseVectorStorage(col);
    return new IntDoubleVector(getMatrixId(), 0, getClock(), numRows, storage);
}
Also used : IntDoubleDenseVectorStorage(com.tencent.angel.ml.math2.storage.IntDoubleDenseVectorStorage) IntDoubleVector(com.tencent.angel.ml.math2.vector.IntDoubleVector)

Example 65 with Vector

use of com.tencent.angel.ml.math2.vector.Vector in project angel by Tencent.

the class BlasDoubleMatrix method diag.

@Override
public Vector diag() {
    int numDiag = Math.min(numRows, numCols);
    double[] resArr = new double[numDiag];
    for (int i = 0; i < numDiag; i++) {
        resArr[i] = data[i * numRows + i];
    }
    IntDoubleDenseVectorStorage storage = new IntDoubleDenseVectorStorage(resArr);
    return new IntDoubleVector(getMatrixId(), 0, getClock(), resArr.length, storage);
}
Also used : IntDoubleDenseVectorStorage(com.tencent.angel.ml.math2.storage.IntDoubleDenseVectorStorage) IntDoubleVector(com.tencent.angel.ml.math2.vector.IntDoubleVector)

Aggregations

IntDoubleVectorStorage (com.tencent.angel.ml.math2.storage.IntDoubleVectorStorage)189 IntFloatVectorStorage (com.tencent.angel.ml.math2.storage.IntFloatVectorStorage)188 LongFloatVectorStorage (com.tencent.angel.ml.math2.storage.LongFloatVectorStorage)188 LongIntVectorStorage (com.tencent.angel.ml.math2.storage.LongIntVectorStorage)186 LongDoubleVectorStorage (com.tencent.angel.ml.math2.storage.LongDoubleVectorStorage)185 IntLongVectorStorage (com.tencent.angel.ml.math2.storage.IntLongVectorStorage)183 LongLongVectorStorage (com.tencent.angel.ml.math2.storage.LongLongVectorStorage)183 IntIntVectorStorage (com.tencent.angel.ml.math2.storage.IntIntVectorStorage)182 ObjectIterator (it.unimi.dsi.fastutil.objects.ObjectIterator)170 Storage (com.tencent.angel.ml.math2.storage.Storage)169 LongDoubleSparseVectorStorage (com.tencent.angel.ml.math2.storage.LongDoubleSparseVectorStorage)127 LongFloatSparseVectorStorage (com.tencent.angel.ml.math2.storage.LongFloatSparseVectorStorage)125 LongLongSparseVectorStorage (com.tencent.angel.ml.math2.storage.LongLongSparseVectorStorage)121 IntDoubleSparseVectorStorage (com.tencent.angel.ml.math2.storage.IntDoubleSparseVectorStorage)119 IntFloatSparseVectorStorage (com.tencent.angel.ml.math2.storage.IntFloatSparseVectorStorage)119 LongIntSparseVectorStorage (com.tencent.angel.ml.math2.storage.LongIntSparseVectorStorage)119 IntDoubleSortedVectorStorage (com.tencent.angel.ml.math2.storage.IntDoubleSortedVectorStorage)118 LongDoubleSortedVectorStorage (com.tencent.angel.ml.math2.storage.LongDoubleSortedVectorStorage)118 IntFloatSortedVectorStorage (com.tencent.angel.ml.math2.storage.IntFloatSortedVectorStorage)117 LongFloatSortedVectorStorage (com.tencent.angel.ml.math2.storage.LongFloatSortedVectorStorage)117