## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Working with matrices

As we discussed in the Working with vectors recipe, you could use the Eclipse or IntelliJ IDEA Scala worksheets for a faster turnaround time.

## How to do it...

There are a variety of functions that we have in a matrix. In this recipe, we will look at some details around:

• Creating matrices:
• Creating a matrix from values
• Creating a zero matrix
• Creating a matrix out of a function
• Creating an identity matrix
• Creating a matrix from random numbers
• Creating from a Scala collection
• Matrix arithmetic:
• Multiplication (also element-wise)
• Appending and conversion:
• Concatenating a matrix vertically
• Concatenating a matrix horizontally
• Converting a matrix of Int to a matrix of Double
• Data manipulation operations:
• Getting column vectors
• Getting row ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required