Skip to content

Commit 110e6e9

Browse files
committed
Update cachematrix.R
1 parent b99a386 commit 110e6e9

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

cachematrix.R

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
## Put comments here that give an overall description of what your
22
## functions do
33

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.
513

14+
## Write a short comment describing this function
15+
# makeCacheMatrix creates an object from a matrix.
616
makeCacheMatrix <- function(x = matrix()) {
717
m <- NULL
818
set <- function(y) {
@@ -19,7 +29,7 @@ makeCacheMatrix <- function(x = matrix()) {
1929

2030

2131
## Write a short comment describing this function
22-
32+
# cacheSolve return the matrix inverse either from solve() or from cache.
2333
cacheSolve <- function(x, ...) {
2434
## Return a matrix that is the inverse of 'x'
2535
m <- x$getinverse()

0 commit comments

Comments
 (0)