Skip to content

Commit f8f6192

Browse files
committed
adding comments
1 parent 4b58488 commit f8f6192

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

cachematrix.R

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
## 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
35

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
511

612
makeCacheMatrix <- function(x = matrix()) {
713
inv <- NULL
@@ -18,7 +24,11 @@ makeCacheMatrix <- function(x = matrix()) {
1824
}
1925

2026

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
2232

2333
cacheSolve <- function(x, ...) {
2434
## Return a matrix that is the inverse of 'x'

0 commit comments

Comments
 (0)