diff --git a/docs.html b/docs.html
index 0b70508d..4bb23ef9 100644
--- a/docs.html
+++ b/docs.html
@@ -273,7 +273,7 @@ Conrad Sanderson and Ryan Curtin.
| .imbue | | imbue (fill) with values provided by functor or lambda function |
| | | |
| .clean | | replace elements below a threshold with zeros |
-| .replace | | replace specific elements with a new value |
+| .replace | | replace specific elements with a new value |
| .clamp | | clamp values to lower and upper limits |
| | | |
| .transform | | transform each element via functor or lambda function |
@@ -428,29 +428,30 @@ Conrad Sanderson and Ryan Curtin.
| rank | | rank of matrix |
| rcond | | reciprocal condition number |
| repelem | | replicate elements |
+| replace | | replace specific elements with a new value |
| repmat | | replicate matrix in block-like fashion |
-| reshape | | change size while keeping elements |
+| reshape | | change size while keeping elements |
| resize | | change size while keeping elements and preserving layout |
| reverse | | reverse order of elements |
-| roots | | roots of polynomial |
+| roots | | roots of polynomial |
| shift | | circular shift of elements |
| shuffle | | randomly shuffle elements |
-| size | | obtain dimensions of given object |
+| size | | obtain dimensions of given object |
| sort | | sort elements |
| sort_index | | vector describing sorted order of elements |
-| sqrtmat | | square root of matrix |
+| sqrtmat | | square root of matrix |
| sqrtmat_sympd | | square root of symmetric matrix |
| sum | | sum of elements |
-| sub2ind | | convert subscripts to linear index |
+| sub2ind | | convert subscripts to linear index |
| symmatu / symmatl | | generate symmetric matrix from given matrix |
| trace | | sum of diagonal elements |
-| trans | | transpose of matrix |
+| trans | | transpose of matrix |
| trapz | | trapezoidal numerical integration |
| trimatu / trimatl | | copy upper/lower triangular part |
-| trimatu_ind / trimatl_ind | | obtain indices of upper/lower triangular part |
+| trimatu_ind / trimatl_ind | | obtain indices of upper/lower triangular part |
| unique | | return unique elements |
| vecnorm | | obtain vector norm of each row or column of a matrix |
-| vectorise | | flatten matrix into vector |
+| vectorise | | flatten matrix into vector |
| misc functions | | miscellaneous element-wise functions: exp, log, sqrt, round, sign, ... |
| trig functions | | trigonometric element-wise functions: cos, sin, tan, ... |
@@ -2024,11 +2025,11 @@ The following subset of operations & functions is available for sparse matri
element-wise functions: abs(), cbrt(), ceil(), conj(), floor(), imag(), real(), round(), sign(), sqrt(), square(), trunc()
scalar functions of matrices: accu(), as_scalar(), dot(), norm(), norm2est(), trace()
vector valued functions of matrices: diagvec(), min(), max(), nonzeros(), sum(), mean(), stddev(), var(), vecnorm(), vectorise()
-matrix valued functions of matrices: clamp(), diagmat(), spdiags(), flipud()/fliplr(), join_rows(), join_cols(), kron(), normalise(), repelem(), repmat(), reshape(), resize(), reverse(), shift(), symmatu()/symmatl(), trimatu()/trimatl(), .t(), trans()
+matrix valued functions of matrices: clamp(), diagmat(), spdiags(), flipud()/fliplr(), join_rows(), join_cols(), kron(), normalise(), repelem(), replace(), repmat(), reshape(), resize(), reverse(), shift(), symmatu()/symmatl(), trimatu()/trimatl(), .t(), trans()
generated matrices: speye(), spones(), sprandu(), sprandn(), zeros()
eigen decompositions and SVD: eigs_sym(), eigs_gen(), svds()
solution of sparse linear systems: spsolve()
-miscellaneous: approx_equal(), element access, element iterators, .as_col() / .as_row(), .as_dense(), .for_each(), .print(), .clean(), .replace(), .transform(), .is_finite(), .is_symmetric(), .is_hermitian(), .is_trimatu(), .is_trimatl(), .is_diagmat()
+miscellaneous: approx_equal(), element access, element iterators, .as_col() / .as_row(), .as_dense(), .for_each(), .print(), .clean(), .replace(), .transform(), .is_finite(), .is_symmetric(), .is_hermitian(), .is_trimatu(), .is_trimatl(), .is_diagmat()
@@ -2271,7 +2272,7 @@ See also:
accu()
as_scalar()
find()
-.replace()
+replace()
.transform()
.each_col() & .each_row() (vector operations applied to each column or row)
miscellaneous element-wise functions (exp, log, sqrt, square, round, ...)
@@ -3094,6 +3095,7 @@ See also:
+
.replace( old_value, new_value )
-
@@ -3129,6 +3131,7 @@ A.replace(datum::nan, 0); // replace each NaN with 0
-
See also:
@@ -9488,7 +9491,7 @@ See also:
Caveats:
- to clamp values to an interval, clamp() is more efficient
-- to replace a specific value, .replace() is more efficient
+- to replace a specific value, replace() is more efficient
@@ -9574,8 +9577,8 @@ See also:
- find()
- find_nan() / find_nonnan()
+- replace()
- .is_finite()
-- .replace()
- .has_inf()
- .has_nan()
- submatrix views
@@ -9622,7 +9625,7 @@ uvec indices2 = find_nonnan(A);
-
Caveat: to replace instances of NaN values,
-it is more efficient to use .replace()
+it is more efficient to use replace()
-
@@ -9630,7 +9633,7 @@ See also:
+
+
+replace( A, old_value, new_value )
+
+- Generate a copy of A with all elements equal to old_value replaced by new_value
+
+- The type of old_value and new_value must match the type of elements used by the container object (eg. for mat the type is double)
+
+
+-
+Caveats:
+
+- floating point numbers (float and double) are approximations due to their necessarily limited precision
+- for sparse matrices (SpMat), replacement is not done when old_value = 0
+
+
+
+-
+Examples:
+
+mat A(5, 6, fill::randu);
+
+A.diag().fill(datum::nan);
+
+mat B = replace(A, datum::nan, 0); // replace each NaN with 0
+
+
+
+
+-
+See also:
+
+
+
+
+
repmat( A, num_copies_per_row, num_copies_per_col )
@@ -20192,6 +20240,7 @@ List of additions and changes for each version:
- (under development)
- added balance() for producing balanced matrices where column and row norms are roughly the same
- added find_nonnan() for finding indices of non-NaN elements
+- added standalone replace() function
- ...