# HG changeset patch # User John W. Eaton # Date 1390466621 18000 # Node ID a91654d70f99aa728d2dd4b13965ea0d177e5ea5 # Parent 7a1a71e3f328914b0fa8305ac0b6fc591e4c08ae# Parent 1ecfcfa4858e3e988f9834ff6e2d0a3fd747c263 maint: Periodic merge of gui-release to default. diff -r 7a1a71e3f328 -r a91654d70f99 doc/interpreter/diagperm.txi --- a/doc/interpreter/diagperm.txi Wed Jan 22 22:47:14 2014 -0800 +++ b/doc/interpreter/diagperm.txi Thu Jan 23 03:43:41 2014 -0500 @@ -18,6 +18,8 @@ @node Diagonal and Permutation Matrices @chapter Diagonal and Permutation Matrices +@cindex diagonal and permutation matrices +@cindex matrices, diagonal and permutation @menu * Basic Usage:: Creation and Manipulation of Diagonal/Permutation Matrices @@ -224,6 +226,7 @@ @node Expressions Involving Diagonal Matrices @subsection Expressions Involving Diagonal Matrices +@cindex diagonal matrix expressions Assume @var{D} is a diagonal matrix. If @var{M} is a full matrix, then @code{D*M} will scale the rows of @var{M}. That means, @@ -260,6 +263,7 @@ i.e., null rows are appended to the result. The situation for right-multiplication @code{M*D} is analogous. +@cindex pseudoinverse The expressions @code{D \ M} and @code{M / D} perform inverse scaling. They are equivalent to solving a diagonal (or rectangular diagonal) in a least-squares minimum-norm sense. In exact arithmetic, this is @@ -270,12 +274,12 @@ The matrix division algorithms do, in fact, use division rather than multiplication by reciprocals for better numerical accuracy; otherwise, they honor the above definition. Note that a diagonal matrix is never truncated due -to ill-conditioning; otherwise, it would not be much useful for scaling. This +to ill-conditioning; otherwise, it would not be of much use for scaling. This is typically consistent with linear algebra needs. A full matrix that only -happens to be diagonal (an is thus not a special object) is of course treated +happens to be diagonal (and is thus not a special object) is of course treated normally. -Multiplication and division by diagonal matrices works efficiently also when +Multiplication and division by diagonal matrices work 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} @@ -399,6 +403,8 @@ @node Permutation Matrix Functions @subsection Permutation Matrix Functions +@cindex matrix, permutation functions +@cindex permutation matrix functions @dfn{inv} and @dfn{pinv} will invert a permutation matrix, preserving its specialness. @dfn{det} can be applied to a permutation matrix, efficiently @@ -455,7 +461,7 @@ @end example @noindent -Finally, here's how you solve a linear system @code{A*x = b} +Finally, here's how to solve a linear system @code{A*x = b} with Tikhonov regularization (ridge regression) using SVD (a skeleton only): @example @@ -477,16 +483,17 @@ @node Zeros Treatment @section Differences in Treatment of Zero Elements +@cindex matrix, zero elements Making diagonal and permutation matrices special matrix objects in their own right and the consequent usage of smarter algorithms for certain operations implies, as a side effect, small differences in treating zeros. -The contents of this section applies also to sparse matrices, discussed in -the following chapter. +The contents of this section apply also to sparse matrices, discussed in +the following chapter. (@pxref{Sparse Matrices}) -The IEEE standard defines the result of the expressions @code{0*Inf} and -@code{0*NaN} as @code{NaN}, as it has been generally agreed that this is the -best compromise. +The IEEE floating point standard defines the result of the expressions @code{0*Inf} and +@code{0*NaN} as @code{NaN}. This is widely agreed to be a good +compromise. Numerical software dealing with structured and sparse matrices (including Octave) however, almost always makes a distinction between a "numerical zero" and an "assumed zero". diff -r 7a1a71e3f328 -r a91654d70f99 doc/interpreter/linalg.txi --- a/doc/interpreter/linalg.txi Wed Jan 22 22:47:14 2014 -0800 +++ b/doc/interpreter/linalg.txi Thu Jan 23 03:43:41 2014 -0500 @@ -18,6 +18,7 @@ @node Linear Algebra @chapter Linear Algebra +@cindex linear algebra This chapter documents the linear algebra functions of Octave. Reference material for many of these functions may be found in @@ -34,6 +35,7 @@ @node Techniques Used for Linear Algebra @section Techniques Used for Linear Algebra +@cindex linear algebra, techniques Octave includes a polymorphic solver, that selects an appropriate matrix factorization depending on the properties of the matrix itself. @@ -81,6 +83,7 @@ @node Basic Matrix Functions @section Basic Matrix Functions +@cindex matrix functions, basic @DOCSTRING(balance) @@ -109,6 +112,7 @@ @DOCSTRING(mgorth) @DOCSTRING(pinv) +@cindex pseudoinverse @DOCSTRING(rank) @@ -120,6 +124,7 @@ @node Matrix Factorizations @section Matrix Factorizations +@cindex matrix factorizations @DOCSTRING(chol) @@ -173,6 +178,7 @@ @node Functions of a Matrix @section Functions of a Matrix +@cindex matrix, functions of @DOCSTRING(expm) @@ -188,6 +194,7 @@ @node Specialized Solvers @section Specialized Solvers +@cindex matrix, specialized solvers @DOCSTRING(bicg) diff -r 7a1a71e3f328 -r a91654d70f99 doc/interpreter/plot.txi --- a/doc/interpreter/plot.txi Wed Jan 22 22:47:14 2014 -0800 +++ b/doc/interpreter/plot.txi Thu Jan 23 03:43:41 2014 -0500 @@ -49,6 +49,7 @@ @node High-Level Plotting @section High-Level Plotting +@cindex plotting, high-level Octave provides simple means to create many different types of two- and three-dimensional plots using high-level functions. @@ -261,8 +262,9 @@ @node Two-dimensional Function Plotting @subsubsection Two-dimensional Function Plotting - -Octave can plot a function from a function handle inline function or +@cindex plotting, two-dimensional functions + +Octave can plot a function from a function handle, inline function, or string defining the function without the user needing to explicitly create the data to be plotted. The function @code{fplot} also generates two-dimensional plots with linear axes using a function name and limits @@ -300,6 +302,7 @@ @node Three-Dimensional Plots @subsection Three-Dimensional Plots +@cindex plotting, three-dimensional The function @code{mesh} produces mesh surface plots. For example, @@ -480,6 +483,7 @@ @node Multiple Plots on One Page @subsection Multiple Plots on One Page +@cindex plotting, multiple plots per figure Octave can display more than one plot in a single figure. The simplest way to do this is to use the @code{subplot} function to divide the plot @@ -506,6 +510,7 @@ @node Multiple Plot Windows @subsection Multiple Plot Windows +@cindex plotting, multiple plot windows You can open multiple plot windows using the @code{figure} function. For example, @@ -527,6 +532,7 @@ @node Manipulation of Plot Windows @subsection Manipulation of Plot Windows +@cindex plotting, window manipulation By default, Octave refreshes the plot window when a prompt is printed, or when waiting for input. The @@ -903,6 +909,7 @@ @node Printing and Saving Plots @subsection Printing and Saving Plots +@cindex plotting, saving and printing plots @cindex printing plots @cindex saving plots @@ -1253,6 +1260,7 @@ @DOCSTRING(findfigs) @cindex saving graphics objects +@cindex graphics objects, saving Figures can be printed or saved in many graphics formats with @code{print} and @code{saveas}. Occasionally, however, it may be useful to save the original @@ -2985,8 +2993,8 @@ object representing the baseline is given by the @code{baseline} property and the y-value of the baseline by the @code{basevalue} property. -Changes to any of these property are propagated to the other members of -the bar series and to the baseline itself. Equally changes in the +Changes to any of these properties are propagated to the other members of +the bar series and to the baseline itself. Equally, changes in the properties of the base line itself are propagated to the members of the corresponding bar series. diff -r 7a1a71e3f328 -r a91654d70f99 libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Wed Jan 22 22:47:14 2014 -0800 +++ b/libgui/src/m-editor/file-editor-tab.cc Thu Jan 23 03:43:41 2014 -0500 @@ -1,3 +1,4 @@ + /* Copyright (C) 2011-2013 Jacob Dawid @@ -56,6 +57,7 @@ #include "debug.h" #include "octave-qt-link.h" #include "version.h" +#include "utils.h" // Make parent null for the file editor tab so that warning // WindowModal messages don't affect grandparents. @@ -1227,16 +1229,20 @@ } bool -file_editor_tab::save_file_check_spaces (QString file_name) +file_editor_tab::check_valid_identifier (QString file_name) { - QFileInfo file = QFileInfo(file_name); + QFileInfo file = QFileInfo (file_name); + QString base_name = file.baseName (); - if (file.suffix () == "m" && file.baseName ().contains (' ')) + if ((file.suffix () == "m") + && (! valid_identifier (base_name.toStdString ()))) { int ans = QMessageBox::question (0, tr ("Octave Editor"), - tr ("It is not advisable to save an Octave script\n" - "in a file with a name containing spaces.\n\n" - "Do you wnat to chose another name?"), + tr ("\"%1\"\n" + "is not a valid identifier.\n\n" + "If you keep this file name, you will not be able to\n" + "call your script using its name as an Octave command.\n\n" + "Do you want to choose another name?").arg (base_name), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); if (ans == QMessageBox::Yes) @@ -1257,7 +1263,7 @@ else { // Have editor check for conflict, do not delete tab after save. - if (save_file_check_spaces (saveFileName)) + if (check_valid_identifier (saveFileName)) save_file_as (false); else emit editor_check_conflict_save (saveFileName, false); @@ -1271,7 +1277,7 @@ // when we close a tab and _file_name is not a valid file name yet // Have editor check for conflict, delete tab after save. - if (save_file_check_spaces (saveFileName)) + if (check_valid_identifier (saveFileName)) save_file_as (true); else emit editor_check_conflict_save (saveFileName, true); diff -r 7a1a71e3f328 -r a91654d70f99 libgui/src/m-editor/file-editor-tab.h --- a/libgui/src/m-editor/file-editor-tab.h Wed Jan 22 22:47:14 2014 -0800 +++ b/libgui/src/m-editor/file-editor-tab.h Thu Jan 23 03:43:41 2014 -0500 @@ -180,7 +180,7 @@ bool valid_file_name (const QString& file=QString ()); void save_file (const QString& saveFileName, bool remove_on_success = false); void save_file_as (bool remove_on_success = false); - bool save_file_check_spaces (QString file_name); + bool check_valid_identifier (QString file_name); void update_lexer (); void request_add_breakpoint (int line); diff -r 7a1a71e3f328 -r a91654d70f99 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Wed Jan 22 22:47:14 2014 -0800 +++ b/libgui/src/main-window.cc Thu Jan 23 03:43:41 2014 -0500 @@ -60,6 +60,7 @@ #include "defaults.h" #include "symtab.h" #include "version.h" +#include "utils.h" static file_editor_interface * create_default_editor (QWidget *p) @@ -263,16 +264,17 @@ main_window::run_file_in_terminal (const QFileInfo& info) { QString file_name = info.canonicalFilePath (); - QString command = "run \""+file_name+"\""; + QString command = "run \"" + file_name + "\""; QString function_name = info.fileName (); function_name.chop (info.suffix ().length () + 1); - if (function_name.contains (' ')) + if (! valid_identifier (function_name.toStdString ())) { int ans = QMessageBox::question (0, tr ("Octave"), tr ("The file %1\n" - "contains spaces and can not be executed.\n\n" + "can not be executed because its name\n" + "is not a valid identifier.\n\n" "Do you want to execute\n%2\n" "instead?"). arg (file_name).arg (command), diff -r 7a1a71e3f328 -r a91654d70f99 libinterp/corefcn/urlwrite.cc --- a/libinterp/corefcn/urlwrite.cc Wed Jan 22 22:47:14 2014 -0800 +++ b/libinterp/corefcn/urlwrite.cc Thu Jan 23 03:43:41 2014 -0500 @@ -554,15 +554,12 @@ { curl.http_action (param, method); - if (curl.good ()) + if (nargout > 0) { - if (nargout > 0) - { - // Return empty string if no error occured. - retval(2) = curl.good () ? "" : curl.lasterror (); - retval(1) = curl.good (); - retval(0) = buf.str (); - } + // Return empty string if no error occured. + retval(2) = curl.good () ? "" : curl.lasterror (); + retval(1) = curl.good (); + retval(0) = buf.str (); } if (nargout < 2 && ! curl.good ()) diff -r 7a1a71e3f328 -r a91654d70f99 libinterp/parse-tree/lex.ll --- a/libinterp/parse-tree/lex.ll Wed Jan 22 22:47:14 2014 -0800 +++ b/libinterp/parse-tree/lex.ll Thu Jan 23 03:43:41 2014 -0500 @@ -2313,6 +2313,8 @@ if (kw) { + bool previous_at_bos = at_beginning_of_statement; + // May be reset to true for some token types. at_beginning_of_statement = false; @@ -2346,7 +2348,10 @@ && (defining_func && ! (looking_at_return_list || parsed_function_name.top ())))) - return 0; + { + at_beginning_of_statement = previous_at_bos; + return 0; + } tok_val = new token (end_kw, token::simple_end, l, c); at_beginning_of_statement = true; @@ -2448,7 +2453,10 @@ // 'get' and 'set' are keywords in classdef method // declarations. if (! maybe_classdef_get_set_method) - return 0; + { + at_beginning_of_statement = previous_at_bos; + return 0; + } break; case enumeration_kw: @@ -2458,7 +2466,10 @@ // 'properties', 'methods' and 'events' are keywords for // classdef blocks. if (! parsing_classdef) - return 0; + { + at_beginning_of_statement = previous_at_bos; + return 0; + } // fall through ... case classdef_kw: