是否可以在 OjAlgo 的 Primitive64Store 中插入 Access2D 元素?
Access2D<Double> data = Access2D.wrap(mu.toRawCopy2D());
Primitive64Store B = Primitive64Store.FACTORY.make(rows * m, columns * n);
我想在特定的起始行和起始列将数据插入 B 中。
暂时。我已经实现了这样的程序:
public class Repmat {
static public MatrixStore<Double> repmat(MatrixStore<Double> mu, int m, int n) {
long rows = mu.countRows();
long columns = mu.countColumns();
double[][] data = mu.toRawCopy2D();
Primitive64Store B = Primitive64Store.FACTORY.make(rows * m, columns * n);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
for(int k = 0; k < rows; k++) {
B.fillRow(i * rows + k, j * columns, Access1D.wrap(data[k])); // Get row from data and place it into B
}
}
}
return B.get();
}
}
但这一定是更好的方法吗?