Skip to content

Commit 372ba3a

Browse files
committed
Added Example
Example Usage
1 parent d470fc2 commit 372ba3a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cachematrix.R

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,17 @@ cacheSolve <- function(x, ...) {
4141
c_inv <- solve(data, ...)
4242
x$setinv(c_inv)
4343
c_inv
44-
}
44+
}
45+
46+
## Example Usage:
47+
## c <- rbind(c(1, -1/4), c(-1/4, 1))
48+
## m1 <- makeCacheMatrix(c)
49+
## cacheSolve(m1)
50+
## [,1] [,2]
51+
## [1,] 1.0666667 0.2666667
52+
## [2,] 0.2666667 1.0666667
53+
## cacheSolve(m1)
54+
## getting cached data
55+
## [,1] [,2]
56+
## [1,] 1.0666667 0.2666667
57+
## [2,] 0.2666667 1.0666667

0 commit comments

Comments
 (0)