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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations