本文整理汇总了Java中org.apache.commons.math3.linear.RealMatrix.setColumnVector方法的典型用法代码示例。如果您正苦于以下问题:Java RealMatrix.setColumnVector方法的具体用法?Java RealMatrix.setColumnVector怎么用?Java RealMatrix.setColumnVector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.linear.RealMatrix
的用法示例。
在下文中一共展示了RealMatrix.setColumnVector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: centerKernelMatrix
import org.apache.commons.math3.linear.RealMatrix; //导入方法依赖的package包/类
private static RealMatrix
centerKernelMatrix(final RealMatrix kernelMatrix) {
// get size of kernelMatrix
final int n = kernelMatrix.getRowDimension();
// get mean values for each row/column
final RealVector columnMeans =
MatrixFunctions.columnMeans(kernelMatrix);
final double matrixMean = MatrixFunctions.mean(kernelMatrix);
RealMatrix centeredKernelMatrix = kernelMatrix.copy();
for (int k = 0; k < n; k++) {
centeredKernelMatrix.setRowVector(k,
centeredKernelMatrix.getRowVector(k).subtract(columnMeans));
centeredKernelMatrix.setColumnVector(k, centeredKernelMatrix
.getColumnVector(k).subtract(columnMeans));
}
centeredKernelMatrix = centeredKernelMatrix.scalarAdd(matrixMean);
return centeredKernelMatrix;
}
示例2: makeDataMatrix
import org.apache.commons.math3.linear.RealMatrix; //导入方法依赖的package包/类
private RealMatrix makeDataMatrix(List<double[]> X, double[] meanX) {
if (meanX == null) {
return makeDataMatrix(X);
}
final int m = X.size();
final int n = X.get(0).length;
RealMatrix M = MatrixUtils.createRealMatrix(n, m);
RealVector mean = MatrixUtils.createRealVector(meanX);
int i = 0;
for (double[] x : X) {
RealVector xi = MatrixUtils.createRealVector(x).subtract(mean);
M.setColumnVector(i, xi);
i++;
}
return M;
}
示例3: getTransformationMatrix
import org.apache.commons.math3.linear.RealMatrix; //导入方法依赖的package包/类
@Override
public RealMatrix getTransformationMatrix() {
RealMatrix cR = R.scalarMultiply(c);
RealMatrix M = MatrixUtils.createRealMatrix(n, n + 1);
M.setSubMatrix(cR.getData(), 0, 0);
M.setColumnVector(n, t);
return M;
}