MatrixType
public protocol MatrixType : Equatable
Protocol for Matrix types.
-
The scalar value associated with each element of this matrix.
Declaration
Swift
associatedtype Scalar : DivisibleArithmetic, Real -
Gets the identity matrix for this matrix type.
Declaration
Swift
static var identity: Self { get } -
Gets the number of rows in this matrix.
Declaration
Swift
var rowCount: Int { get } -
Gets the number of columns in this matrix.
Declaration
Swift
var columnCount: Int { get } -
Gets or sets the scalar value on a given column/row in this matrix.
Declaration
Swift
subscript(column: Int, row: Int) -> Scalar { get set } -
init(rowMajorValues:Default implementation) Initializes a matrix with a flat list of values that are read in [row-major order].
The list should have at least
rowCount * columnCountelements.Precondition
values.count >= rowCount * columnCountDefault Implementation
Initializes a matrix with a flat list of values that are read in [row-major order].
The list should have at least
rowCount * columnCountelements.Precondition
values.count >= rowCount * columnCountDeclaration
Swift
init(rowMajorValues values: [Scalar]) -
init(columnMajorValues:Default implementation) Initializes a matrix with a flat list of values that are read in [column-major order].
The list should have at least
rowCount * columnCountelements.Precondition
values.count >= rowCount * columnCountDefault Implementation
Initializes a matrix with a flat list of values that are read in [column-major order].
The list should have at least
rowCount * columnCountelements.Precondition
values.count >= rowCount * columnCountDeclaration
Swift
init(columnMajorValues values: [Scalar]) -
rowMajorValues()Default implementation -
columnMajorValues()Default implementationReturns a flat array of each scalar value from this matrix ordered as a column major list.
Default Implementation
Returns a flat array of each scalar value from this matrix ordered as a column major list.
Declaration
Swift
func columnMajorValues() -> [Scalar] -
Negates (i.e. flips) the signs of all the values of this matrix.
Declaration
Swift
prefix static func - (value: Self) -> Self -
Performs a matrix addition between
lhsandrhsand returns the result.Declaration
Swift
static func + (lhs: Self, rhs: Self) -> Self -
Performs a matrix subtraction between
lhsandrhsand returns the result.Declaration
Swift
static func - (lhs: Self, rhs: Self) -> Self -
+=(_:Default implementation_: ) Performs a matrix addition between
lhsandrhsand stores the result back intolhs.Default Implementation
Performs a matrix addition between
lhsandrhsand stores the result back intolhs.Declaration
Swift
static func += (lhs: inout Self, rhs: Self) -
-=(_:Default implementation_: ) Performs a matrix subtraction between
lhsandrhsand stores the result back intolhs.Default Implementation
Performs a matrix subtraction between
lhsandrhsand stores the result back intolhs.Declaration
Swift
static func -= (lhs: inout Self, rhs: Self) -
Performs a scalar multiplication between
lhsandrhsand returns the result.Declaration
Swift
static func * (lhs: Self, rhs: Scalar) -> Self -
Performs a scalar division between the elements of
lhsandrhsand returns the result.Declaration
Swift
static func / (lhs: Self, rhs: Scalar) -> Self -
*=(_:Default implementation_: ) Performs a scalar multiplication between
lhsandrhsand stores the result back intolhs.Default Implementation
Performs a scalar multiplication between
lhsandrhsand stores the result back intolhs.Declaration
Swift
static func *= (lhs: inout Self, rhs: Scalar) -
/=(_:Default implementation_: ) Performs a scalar division between the elements of
lhsandrhsand stores the result back intolhs.Default Implementation
Performs a scalar division between the elements of
lhsandrhsand stores the result back intolhs.Declaration
Swift
static func /= (lhs: inout Self, rhs: Scalar)