|
1 | 1 | ### Introduction
|
2 | 2 |
|
3 | 3 | This second programming assignment will require you to write an R
|
4 |
| -function that is able to cache potentially time-consuming computations. For |
5 |
| -example, taking the mean of a numeric vector is typically a fast |
| 4 | +function that is able to cache potentially time-consuming computations. |
| 5 | +For example, taking the mean of a numeric vector is typically a fast |
6 | 6 | operation. However, for a very long vector, it may take too long to
|
7 | 7 | compute the mean, especially if it has to be computed repeatedly (e.g.
|
8 | 8 | in a loop). If the contents of a vector are not changing, it may make
|
9 | 9 | sense to cache the value of the mean so that when we need it again, it
|
10 | 10 | can be looked up in the cache rather than recomputed. In this
|
11 |
| -Programming Assignment you will take advantage of the scoping rules of the R |
12 |
| -language and how they can be manipulated to preserve state inside of an |
13 |
| -R object. |
| 11 | +Programming Assignment you will take advantage of the scoping rules of |
| 12 | +the R language and how they can be manipulated to preserve state inside |
| 13 | +of an R object. |
14 | 14 |
|
15 | 15 | ### Example: Caching the Mean of a Vector
|
16 | 16 |
|
@@ -76,8 +76,8 @@ Write the following functions:
|
76 | 76 | that can cache its inverse.
|
77 | 77 | 2. `cacheSolve`: This function computes the inverse of the special
|
78 | 78 | "matrix" returned by `makeCacheMatrix` above. If the inverse has
|
79 |
| - already been calculated (and the matrix has not changed), then the |
80 |
| - `cachesolve` should retrieve the inverse from the cache. |
| 79 | + already been calculated (and the matrix has not changed), then |
| 80 | + `cacheSolve` should retrieve the inverse from the cache. |
81 | 81 |
|
82 | 82 | Computing the inverse of a square matrix can be done with the `solve`
|
83 | 83 | function in R. For example, if `X` is a square invertible matrix, then
|
|
0 commit comments