Matrix

struct Matrix (
size_t H
size_t W
E
) {
E[W][H] data;
E[W][H] data;
}

Constructors

this
this(in X vals)

fill data and set dynamic size for isDynamicOne matrix

this
this(size_t iH, size_t iW, in X vals)

set size and fill data

this
this(size_t iH, size_t iW)

set size

this
this(auto ref const(Matrix!(oH, oW, X)) mtr)

Postblit

this(this)
this(this)

only: if( isDynamic )

Alias This

data

Members

Aliases

datatype
alias datatype = E
selftype
alias selftype = Matrix!(H, W, E)

Functions

T
auto T()

transponate

asArray
auto asArray()
cofactor
E cofactor(size_t i, size_t j)
col
auto col(size_t no)
det
auto det()
expandHeight
auto expandHeight(auto ref const(Matrix!(bH, bW, X)) mtr)
expandHeight
auto expandHeight(in X vals)
expandWidth
auto expandWidth(auto ref const(Matrix!(bH, bW, X)) mtr)
expandWidth
auto expandWidth(in X vals)
fill
typeof(this) fill(in E[] vals...)

fill data

fillDiag
typeof(this) fillDiag(in E[] vals...)
inv
auto inv()
opAssign
typeof(this) opAssign(auto ref const(Matrix!(bH, bW, X)) b)

only: if( isDynamic )

opBinary
auto opBinary(auto ref const(Matrix!(bH, bW, X)) mtr)
opBinary
auto opBinary(auto ref const(X) b)
opBinary
auto opBinary(auto ref const(Matrix!(bH, bW, X)) mtr)
opBinary
auto opBinary(auto ref const(Vector!(K, X)) v)
opBinaryRight
auto opBinaryRight(auto ref const(Vector!(K, X)) v)
opCast
bool opCast()
opOpAssign
typeof(this) opOpAssign(auto ref const(E) b)
opUnary
auto opUnary()
prj
Vector!(3, E) prj(in Vector!(3, X) v, E fc)

project vector

resize
typeof(this) resize(size_t nh, size_t nw)

resize dynamic matrix, new height/width must equals static height/width

row
auto row(size_t no)
rowReduceInv
auto rowReduceInv()
setCol
typeof(this) setCol(size_t no, in X vals)
setRect
typeof(this) setRect(size_t pos_row, size_t pos_col, auto ref const(Matrix!(bH, bW, X)) mtr)
setRow
typeof(this) setRow(size_t no, in X vals)
sliceHeight
auto sliceHeight(size_t start, size_t count = 0)
sliceWidth
auto sliceWidth(size_t start, size_t count = 0)
sub
auto sub(size_t[] with_rows, size_t[] with_cols)

get sub matrix

subWithout
auto subWithout(size_t[] without_rows = [], size_t[] without_cols = [])
tr
Vector!(3, E) tr(in Vector!(3, X) v, E fc)

transform vector, equals ( m * vec4( v, fc ) ).xyz

Manifest constants

height
enum height;

only: if( isStaticHeight )

width
enum width;

only: if( isStaticWidth )

Properties

height
size_t height [@property getter]

if isStaticHeight it's enum (not available to set)

height
size_t height [@property setter]

if isStaticHeight it's enum (not available to set)

offset
Vector!(3, E) offset [@property getter]
offset
Vector!(3, X) offset [@property setter]
speedTransformInv
auto speedTransformInv [@property getter]

only for transform matrix

width
size_t width [@property getter]

if isStaticWidth it's enum (not available to set)

width
size_t width [@property setter]

if isStaticWidth it's enum (not available to set)

Static functions

diag
auto diag(in X vals)

get diagonal matrix, diagonal elements fills cyclically

Variables

data
E[W][H] data;

static data ( if isNumeric!E fills valid numbers: if squred then identity matrix else zeros )

data
E[W][] data;

static width only

data
E[][H] data;

static height only

data
E[][] data;

full dynamic

isDynamic
enum bool isDynamic;

H == 0 || W == 0

isDynamicAll
enum bool isDynamicAll;

isDynamicHeight && isDynamicWidth

isDynamicHeight
enum bool isDynamicHeight;

H == 0

isDynamicOne
enum bool isDynamicOne;

isStaticWidthOnly || isStaticHeightOnly

isDynamicWidth
enum bool isDynamicWidth;

W == 0

isStatic
enum bool isStatic;

H != 0 && W != 0

isStaticHeight
enum bool isStaticHeight;

H != 0

isStaticHeightOnly
enum bool isStaticHeightOnly;

isStaticHeight && isDynamicWidth

isStaticWidth
enum bool isStaticWidth;

W != 0

isStaticWidthOnly
enum bool isStaticWidthOnly;

isStaticWidth && isDynamicHeight

Meta