LorentzGaussMatrix constructor

LorentzGaussMatrix(List<int> rows_cols, List<double> a, List<List<double>> c, List<List<double>> w, List<List<double>> m, [ double noiseAmpl ])

c, w must be in the range (0, rows_cols0/1) Computes a matrix containing a sum of two-dimensional mixed Gauss-Lorentz shapes, consisting of 0 rows and 1 columns. a - shape amplitudes , c - shape centers, in the range 0...number rows/cols, respectively w - shape widths, in the range 0...number rows/cols, respectively m - shape mixing factors (0 <= m <= 1).

If m=1 (pure Lorentzian) then w is the "Lorentzian width". If m=0 (pure Gaussian), then w is the "Gaussian sigma".

If noiseAmpl is not null, random noise will be added to each point whose amplitude is controlled by this parameter, e.g. 0.005, as fraction of the current shape value.

Implementation

LorentzGaussMatrix(List<int> rows_cols, List<double> a, List<List<double>> c,
    List<List<double>> w, List<List<double>> m,
    [double noiseAmpl]) {
  int nrows = rows_cols[0], ncols = rows_cols[1];
  _matrix = List<Float64List>(nrows); // the matrix
  _xColCoord = Float64List(ncols); // its col coordinates
  _yRowCoord = Float64List(nrows); // its row coordinates

  int nlines = a.length;
  List<Float64List> array2D;
  for (int i = 0; i < nlines; i++) {
    array2D =
        LorentzGauss.array2D(rows_cols, a[i], c[i], w[i], m[i], noiseAmpl);
    if (i == 0) {
      _matrix = array2D;
    } else {
      _matrix = addToM(_matrix, array2D);
    }
  }

  for (int i = 0; i < nrows; i++) {
    _yRowCoord[i] = i / (nrows - 1); // normalize to 0.0 ... 1.0
    for (int k = 0; k < ncols; k++) {
      _xColCoord[k] = k / (ncols - 1); // normalize to 0.0 ... 1.0
    }
  }
}