public static RealMatrix randMatrix(int rows, int cols) { RealMatrix res = MathFactory.createRealMatrix(rows, cols); for (int i = 0; i < rows; i++) { res.setRow(i, randVector(cols).getData()); } return res; }
public static RealVector randVector(int dim) { Random r = new Random(); r.setSeed(System.currentTimeMillis()); RealVector res = MathFactory.createRealVector(dim); for (int i = 0; i < dim; i++) { res.setEntry(i, r.nextDouble()); } return res; }
/* (非 Javadoc) * @see jp.ac.ritsumei.is.hpcss.cellMLonGPU.mathML.MathFactor#createCopy() */ public MathFactor createCopy() throws MathException { return MathFactory.createOperand(m_operandKind, m_strPresentText, m_dValue); }