File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
- # #
2
- # #
1
+ # #This two functions sets and caches the inverse of a square invertible matrix 'x'
3
2
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.
4
9
makeCacheMatrix <- function (x = matrix ()) {
5
10
m <- NULL
6
11
set <- function (y ) {
@@ -17,9 +22,10 @@ makeCacheMatrix <- function(x = matrix()) {
17
22
18
23
19
24
# # 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 , ... ) {
23
29
m <- x $ getinverse()
24
30
if (! is.null(m )) {
25
31
message(" getting cached data" )
You can’t perform that action at this time.
0 commit comments