File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-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
- # # functions do
2
+ # # makeCacheMatrix create a special matrix that keeps its cache
3
+ # # cacheSolve knows to check cache first, otherwise do the expensive
4
+ # # computation
3
5
4
- # # Write a short comment describing this function
6
+ # # makeCacheMatrix has the following functions
7
+ # # get: returns matrix
8
+ # # set: sets the matrix
9
+ # # setinv: sets the inverse
10
+ # # getinv: returns the inverse
5
11
6
12
makeCacheMatrix <- function (x = matrix ()) {
7
13
inv <- NULL
@@ -18,7 +24,11 @@ makeCacheMatrix <- function(x = matrix()) {
18
24
}
19
25
20
26
21
- # # Write a short comment describing this function
27
+ # # cacheSolve has the following logic
28
+ # # It first checks if the matrix has a precomputed cache
29
+ # # if so, this is returned. If not, the "expensive"
30
+ # # solve() function is called. The inversed matrix
31
+ # # is cached and returned
22
32
23
33
cacheSolve <- function (x , ... ) {
24
34
# # Return a matrix that is the inverse of 'x'
You can’t perform that action at this time.
0 commit comments