use of com.tencent.angel.ml.math2.storage.IntFloatDenseVectorStorage in project angel by Tencent.
the class BlasFloatMatrix method diag.
@Override
public Vector diag() {
int numDiag = Math.min(numRows, numCols);
float[] resArr = new float[numDiag];
for (int i = 0; i < numDiag; i++) {
resArr[i] = data[i * numRows + i];
}
IntFloatDenseVectorStorage storage = new IntFloatDenseVectorStorage(resArr);
return new IntFloatVector(getMatrixId(), 0, getClock(), resArr.length, storage);
}
use of com.tencent.angel.ml.math2.storage.IntFloatDenseVectorStorage in project angel by Tencent.
the class RBCompIntFloatMatrix method diag.
@Override
public Vector diag() {
float[] resArr = new float[rows.length];
for (int i = 0; i < rows.length; i++) {
if (null == rows[i]) {
resArr[i] = 0;
} else {
resArr[i] = rows[i].get(i);
}
}
IntFloatDenseVectorStorage storage = new IntFloatDenseVectorStorage(resArr);
return new IntFloatVector(getMatrixId(), 0, getClock(), resArr.length, storage);
}
use of com.tencent.angel.ml.math2.storage.IntFloatDenseVectorStorage in project angel by Tencent.
the class RBCompLongFloatMatrix method diag.
@Override
public Vector diag() {
float[] resArr = new float[rows.length];
for (int i = 0; i < rows.length; i++) {
if (null == rows[i]) {
resArr[i] = 0;
} else {
resArr[i] = rows[i].get(i);
}
}
IntFloatDenseVectorStorage storage = new IntFloatDenseVectorStorage(resArr);
return new IntFloatVector(getMatrixId(), 0, getClock(), resArr.length, storage);
}
use of com.tencent.angel.ml.math2.storage.IntFloatDenseVectorStorage in project angel by Tencent.
the class RBLongFloatMatrix method diag.
@Override
public Vector diag() {
float[] resArr = new float[rows.length];
for (int i = 0; i < rows.length; i++) {
if (null == rows[i]) {
resArr[i] = 0;
} else {
resArr[i] = rows[i].get(i);
}
}
IntFloatDenseVectorStorage storage = new IntFloatDenseVectorStorage(resArr);
return new IntFloatVector(getMatrixId(), 0, getClock(), resArr.length, storage);
}
Aggregations