Vector and matrix operations
Matrix operation is one of the most commonly used mathematical operations that we perform during data processing and data analysis. All of the matrix operations must be conformable for the operation, mathematically.
The following are the rules that must be followed for matrix operations:
- Addition or subtraction rule: There should be at least two vectors, or matrices with the same dimensions
- Multiplication rule: There should be at least two vectors or matrices with number of columns of first matrix should be same as the number of rows in second one
- Element wise multiplication: For element wise multiplication, both matrices must be of the same dimension
The following is the R code to perform matrix operations: