Open
Description
These are the 2 functions
Make Cache Matrix:
makeCacheMatrix <- function(x = matrix()){
inv <- NULL
set <- function(y){
x<<- y
inv<<- NULL
}
get <- function() x
setInv <- function(solve) inv<<- solve
getInv <- function() inv
list(set = set, get = get,
setInv = setInv,
getInv = getInv)
Solve the matrix, and check the result (the product of the Source Matrix and its inverse must be 1).
cacheSolve <- function(x, ...){
inv <- x$getInv()
if(!is.null(inv)){
message('getting cached data')
return(inv)
}
sourcematrix <- x$get()
inv <- solve(sourcematrix,...)
x$setInv(inv)
inv
sourcematrix %*% inv
}
Metadata
Metadata
Assignees
Labels
No labels