File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 5
5
# # functions for getting and setting the matrix and its inverse.
6
6
7
7
makeCacheMatrix <- function (x = matrix ()) {
8
+ # Initialize the inverse of x to NULL.
8
9
inv <- NULL
10
+
11
+ # get and set functions for the matrix x.
12
+ # The set function also sets the inverse of x
13
+ # to NULL, to invalidate any previously cached
14
+ # inverse.
9
15
set <- function (y ) {
10
16
x <<- y
11
17
inv <<- NULL
12
18
}
13
19
get <- function () x
20
+
21
+ # get and set functions for the inverse of
22
+ # the matrix x.
14
23
setinv <- function (minv ) inv <<- minv
15
24
getinv <- function () inv
25
+
26
+ # Return a simple object (list) containing the
27
+ # get and set functions for a matrix and its
28
+ # inverse.
16
29
list (set = set , get = get , setinv = setinv , getinv = getinv )
17
30
}
18
31
You can’t perform that action at this time.
0 commit comments