zmath.matrix

Defines a squared Matrix with column-major ordering from 2x2 to 4x4 size

  • Declaration

    alias Mat2f = Matrix!(float, 2LU).Matrix;

    2D squared matrix of floats

  • Declaration

    alias Mat3f = Matrix!(float, 3LU).Matrix;

    3D squared matrix of floats

  • Declaration

    alias Mat4f = Matrix!(float, 4LU).Matrix;

    4D squared matrix of floats

  • Declaration

    alias Mat2d = Matrix!(double, 2LU).Matrix;

    2D squared matrix of doubles

  • Declaration

    alias Mat3d = Matrix!(double, 3LU).Matrix;

    3D squared matrix of doubles

  • Declaration

    alias Mat4d = Matrix!(double, 4LU).Matrix;

    4D squared matrix of doubles

  • Declaration

    alias Mat2r = Matrix!(real, 2LU).Matrix;

    2D squared matrix of reals

  • Declaration

    alias Mat3r = Matrix!(real, 3LU).Matrix;

    3D squared matrix of reals

  • Declaration

    alias Mat4r = Matrix!(real, 4LU).Matrix;

    4D squared matrix of reals

  • Declaration

    struct Matrix(T, size_t dim_) if (__traits(isFloating, T) && (dim_ >= 2) && (dim_ <= 4));

    Defines a squared Matrix of n = 2, 3 or 4 size, like a linear array of numbers in a row-major order

    • dim

      Declaration

      static enum size_t dim;

      Matrix Dimension

    • Declaration

      static enum size_t cells;

      Matrix number of cells

    • Declaration

      static enum Matrix!(T, 2) ZERO;

      Zero R2 matrix

    • Declaration

      static enum Matrix!(T, 2) IDENTITY;

      Identity R2 matrix

    • Declaration

      const pure @nogc T opIndex(size_t row, size_t col);

      Returns i, j cell

    • Declaration

      @nogc void opIndexAssign(K)(K val, size_t row, size_t col) if (is(K : real));

      Assigns a new cell value

    • Declaration

      const pure @nogc VRow opIndex(size_t i);

      Returns i row vector

    • Declaration

      @nogc void opIndexAssign(K)(K v, size_t i) if (isVector!K);

      Assigns a new row vector

    • Declaration

      const pure @nogc bool opEquals()(auto ref const Matrix rhs);

      Define Equality

    • Declaration

      const pure @nogc bool approxEqual()(auto ref const Matrix rhs, T maxRelDiff = 0.01, T maxAbsDiff = 1e-05);

      Approximated equality

    • Declaration

      const pure @nogc Matrix opUnary(string op)() if (op == "+" || op == "-");

      Define unary operators + and -

    • Declaration

      const pure @nogc Matrix opBinary(string op)(auto ref const Matrix rhs) if ((op == "+" || op == "-") && (dim >= 2) && (dim <= 4));

      Define binary operator + and -

    • Declaration

      const pure @nogc Matrix opBinary(string op)(in real rhs) if (op == "*" || op == "/");

      Define Scalar multiplication

    • Declaration

      const pure @nogc Matrix opBinaryRight(string op)(in real rhs) if (op == "*" || op == "/");

      Define Scalar multiplication

    • Declaration

      const pure @nogc Matrix opBinary(string op)(auto ref const Matrix rhs) if (op == "*");

      Define Matrix Product

    • Declaration

      const pure @nogc VCol opBinary(string op)(auto ref const VRow rhs) if (op == "*");

      Define Matrix x Vector

    • Declaration

      const pure @nogc VCol opBinaryRight(string op)(auto ref const VCol lhs) if (op == "*");

      Define Vector x Matrix

    • Declaration

      const pure @nogc Matrix transpose();

      Returns transposed matrix

      Discussion

      It can be used to "convert" Matrix to a row ordered matrix

    • Declaration

      const pure @nogc T determinant();

      Returns Determinant of this matrix

    • Declaration

      const pure @nogc Matrix inverse();

      Calcs this matrix inverse

      Return Value

      A matrix full of NaNs if this matrix isn't inverible (!isOk =1)

    • Declaration

      const pure @nogc bool isOk();

      Checks that the matrix not have a weird NaN value

    • Declaration

      const pure @nogc bool isFinite();

      Checks that the matrix have finite values

    • ptr

      Declaration

      pure nothrow @nogc @property T* ptr();

      Return a pointer of the internal array

    • Declaration

      const pure @nogc Tout opCast(Tout)() if (isMatrix!Tout && (Tout.dim >= dim));

      Casting operation that allow convert between Matrix types

    • Declaration

      const string toString();

      Returns a visual representation of this matrix

  • Declaration

    immutable bool isMatrix(T);

    Say if a thing it's a Matrix