Skip to content

Commit 9575946

Browse files
committed
add comments to methods
1 parent b4f5c09 commit 9575946

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

cachematrix.R

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#Creates a special "matrix" object that can cache its inverse
2+
# Args:
3+
# x: a square invertible matrix object
4+
#
5+
# Returns:
6+
# A special "matrix" based on a list object that provides
7+
# a get/set methods to the original matrix object and a
8+
# get/set methods to the inversed (and cached) matrix
19
makeCacheMatrix <- function(x = matrix()) {
210
inverse <- NULL
311
set <- function(y) {
@@ -12,7 +20,14 @@ makeCacheMatrix <- function(x = matrix()) {
1220
getinverse = getinverse)
1321
}
1422

15-
23+
# Checks whether or not whe have a cached inversed matrix.
24+
# Returns the cached object if found, otherwise computes the inverse matrix using R "solve" method
25+
#
26+
# Args:
27+
# x: a square invertible matrix object
28+
#
29+
# Returns:
30+
# An inverse matrix of x matrix (cached or computed)
1631
cacheSolve <- function(x, ...) {
1732
## Return a matrix that is the inverse of 'x'
1833
inverse <- x$getinverse()

0 commit comments

Comments
 (0)