Skip to content

ASSIGNMENT 2 ASMAA #3489

Open
Open
@ghost

Description

rm(list = ls())

makeCacheMatrix <- function(ma = matrix()) {
im <- NULL
setMatrix <- function(y) {
ma <<- y
im <<- NULL
}
getMatrix <- function() ma
setinverse <- function(inv) im <<- inv
getinverse <- function() im
list(setMatrix = setMatrix,
getMatrix = getMatrix,
setinverse = setinverse,
getinverse = getinverse)
}

cacheSolve <- function(x, ...) {
im <- x$getinverse()
if (!is.null(im)) {
message("getting cached inverse matrix")
return(im)
}
data <- x$getMatrix()
i <- solve(data, ...)
x$setinverse(i)
i
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions