Matrix.identity constructor

Matrix.identity(
  1. int m,
  2. int n
)

Implementation

Matrix.identity(this.m, this.n) {
  for (int i = 0; i < m; i++) {
    entries.add([]);
    for (int j = 0; j < n; j++) {
      if (i == j) {
        entries[i].add(Complex(1, 0));
      } else {
        entries[i].add(Complex.zero());
      }
    }
  }
}