Skip to content

Commit 70b4f43

Browse files
committed
with comments
1 parent 5a7fe32 commit 70b4f43

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

cachematrix.R

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
##
2-
##
1+
##This two functions sets and caches the inverse of a square invertible matrix 'x'
32

3+
## makeCacheMatrix takes a square invertible matrix as argument and produces a special matrix which is a list composed of functions which:
4+
# set the value of the matrix
5+
# get the value of the matrix
6+
# set the value of the inverse , (by calling the R function 'solve' )
7+
# get the value of the inverse
8+
##All packaged in a particular environment.
49
makeCacheMatrix <- function(x = matrix()) {
510
m <- NULL
611
set <- function(y) {
@@ -17,9 +22,10 @@ makeCacheMatrix <- function(x = matrix()) {
1722

1823

1924
## Return a matrix that is the inverse of 'x'
20-
21-
cacheSolve <- function(x, ...) {
22-
25+
#Takes the result of makeCacheMatrix as argument,
26+
#and get the inverse from calculation the first time, then
27+
#cache it ('setinverse') and call the cache after with a cool message.
28+
cacheSolve <- function(x, ...) {
2329
m <- x$getinverse()
2430
if(!is.null(m)) {
2531
message("getting cached data")

0 commit comments

Comments
 (0)