File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # # Put comments here that give an overall description of what your
2- # # functions do
3-
4- # # Write a short comment describing this function
5-
6- # Function to cache inverse of Matrix
1+ # Function returns a list of functions which can be used to set/get data either to/from cache
72makeCacheMatrix <- function (x = matrix ()) {
83 m <- NULL # creating a variable m in global environment
94 set <- function (y ){ # This function is used to set matrix direction
@@ -16,17 +11,16 @@ makeCacheMatrix <- function(x = matrix()) {
1611 x
1712 }
1813 setInv <- function (inv ) {# Store Inverse to cache
19- m <<- inv
14+ m <<- inv # Storing data to variable in global environment
2015 }
21- getInv <- function (){
16+ getInv <- function (){ # Retrive from Cache
2217 m
2318 }
2419 list (set = set , get = get , setInv = setInv , getInv = getInv )
2520}
2621
27-
28- # # Write a short comment describing this function
29-
22+ # Function returns inverse of Matrix.
23+ # Expects matrix as input.
3024cacheSolve <- function (x , ... ) {
3125 # # Return a matrix that is the inverse of 'x'
3226 m <- x $ getInv()
You can’t perform that action at this time.
0 commit comments