Last active
August 3, 2016 03:40
-
-
Save wircho/683e84148a7bc06128215e2db30b3d2e to your computer and use it in GitHub Desktop.
SafeMatrix methods.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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