Matrix.this

Constructs Matrix from components. If no components present matrix will be filled with 0

  1. this(T val)
  2. this(T[size] vals)
    struct Matrix(T, size_t H, size_t W)
    this
    ()
    if (
    isNumeric!T &&
    W > 0
    &&
    H > 0
    )
  3. this(T[W][H] vals)
  4. this(quat q)

Examples

// Fills int matrix 2x2 with 1 auto m0 = Matrix!(int, 2, 2)(1); // Fills int matrix 2x2 with [[1, 2], [3, 4]] auto m1 = Matrix!(int, 2, 2)(1, 2, 3, 4); // Same auto m2 = Matrix!(int, 2, 2)([[1, 2], [3, 4]]); // Same mat2 m3 = [1, 2, 3, 4]; // Same mat2 m4 = [[1, 2], [3, 4]]; // Also you can construct matrix by // assigning values directly mat!(2, 3) m5 = [[1, 2, 3], [4, 5, 6]];

Meta