# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1330534637 18000 # Node ID dfb33a5723d260370dc20ac1b13850b12709b90b # Parent 2258a0b73eb80bb34fd4c157537be9dd7b4d009c doc: Fix incorrect diagonal matrix division (bug #35666) diff -r 2258a0b73eb8 -r dfb33a5723d2 doc/interpreter/diagperm.txi --- a/doc/interpreter/diagperm.txi Tue Feb 28 19:02:03 2012 -0500 +++ b/doc/interpreter/diagperm.txi Wed Feb 29 11:57:17 2012 -0500 @@ -426,12 +426,21 @@ @end example @noindent -This is how you normalize columns of a matrix @var{X} to unit norm: +This is one way to normalize columns of a matrix @var{X} to unit norm: @example @group s = norm (X, "columns"); - X = diag (s) \ X; + X = diag (s) / X; +@end group +@end example + +The same can also be accomplished with broadcasting: + +@example +@group + s = norm (X, "columns"); + X ./= s; @end group @end example