Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rdpeng/ProgrammingAssignment2
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Zeal0us/ProgrammingAssignment2
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Feb 17, 2019

  1. added logic per assignment

    Zeal0us authored and Zeal0us committed Feb 17, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    66a31f6 View commit details
Showing with 22 additions and 5 deletions.
  1. +22 −5 cachematrix.R
27 changes: 22 additions & 5 deletions cachematrix.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
## Put comments here that give an overall description of what your
## functions do
##Create and solve on a cacheable matrix object

## Write a short comment describing this function
## Creates and returns a cachable matrix from an R matrix from the matrix function

makeCacheMatrix <- function(x = matrix()) {

inverse <- NULL
set <- function(new_value) {
x <<- new_value
inverse <<- NULL
}
get <- function() x
set_inverse <- function(new_inverse) inverse <<- new_inverse
get_inverse <- function() inverse
invisible(list(set = set, get = get,
set_inverse = set_inverse,
get_inverse = get_inverse))
}


## Write a short comment describing this function
## returns the result of solve on a given cacheable matrix from makeCacheMatrix and stores the result
## If the answer is already cached, it is stored for future runs.

cacheSolve <- function(x, ...) {
## Return a matrix that is the inverse of 'x'
inverse <- x$get_inverse()
if(!is.null(inverse)) {
return(inverse)
}
inverse <- solve(x$get(), ...)
x$set_inverse(inverse)
inverse
}