Structurefwcd.swift-utils 4.6.2Utils
Matrix
Matrix.swift:5struct Matrix<T> where T : ExpressibleByIntegerLiteral, T : Hashable, T : Absolutable, T : Addable, T : Divisible, T : Multipliable, T : Negatable, T : Subtractable
struct Matrix<T> where T : ExpressibleByIntegerLiteral, T : Hashable, T : Absolutable, T : Addable, T : Divisible, T : Multipliable, T : Negatable, T : Subtractable
import Utils
protocol ExpressibleByIntegerLiteral
A type that can be initialized with an integer literal.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Absolutable
protocol Addable
protocol Divisible
protocol Multipliable
protocol Negatable
Describes a (signed) type that has an additive inverse.
protocol Subtractable
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
init(_ rows: [[T]])
init(columnVector values: [T])
init(repeating value: T, width: Int, height: Int)
init(rowVector values: [T])
init(width: Int, height: Int, values: [T])
static func diagonal(_ diagonalValues: [T]) -> Matrix<T>
static func identity(width: Int) -> Matrix<T>
static func zero(width: Int, height: Int) -> Matrix<T>
var asArray: [[T]] { get }
var asNDArray: NDArray<T> { get }
var columnVectors: [Vector<T>] { get }
var columns: [[T]] { get }
var description: String { get }
var determinant: T? { get }
Computes the determinant using Gaussian elimination in O(n^3).
var first: T? { get }
The element in the upper left corner of the matrix.
var formattedDescription: String { get }
let height: Int
var inverse: Matrix<T>? { get }
Finds the inverse of this matrix.
var isSquare: Bool { get }
var laplaceExpansionDeterminant: T? { get }
Computes the determinant in O(n!).
var last: T? { get }
The element in the lower right corner of the matrix.
var mainDiagonal: [T]? { get }
var normalizedRowEcholonForm: Matrix<T>? { get }
The row echolon form where all leading coefficients are 1.
var rowEcholonForm: Matrix<T>? { get }
Computes a triangular matrix from this matrix through Gauss elimination.
var rowVectors: [Vector<T>] { get }
var rows: [[T]] { get }
var transpose: Matrix<T> { get }
let width: Int
subscript(x: Int, y: Int) -> T { get set }
subscript(column x: Int) -> Column { get }
subscript(row y: Int) -> Row { get }
static func * (lhs: Matrix<T>, rhs: Matrix<T>) -> Matrix<T>
static func * (lhs: Matrix<T>, rhs: T) -> Matrix<T>
static func * (lhs: T, rhs: Matrix<T>) -> Matrix<T>
static func *= (lhs: inout Matrix<T>, rhs: Matrix<T>)
static func *= (lhs: inout Matrix<T>, rhs: T)
static func + (lhs: Matrix<T>, rhs: Matrix<T>) -> Matrix<T>
static func += (lhs: inout Matrix<T>, rhs: Matrix<T>)
static func - (lhs: Matrix<T>, rhs: Matrix<T>) -> Matrix<T>
static func -= (lhs: inout Matrix<T>, rhs: Matrix<T>)
static func / (lhs: Matrix<T>, rhs: T) -> Matrix<T>
static func /= (lhs: inout Matrix<T>, rhs: T)
mutating func add(row y1: Int, toRow y2: Int, scaledBy factor: T)
func leadingCoefficient(_ y: Int) -> T
func map<U>(_ f: (T) throws -> U) rethrows -> Matrix<U> where U : ExpressibleByIntegerLiteral, U : Hashable, U : Absolutable, U : Addable, U : Divisible, U : Multipliable, U : Negatable, U : Subtractable
mutating func mapInPlace(_ f: (T) throws -> T) rethrows
func minor(_ y: Int, _ x: Int) -> Matrix<T>
func reshaped(width: Int, height: Int) -> Matrix<T>
mutating func scale(row y: Int, by factor: T)
func with(_ value: T, atY y: Int, x: Int) -> Matrix<T>
func zip<U>(_ rhs: Matrix<T>, with f: (T, T) throws -> U) rethrows -> Matrix<U> where U : ExpressibleByIntegerLiteral, U : Hashable, U : Absolutable, U : Addable, U : Divisible, U : Multipliable, U : Negatable, U : Subtractable
mutating func zipInPlace(_ rhs: Matrix<T>, with f: (T, T) throws -> T) rethrows
struct Column
struct Row
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
protocol Sendable