forked from rdpeng/ProgrammingAssignment2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcachematrix.R
More file actions
19 lines (17 loc) · 749 Bytes
/
Copy pathcachematrix.R
File metadata and controls
19 lines (17 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
## Caching the Inverse of a Matrix
## This function creates a special "matrix" object that can cache its inverse
makeCacheMatrix <- function(x = matrix()) {
obj <- NULL
setCache <- function(y) {
x <<- y
obj <<- NULL
}
## This function computes the inverse of the special "matrix" returned by makeCacheMatrix above.
##If the inverse has already been calculated (and the matrix has not changed), then cacheSolve should retrieve the inverse from the cache
cacheSolve <- function() x
setCacheInverse <- function() obj <<- solve(x) ## Returns a matrix that is the inverse of 'x'
getCacheInverse <- function() obj
list(setCache = setCache, cacheSolve = cacheSolve,
setCacheInverse = setCacheInverse,
getCacheInverse = getCacheInverse)
}