File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change 1
1
# Matrix inversion is usually a costly computation and their may be some benefit
2
2
# to caching the inverse of a matrix rather than compute it repeatedly
3
3
4
- # This function creates a special "matrix" object that can cache its inverse.
5
-
6
4
makeCacheMatrix <- function (x = matrix ()) {
5
+ # This function creates a special "matrix" object that can cache its inverse.
7
6
i <- NULL
8
7
set <- function (y ) {
9
8
x <<- y
@@ -15,14 +14,11 @@ makeCacheMatrix <- function(x = matrix()) {
15
14
list (set = set , get = get , setinverse = setinverse , getinverse = getinverse )
16
15
}
17
16
18
-
19
- # This function computes the inverse of the special "matrix" returned by
20
- # makeCacheMatrix above. If the inverse has already been calculated (and the
21
- # matrix has not changed), then the cachesolve should retrieve the inverse from
22
- # the cache.
23
-
24
17
cacheSolve <- function (x , ... ) {
25
- # # Return a matrix that is the inverse of 'x'
18
+ # This function computes the inverse of the special "matrix" returned by
19
+ # makeCacheMatrix above. If the inverse has already been calculated (and the
20
+ # matrix has not changed), then the cachesolve should retrieve the inverse from
21
+ # the cache.
26
22
i <- x $ getinverse()
27
23
if (! is.null(i )) {
28
24
message(" gettting cached data" )
You can’t perform that action at this time.
0 commit comments