Skip to content

Instantly share code, notes, and snippets.

@bitsnaps
Created June 21, 2019 20:47
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 bitsnaps/8de516d8ee7c601bf003c0cf6debb230 to your computer and use it in GitHub Desktop.
Save bitsnaps/8de516d8ee7c601bf003c0cf6debb230 to your computer and use it in GitHub Desktop.
Matrix manipulation with groovy by graxxia library
@Grab('org.graxxia:graxxia:1.0.1')
import graxxia.*
def m = new Matrix([[3,4,5],[6,2,3]])
println(m)
def m1 = [[1,2,3],[2,6,3],[7,4,2]] as Matrix
def m2 = [[2,6,4],[2,3,5],[7,6,5]] as Matrix
def m3 = [[2,3,4],[8,6,2],[10,4,3]] as Matrix
println(m1*2)
println(m1+m2)
def m4 = (m1+m2/m3) as Matrix
// you can try this on Groovy Notebook (beakerX hosted by mybinder.org)
//https://hub.gke.mybinder.org/user/twosigma-beakerx-t6rwva2p/notebooks/doc/groovy/Groovy.ipynb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment