Skip to content

Instantly share code, notes, and snippets.

@wircho
Last active August 3, 2016 03:40
Show Gist options
  • Save wircho/683e84148a7bc06128215e2db30b3d2e to your computer and use it in GitHub Desktop.
Save wircho/683e84148a7bc06128215e2db30b3d2e to your computer and use it in GitHub Desktop.
SafeMatrix methods.
/*
* MatrixSetup.swift (continued #3)
*/
// MARK: SafeMatrix methods
extension SafeMatrixProtocol where MatrixType == Matrix {
func transpose() throws -> SafeMatrix<Matrix,Columns,Rows> {
return try SafeMatrix(matrix: matrix.transpose())
}
}
extension SafeMatrixProtocol where MatrixType == Matrix, Rows == Columns {
func inverse() throws -> Self {
return try Self(matrix: matrix.inverse())
}
func determinant() -> Double {
return matrix.determinant()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment