File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change 44# # Write a short comment describing this function
55
66makeCacheMatrix <- function (x = matrix ()) {
7+ m <- NULL
8+ set <- function (y ) {
9+ x <<- y
10+ m <<- NULL
11+ }
12+
13+ get <- function () x
14+ setInverMatrix <- function (inverseMatrix ) m <<- inverseMatrix
15+ getInverMatrix <- function () m
716
17+ list (set = set , get = get ,
18+ setInverMatrix = setInverMatrix ,
19+ getInverMatrix = getInverMatrix )
820}
921
10-
1122# # Write a short comment describing this function
12-
1323cacheSolve <- function (x , ... ) {
14- # # Return a matrix that is the inverse of 'x'
24+
25+ # # Return a matrix that is the inverse of 'x'
26+ m <- x $ getInverMatrix()
27+ if (! is.null(m )) {
28+ message(" getting cached Matrix" )
29+ return (m )
30+ }
31+ data <- x $ get()
32+ m <- solve(data , ... )
33+ x $ setInverMatrix(m )
34+ m
1535}
36+
You can’t perform that action at this time.
0 commit comments