File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
- # # Pair of function that compute/cache the inverse of a matrix.
1
+ # # Pair of functions that compute/cache the inverse of a matrix.
2
+ # # (Or, more generally, computes/caches the result of the solve() function.)
2
3
3
4
# # This function creates a special "matrix" object that can cache its inverse.
4
5
makeCacheMatrix <- function (x = matrix ()) {
5
6
s <- NULL
6
- setMatrix <- function (y ) {
7
+ set <- function (y ) {
7
8
x <<- y
8
9
s <<- NULL
9
10
}
10
- getMatrix <- function () x
11
+ get <- function () x
11
12
setSolve <- function (sol ) s <<- sol
12
13
getSolve <- function () s
13
- list (setMatrix = setMatrix , getMatrix = getMatrix ,
14
+ list (set = set , get = get ,
14
15
setSolve = setSolve , getSolve = getSolve )
15
16
16
17
}
@@ -27,7 +28,7 @@ cacheSolve <- function(x, ...) {
27
28
message(" getting cached data" )
28
29
return (s )
29
30
}
30
- data <- x $ getMatrix ()
31
+ data <- x $ get ()
31
32
s <- solve(data , ... )
32
33
x $ setSolve(s )
33
34
s
You can’t perform that action at this time.
0 commit comments