Mercurial > hg > octave-terminal
changeset 9052:089bd295e4f7
Documentation cleanup merge
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Fri, 27 Mar 2009 22:35:14 -0700 |
parents | 1bf0ce0930be (current diff) e15f4197d907 (diff) |
children | 4295d634797d |
files | |
diffstat | 15 files changed, 98 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-03-27 Jaroslav Hajek <highegg@gmail.com> + + * aclocal.m4 (OCTAVE_CMATH_FUNC): Add missing AC_LANG_POP. + * configure.in: Enclose string in quotes. + 2009-03-23 Jaroslav Hajek <highegg@gmail.com> * NEWS: More updates.
--- a/aclocal.m4 +++ b/aclocal.m4 @@ -1318,6 +1318,7 @@ [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_CMATH_[]AS_TR_CPP($1)F,1,[Define if <cmath> provides float variant of $1])], [AC_MSG_RESULT([no])]) +AC_LANG_POP(C++) ]) dnl Check whether fast signed integer arithmetics using bit tricks
--- a/configure.in +++ b/configure.in @@ -266,7 +266,7 @@ if test "$have_x"; then AC_DEFINE(HAVE_X_WINDOWS, 1, [Define if you have X11]) - if test $x_includes != "NONE"; then + if test "$x_includes" != "NONE"; then X11_INCFLAGS="$x_includes" fi AC_SUBST(X11_INCFLAGS)
--- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2009-03-27 Jaroslav Hajek <highegg@gmail.com> + + * interpreter/diagperm.txi: Mention mixing with sparse matrices. + 2009-03-25 John W. Eaton <jwe@octave.org> * interpreter/munge-texi.cc (process_texi_input_file):
--- a/doc/interpreter/diagperm.txi +++ b/doc/interpreter/diagperm.txi @@ -258,6 +258,12 @@ happens to be diagonal (an is thus not a special object) is of course treated normally. +Multiplication and division by diagonal matrices works efficiently also when +combined with sparse matrices, i.e. @code{D*S}, where @var{D} is a diagonal +matrix and @var{S} is a sparse matrix scales the rows of the sparse matrix and +returns a sparse matrix. The expressions @code{S*D}, @code{D\S}, @code{S/D} work +analogically. + If @var{D1} and @var{D2} are both diagonal matrices, then the expressions @example D1 + D2 @@ -320,6 +326,12 @@ flag internally, and thus the choice between the two above equivalent expressions for inverse permuting is completely up to the user's taste. +Multiplication and division by permutation matrices works efficiently also when +combined with sparse matrices, i.e. @code{P*S}, where @var{P} is a permutation +matrix and @var{S} is a sparse matrix permutes the rows of the sparse matrix and +returns a sparse matrix. The expressions @code{S*P}, @code{P\S}, @code{S/P} work +analogically. + Two permutation matrices can be multiplied or divided (if their sizes match), performing a composition of permutations. Also a permutation matrix can be indexed by a permutation vector (or two vectors), giving again a permutation matrix. @@ -351,6 +363,8 @@ @dfn{abs}, @dfn{real}, @dfn{imag}, @dfn{conj}, @dfn{sqrt}. A diagonal matrix can also be returned from the @dfn{balance} and @dfn{svd} functions. +The @dfn{sparse} function will convert a diagonal matrix efficiently to a +sparse matrix. @node Permutation Matrix Functions @subsection Permutation Matrix Functions @@ -362,6 +376,11 @@ A permutation matrix can also be returned from the built-in functions @dfn{lu} and @dfn{qr}, if a pivoted factorization is requested. +The @dfn{sparse} function will convert a permutation matrix efficiently to a +sparse matrix. +The @dfn{find} function will also work efficiently with a permutation matrix, +making it possible to conveniently obtain the permutation indices. + @node Example Codes @section Some Examples of Usage
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -2546,6 +2546,21 @@ } } + // Fixup return dimensions, for Matlab compatibility. + // find(zeros(0,0)) -> zeros(0,0) + // find(zeros(1,0)) -> zeros(1,0) + // find(zeros(0,1)) -> zeros(0,1) + // find(zeros(0,X)) -> zeros(0,1) + // find(zeros(1,1)) -> zeros(0,0) !!!! WHY? + // find(zeros(0,1,0)) -> zeros(0,0) + // find(zeros(0,1,0,1)) -> zeros(0,0) etc + + if ((numel () == 1 && retval.is_empty ()) + || (rows () == 0 && dims ().numel (1) == 0)) + retval.dimensions = dim_vector (); + else if (rows () == 1 && ndims () == 2) + retval.dimensions = dim_vector (1, retval.length ()); + return retval; }
--- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -628,6 +628,7 @@ return result; } + template <class U> friend class Array; }; #endif
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,13 @@ +2009-03-26 Jaroslav Hajek <highegg@gmail.com> + + * Array.cc (Array<T>::find): Reshape result for Matlab compatibility. + * Array.h (Array<T>): Add friend template declaration. + +2009-03-27 Jaroslav Hajek <highegg@gmail.com> + + * idx-vector.cc (idx_vector::idx_vector_rep::idx_vector_rep (const + Array<bool>&): Use more M*b-compatible behaviour. + 2009-03-26 Jaroslav Hajek <highegg@gmail.com> * dim-vector.h (dim_vector::numel): Add optional argument, simplify.
--- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -295,10 +295,11 @@ for (octave_idx_type i = 0, l = bnda.numel (); i < l; i++) if (bnda.xelem (i)) len++; - dim_vector dv = bnda.dims (); + const dim_vector dv = bnda.dims (); - orig_dims = ((dv.length () == 2 && dv(0) == 1) - ? dim_vector (1, len) : orig_dims = dim_vector (len, 1)); + if (! dv.all_zero ()) + orig_dims = ((dv.length () == 2 && dv(0) == 1) + ? dim_vector (1, len) : dim_vector (len, 1)); if (len != 0) {
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,12 @@ +2009-03-27 Ben Abbott <bpabbott@mac.com> + + * plot/__go_draw_axes__.m: Properly position the title for 3D plots + when using the gnuplot (v4.3+) backend. + +2009-03-27 Jaroslav Hajek <highegg@gmail.com> + + * linear-algebra/expm.m: Fix order of outputs from balance. + 2009-03-25 Kai Habel <kai.habel@gmx.de> * general/gradient.m: Fix calculation for more than two
--- a/scripts/linear-algebra/expm.m +++ b/scripts/linear-algebra/expm.m @@ -115,12 +115,12 @@ a -= trshift*eye (n); endif ## Balancing. - [p, d, aa] = balance (a); + [d, p, aa] = balance (a); ## FIXME: can we both permute and scale at once? Or should we rather do ## this: ## - ## [p, xx, aa] = balance (a, "noscal"); - ## [xx, d, aa] = balance (aa, "noperm"); + ## [d, xx, aa] = balance (a, "noperm"); + ## [xx, p, aa] = balance (aa, "noscal"); [f, e] = log2 (norm (aa, "inf")); s = max (0, e); s = min (s, 1023);
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -100,9 +100,14 @@ else fontspec = sprintf ("font \"%s,%d\"", f, s); endif - fprintf (plot_stream, "set title \"%s\" %s %s;\n", + fprintf (plot_stream, "set title \"%s\" %s %s", undo_string_escapes (tt), fontspec, __do_enhanced_option__ (enhanced, t)); + if (nd == 3) + fprintf (plot_stream, " offset screen 0, screen %.3f;\n", pos(4)/5); + else + fprintf (plot_stream, ";\n"); + endif endif endif
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2009-03-27 Jaroslav Hajek <highegg@gmail.com> + + * DLD-FUNCTIONS/balance.cc (Fbalance): Fix order of output args. + +2009-03-26 Jaroslav Hajek <highegg@gmail.com> + + * DLD-FUNCTIONS/find.cc + (find_nonzero_elem_idx (const Array<T>&, ...)): Move dimensions + fixup to liboctave. + 2009-03-26 Jaroslav Hajek <highegg@gmail.com> * DLD-FUNCTIONS/find.cc
--- a/src/DLD-FUNCTIONS/balance.cc +++ b/src/DLD-FUNCTIONS/balance.cc @@ -51,7 +51,7 @@ "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{aa} =} balance (@var{a}, @var{opt})\n\ @deftypefnx {Loadable Function} {[@var{dd}, @var{aa}] =} balance (@var{a}, @var{opt})\n\ -@deftypefnx {Loadable Function} {[@var{p}, @var{d}, @var{aa}] =} balance (@var{a}, @var{opt})\n\ +@deftypefnx {Loadable Function} {[@var{d}, @var{p}, @var{aa}] =} balance (@var{a}, @var{opt})\n\ @deftypefnx {Loadable Function} {[@var{cc}, @var{dd}, @var{aa}, @var{bb}] =} balance (@var{a}, @var{b}, @var{opt})\n\ \n\ Compute @code{aa = dd \\ a * dd} in which @code{aa} is a matrix whose\n\ @@ -62,7 +62,7 @@ eigenvalue calculation are typically improved by balancing first.\n\ \n\ If two output values are requested, @code{balance} returns \n\ -the permutation @code{p} and the diagonal @code{d} separately as vectors. \n\ +the diagonal @code{d} and the permutation @code{p} separately as vectors. \n\ In this case, @code{dd = eye(n)(p,:) * diag (d)}, where @code{n} is the matrix \n\ size. \n\ \n\ @@ -169,8 +169,8 @@ else { retval(2) = result.balanced_matrix (); - retval(1) = result.scaling_vector (); - retval(0) = result.permuting_vector (); + retval(0) = result.scaling_vector (); + retval(1) = result.permuting_vector (); } } @@ -188,8 +188,8 @@ else { retval(2) = result.balanced_matrix (); - retval(1) = result.scaling_vector (); - retval(0) = result.permuting_vector (); + retval(0) = result.scaling_vector (); + retval(1) = result.permuting_vector (); } } } @@ -209,8 +209,8 @@ else { retval(2) = result.balanced_matrix (); - retval(1) = result.scaling_vector (); - retval(0) = result.permuting_vector (); + retval(0) = result.scaling_vector (); + retval(1) = result.permuting_vector (); } } else @@ -227,8 +227,8 @@ else { retval(2) = result.balanced_matrix (); - retval(1) = result.scaling_vector (); - retval(0) = result.permuting_vector (); + retval(0) = result.scaling_vector (); + retval(1) = result.permuting_vector (); } } }
--- a/src/DLD-FUNCTIONS/find.cc +++ b/src/DLD-FUNCTIONS/find.cc @@ -49,23 +49,6 @@ else idx = nda.find (); - // Fixup idx dimensions, for Matlab compatibility. - // find(zeros(0,0)) -> zeros(0,0) - // find(zeros(1,0)) -> zeros(1,0) - // find(zeros(0,1)) -> zeros(0,1) - // find(zeros(0,X)) -> zeros(0,1) - // find(zeros(1,1)) -> zeros(0,0) !!!! WHY? - // find(zeros(0,1,0)) -> zeros(0,0) - // find(zeros(0,1,0,1)) -> zeros(0,0) etc - // FIXME: I don't believe this is right. Matlab seems to violate its own docs - // here, because a scalar *is* a row vector. - - if ((nda.numel () == 1 && idx.is_empty ()) - || (nda.rows () == 0 && nda.dims ().numel (1) == 0)) - idx = idx.reshape (dim_vector (0, 0)); - else if (nda.rows () == 1 && nda.ndims () == 2) - idx = idx.reshape (dim_vector (1, idx.length ())); - switch (nargout) { default: