array2D method
Returns a matrix containing a two-dimensional mixed Gauss-Lorentz shape
consisting of 0
rows and 1
columns
Check method array1D for the other parameters. However, c
, w
, m
are arrays of length 2.
c
, w
must be in the range (0, rows_cols0/1
)
Implementation
static List<Float64List> array2D(List<int> rows_cols, double a,
List<double> c, List<double> w, List<double> m, double noiseAmpl,
[double fGauss, double fLorentz]) {
LorentzGauss lg = LorentzGauss.fromPars(a, c, w, m, fGauss, fLorentz);
int nrows = rows_cols[0], ncols = rows_cols[1];
List<Float64List> matrix = List(nrows);
math.Random rand = math.Random();
for (int i = 0; i < nrows; i++) {
Float64List currow = Float64List(ncols);
for (int k = 0; k < ncols; k++) {
double zval = lg.getValueAt([i.toDouble(), k.toDouble()]);
if (noiseAmpl != null) {
double noise = (2 * rand.nextDouble() - 1.0) * zval * noiseAmpl;
zval += noise;
}
currow[k] = zval;
}
matrix[i] = currow;
}
return matrix;
}