Skip to content

Instantly share code, notes, and snippets.

@jknthn
Last active September 28, 2017 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jknthn/5f3a15a291ca375cf4d8372fcd6b0b3f to your computer and use it in GitHub Desktop.
Save jknthn/5f3a15a291ca375cf4d8372fcd6b0b3f to your computer and use it in GitHub Desktop.
import Matswift
let matrix1 = Matrix(values: [[2.0, 1.0], [3.0, 1.0]])
let matrix2 = Matrix(values: [[1.0, 3.0], [2.0, 4.0]])
let multiplication = matrix1 * matrix2
let division = matrix1 / matrix2
let addition = matrix1 + matrix2
let subtraction = matrix1 - matrix2
let scalarAddition = 2.0 + matrix1
let scalarMultiplication = matrix1 * 3.0
let dotProduct = matrix1.dot(matrix2)
let sum = matrix1.sum()
let transposed = matrix1.T
let log = matrix1.log()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment