File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1
1
# # Put comments here that give an overall description of what your
2
2
# # functions do
3
3
4
- # # Write a short comment describing this function
4
+ # makeCacheMatrix store matrix and its inverse
5
+ # cacheSolve return the inverse of the matrix
6
+
7
+ # For example, if A is a square invertible matrix:
8
+ # B <- makeCacheMatrix(A) create the object with matrix A.
9
+ # B$get() returns the matrix A.
10
+ # cacheSolve(B) calculate the inverse of A and cache in B if matrix inverse is not yet cached.
11
+ # cacheSolve(B) return the matrix inverse of A from cache if cacheSolve(B) is called previously.
12
+ # B$getinverse() returns the inverse of A if the inverse is already cached.
5
13
14
+ # # Write a short comment describing this function
15
+ # makeCacheMatrix creates an object from a matrix.
6
16
makeCacheMatrix <- function (x = matrix ()) {
7
17
m <- NULL
8
18
set <- function (y ) {
@@ -19,7 +29,7 @@ makeCacheMatrix <- function(x = matrix()) {
19
29
20
30
21
31
# # Write a short comment describing this function
22
-
32
+ # cacheSolve return the matrix inverse either from solve() or from cache.
23
33
cacheSolve <- function (x , ... ) {
24
34
# # Return a matrix that is the inverse of 'x'
25
35
m <- x $ getinverse()
You can’t perform that action at this time.
0 commit comments