File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
# # Put comments here that give an overall description of what your
2
2
# # functions do
3
3
4
- # # Write a short comment describing this function
4
+ # # Using a function call to create space to cache a matrix's inverse.
5
+ # # Functions to access that space are created: (get, set, getinv, setinv)
5
6
6
7
makeCacheMatrix <- function (x = matrix ()) {
7
-
8
+ i <- NULL # initialize variable to store inverse
9
+ set <- function (y ) {
10
+ # assign a matrix to this CacheMatrix
11
+ x <<- y
12
+ m <<- NULL
13
+ }
14
+ get <- function () x # get the matrix currently in this CacheMatrix
15
+ setinv <- function (inv ) i <<- inv # assign an inverse to this CacheMatrix
16
+ getinv <- function () i # get the inverse currently in this CacheMatrix
17
+ list (set = set , get = get , setinv = setinv , getinv = getinv )
8
18
}
9
19
10
20
11
- # # Write a short comment describing this function
21
+ # # Computes the inverse of a makeCacheMatrix 'matrix'. If the inverse has been
22
+ # #cached, it retrieves it.
12
23
13
24
cacheSolve <- function (x , ... ) {
14
25
# # Return a matrix that is the inverse of 'x'
You can’t perform that action at this time.
0 commit comments