Assingment2 - rupakgautam/ProgrammingAssignment2 GitHub Wiki
Cachematrix <- function(x = matrix()) { m <- NULL set <- function(y) { x <<- y mtx<<- NULL } get <- function() x setinverse <- function(inverse) mtx <<- inverse getinverse <- function() m list(set = set, get = get, setinverse = setinverse, getinverse = getinverse) } cacheSolve <- function(x, ...) { mtx<- x$getinverse() if(!is.null(mtx)) {
return(mtx)
}
data <- x$get()
mtx <- solve(data, ...)
x$setinverse(mtx)
mtx
}