FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Work done! by denstadnyk · Pull Request #2207 · rdpeng/ProgrammingAssignment2 · GitHub

Repository navigation

Work done! - #2207

Closed
denstadnyk wants to merge 0 commit into
rdpeng:masterfrom
denstadnyk:master
Closed

denstadnyk wants to merge 0 commit into
rdpeng:masterfrom
denstadnyk:master

Conversation

Copy link
Copy Markdown

No description provided.

denstadnyk closed this Jul 30, 2016

suvo240 commented Dec 14, 2016

Copy link
Copy Markdown

Caching the Inverse of a Matrix:

Matrix inversion is usually a costly computation and there may be some

benefit to caching the inverse of a matrix rather than compute it repeatedly.

Below are a pair of functions that are used to create a special object that

stores a matrix and caches its inverse.

This function creates a special "matrix" object that can cache its inverse.

makeCacheMatrix <- function(x = matrix()) {
inv <- NULL
set <- function(y) {
x <<- y
inv <<- NULL
}
get <- function() x
setInverse <- function(inverse) inv <<- inverse
getInverse <- function() inv
list(set = set,
get = get,
setInverse = setInverse,
getInverse = getInverse)
}

This function computes the inverse of the special "matrix" created by

makeCacheMatrix above. If the inverse has already been calculated (and the

matrix has not changed), then it should retrieve the inverse from the cache.

cacheSolve <- function(x, ...) {

Return a matrix that is the inverse of 'x'

inv <- x$getInverse()
if (!is.null(inv)) {
message("getting cached data")
return(inv)
}
mat <- x$get()
inv <- solve(mat, ...)
x$setInverse(inv)
inv
}

Copy link
Copy Markdown

nice

Copy link
Copy Markdown

good job!

Copy link
Copy Markdown

good job

Copy link
Copy Markdown

good

Copy link
Copy Markdown

nice

2 similar comments

Copy link
Copy Markdown

nice

Copy link
Copy Markdown

nice

Copy link
Copy Markdown

good

1 similar comment

Buzz-afk commented Nov 9, 2017

Copy link
Copy Markdown

good

yamroh commented Apr 9, 2018

Copy link
Copy Markdown

Good work

Copy link
Copy Markdown

good

Copy link
Copy Markdown

Good work

Sixu922 commented Jul 8, 2019

Copy link
Copy Markdown

well donw

weiyizz commented Jan 21, 2020

Copy link
Copy Markdown

good work

Copy link
Copy Markdown

good

Copy link
Copy Markdown

Good

Copy link
Copy Markdown

good

Copy link
Copy Markdown

Good.

RAQIB-1 commented Jun 24, 2020

Copy link
Copy Markdown

good

manojmanu297 commented Jul 3, 2020 •
edited
Loading

Copy link
Copy Markdown

Caching the Inverse of a Matrix:
Matrix inversion is usually a time taking activity and there may be some
the benefit to caching the inverse of a matrix rather than compute it repeatedly. pair of functions that are used to create a special object that stores a matrix and caches its inverse.
This function creates a special "matrix" object.

makeCacheMatrix <- function(x = matrix()){
inv <- NULL
set <- function(y){
x <<- y
inv <<- NULL
}
get <- function() {x}
SetInverse <- function(inverse) {inv <<- inverse}
getInverse <- function() {inv}
list(set = set, get = get, setInverse = setInverse, getInverse = getInverse)
}

The following function returns the inverse of cache matrix. And evaluates the inverse of a matrix

cacheSolve <- function(x, ...){
inv <- x$getInverse()
if(!is.null(inv)){
message("getting cached data")
return(inv)
}
mat <- x$get()
inv <- solve(mat, ...)
x$setInverse(inv)
inv
}

manojmanu297 commented Jul 3, 2020 •
edited
Loading

Copy link
Copy Markdown

please review the assignment

RAQIB-1 commented Jul 4, 2020 via email

Copy link
Copy Markdown

Copy link
Copy Markdown

Put comments here that give an overall description of what your

functions do

Write a short comment describing this function

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

}

Write a short comment describing this function

cacheSolve <- function(x, ...) {
## Return a matrix that is the inverse of 'x'
}

Copy link
Copy Markdown

good job

Copy link
Copy Markdown

excellent

Copy link
Copy Markdown

good job

Copy link
Copy Markdown

Programming Assignment II

	### Creat Special Matrix

makeCacheMatrix <- function(x = matrix()) {
j <- NULL
set <- function(y){
x <<- y ### Assignment Operator in the Parent Environment
j <<- NULL
}
get <- function()x
setInverse <- function(inverse) j <<- inverse
getInverse <- function() j
list(set = set, get = get,
setInverse = setInverse,
getInverse = getInverse)
}
### Cache the Matrix
cacheSolve <- function(x, ...) {
### Return a matrix that is the inverse of 'x'
j <- x$getInverse()
if(!is.null(j)){
message("getting cached data")
return(j)
}
mat <- x$get()
j <- solve(mat,...)
x$setInverse(j)
j
}

Copy link
Copy Markdown

good

Copy link
Copy Markdown

nice

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.


Back | FazBrowse Home | New Git URL