File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
- # # Put comments here that give an overall description of what your
2
- # # functions do
1
+ # # Matrix inversion is usually a costly computation and their may be some
2
+ # # benefit to caching the inverse of a matrix rather than compute it
3
+ # # repeatedly. This assignment is to write a pair of functions that cache
4
+ # # the inverse of a matrix.
3
5
4
- # # Write a short comment describing this function
6
+ # # This function creates a special "matrix" object that can cache its inverse.
5
7
6
8
makeCacheMatrix <- function (x = matrix ()) {
9
+
7
10
i <- NULL
11
+
8
12
set <- function (y ) {
9
13
x <<- y
10
14
i <<- NULL
@@ -18,7 +22,10 @@ makeCacheMatrix <- function(x = matrix()) {
18
22
}
19
23
20
24
21
- # # Write a short comment describing this function
25
+ # # This function computes the inverse of the special "matrix" returned by
26
+ # # makeCacheMatrix above. If the inverse has already been calculated (and the
27
+ # # matrix has not changed), then the cachesolve should retrieve the inverse
28
+ # # from the cache.
22
29
23
30
cacheSolve <- function (x , ... ) {
24
31
# # Return a matrix that is the inverse of 'x'
You can’t perform that action at this time.
0 commit comments