Skip to content

Commit ae86c37

Browse files
author
Jonathan Taylor
committed
Adding additional comments
1 parent 41e8580 commit ae86c37

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

cachematrix.R

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
## Put comments here that give an overall description of what your
2-
## functions do
1+
## Provides two functions to create a special matrix object and another to perform work upon that
2+
## special matrix object in order to cache its inverse
33

4-
## Write a short comment describing this function
4+
## Creates a clojure object containing the supplied matrix, has internal variables for managing state of the
5+
## current matrix
6+
## Note that changes to the matrix will reset the cached value, this handles changes to the matrix
57

68
makeCacheMatrix <- function(our_matrix = matrix()) {
79
computed_inverse <- NULL
@@ -21,10 +23,13 @@ makeCacheMatrix <- function(our_matrix = matrix()) {
2123
}
2224

2325

24-
## Write a short comment describing this function
26+
## Takes the object returned from a makeCacheMatrix call and allows you to return either a cached inverse
27+
## or to compute one if we haven't calculated it yet
28+
## There is an important change here which is not to pass additional parameters to the solve function as its other
29+
## paramters could modify output (see cacheSolve(t,b=M) as an example)
2530

2631
cacheSolve <- function(x, ...) {
27-
## Return a matrix that is the inverse of 'x'
32+
## Return a matrix that is the inverse of 'x'
2833
inverse <- x$getInverse()
2934
if(!is.null(inverse)) {
3035
message("getting cached data")

0 commit comments

Comments
 (0)