File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 2
2
3
3
# # Makes a matrix object able to store a cache of its inverse
4
4
makeCacheMatrix <- function (x = matrix ()) {
5
- m <- NULL
5
+ i <- NULL
6
6
set <- function (y ) {
7
7
x <<- y
8
- m <<- NULL
8
+ i <<- NULL
9
9
}
10
10
get <- function () x
11
- setinverse <- function (inverse ) m <<- inverse
12
- getinverse <- function () m
11
+ setinverse <- function (inverse ) i <<- inverse
12
+ getinverse <- function () i
13
13
list (set = set , get = get ,
14
14
setinverse = setinverse ,
15
15
getinverse = getinverse )
@@ -19,14 +19,14 @@ makeCacheMatrix <- function(x = matrix()) {
19
19
# # It returns the cached version if it was already computed.
20
20
cacheSolve <- function (x , ... ) {
21
21
# # Return a matrix that is the inverse of 'x'
22
- m <- x $ getinverse()
23
- if (! is.null(m )) {
22
+ i <- x $ getinverse()
23
+ if (! is.null(i )) {
24
24
message(" getting cached data" )
25
- return (m )
25
+ return (i )
26
26
}
27
27
data <- x $ get()
28
- m <- solve(data )
29
- x $ setinverse(m )
30
- m
28
+ i <- solve(data )
29
+ x $ setinverse(i )
30
+ i
31
31
}
32
32
You can’t perform that action at this time.
0 commit comments