File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
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
3
-
4
- # # Write a short comment describing this function
1
+ #
2
+ # Functions `makeCacheMatrix` and `cacheSolve`.
3
+ #
4
+ # These are so close to the examples `makeVector` and `cachemean` that it almost
5
+ # feels like cheating...
6
+
7
+ # The `makeCacheMatrix` function creates a list of closures, which access a
8
+ # stored matrix and an alternative representation of the matrix.
9
+ # Returns a list of functions which encapsulate the matrix object:
10
+ # * getter & setter for the matrix
11
+ # * getter & setter for the alternative representation
5
12
6
13
makeCacheMatrix <- function (x = matrix ()) {
7
14
invmatrix <- NULL
@@ -19,7 +26,9 @@ makeCacheMatrix <- function(x = matrix()) {
19
26
}
20
27
21
28
22
- # # Write a short comment describing this function
29
+ # The `cacheSolve` function returns the cached inverse of the matrix inside the
30
+ # scope accessed by the functions in `x`, solving and caching the inverse if it
31
+ # does not already exist.
23
32
24
33
cacheSolve <- function (x , ... ) {
25
34
# # Return a matrix that is the inverse of 'x'
You can’t perform that action at this time.
0 commit comments