Skip to content

Commit 33d83c8

Browse files
author
Jessy Ouellette
committed
Adding comments
1 parent fb0ffb7 commit 33d83c8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cachematrix.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
## Put comments here that give an overall description of what your
2-
## functions do
1+
# These functions are used to perform matrix inversion using caching to reduce
2+
# load
33

4-
## Write a short comment describing this function
4+
# This function will create a special list that contains methods to set a matrix
5+
# and cache its inverse
56

67
makeCacheMatrix <- function(x = matrix()) {
78
i <- NULL
@@ -18,7 +19,8 @@ makeCacheMatrix <- function(x = matrix()) {
1819
}
1920

2021

21-
## Write a short comment describing this function
22+
# This function takes in a cachedMatrix and returns its invers. It only
23+
# calculates the inverse if it isn't cahced already
2224

2325
cacheSolve <- function(x, ...) {
2426
i <- x$getInverse()
@@ -27,7 +29,7 @@ cacheSolve <- function(x, ...) {
2729
return(i)
2830
}
2931
data <- x$get()
30-
i <- solve(data)
32+
i <- solve(data, ...)
3133
x$setInverse(i)
3234
i
3335
}

0 commit comments

Comments
 (0)