File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 10
10
# # functions to get and set the matrix and inverse stored within.
11
11
12
12
makeCacheMatrix <- function (dataMatrix = matrix ()) {
13
+ # Variable for storing the matrix's inverse
13
14
inv = NULL
15
+
16
+ # Getters and setters for the stored matrix
14
17
setFunc = function (newVal ) {
15
18
dataMatrix <<- newVal
16
- inv <<- NULL
19
+ inv <<- NULL # New matrix means old inverse isn't valid anymore
17
20
}
18
21
getFunc = function () dataMatrix
22
+
23
+ # Getters and setters for the stored inverse
19
24
setInverseFunc = function (inverse ) inv <<- inverse
20
25
getInverseFunc = function () inv
26
+
27
+ # Return a list wrapper object giving access to the matrix
28
+ # and its inverse
21
29
list (set = setFunc , get = getFunc ,
22
30
setInverse = setInverseFunc , getInverse = getInverseFunc )
23
31
}
You can’t perform that action at this time.
0 commit comments