# HG changeset patch # User Arun Giridhar # Date 1714695192 14400 # Node ID cf71a40131dc483ac6a572957e7375bc9bf3271c # Parent cb5a5349a87934f60f7050c441ae659298b2b472# Parent c1e5ee7d07b55b6c553e483af9c0e623df7e3135 maint: Merge default to bytecode-interpreter diff -r cb5a5349a879 -r cf71a40131dc doc/interpreter/expr.txi --- a/doc/interpreter/expr.txi Wed May 01 22:15:33 2024 -0400 +++ b/doc/interpreter/expr.txi Thu May 02 20:13:12 2024 -0400 @@ -1430,7 +1430,7 @@ Assignments may be made with fewer specified elements than would be required to fill the newly expanded array as long as the assignment is unambiguous. In -these cases the array will be automatically padded with @i{null} values: +these cases the array will be automatically padded with @emph{null} values: @example @group >> a = [1, 2] @@ -1451,7 +1451,7 @@ @end group @end example -For all built-in types, the @i{null} value will be appropriate to that object +For all built-in types, the @emph{null} value will be appropriate to that object type. Numeric arrays: diff -r cb5a5349a879 -r cf71a40131dc doc/interpreter/intro.txi --- a/doc/interpreter/intro.txi Wed May 01 22:15:33 2024 -0400 +++ b/doc/interpreter/intro.txi Thu May 02 20:13:12 2024 -0400 @@ -52,19 +52,24 @@ @node Running Octave @section Running Octave -On most systems, Octave is started with the shell command @samp{octave}. -This starts the graphical user interface. The central window in the GUI -is the Octave command-line interface. In this window Octave displays an -initial message and then a prompt indicating it is ready to accept -input. If you have chosen the traditional command-line interface then -only the command prompt appears in the same window that was running -a shell. In either case, you can immediately begin typing Octave -commands. +If you installed Octave from an installer program, it will likely have +created some icons on your desktop for you to start Octave, either with +the graphical user interface (GUI) or a command line interface (CLI). +You can also typically find Octave in the "Start Menu" or equivalent +of your computer. You can also type @code{octave} in a command shell; +as long as you have Octave in your path, it will start. + +If you start Octave with the GUI, the central window is the Octave's +own command-line interface (also called a REPL by other programming languages +for Read-Evaluate-Print-Loop). In this window Octave displays an +initial message and then a prompt like @code{>> } or @code{octave:1> } +indicating it is ready to accept input. If you have chosen the traditional +command-line interface then the command prompt appears in the same window +that was running a command shell. In either case, you can immediately begin +typing Octave commands. If you get into trouble, you can usually interrupt Octave by typing -@kbd{Control-C} (written @kbd{C-c} for short). @kbd{C-c} gets -its name from the fact that you type it by holding down @key{CTRL} and -then pressing @key{c}. Doing this will normally return you to Octave's +@kbd{Control-C}. Doing this will normally return you to Octave's prompt. @cindex exiting octave @@ -72,7 +77,7 @@ To exit Octave, type @kbd{quit} or @kbd{exit} at the Octave prompt. On systems that support job control, you can suspend Octave by sending -it a @code{SIGTSTP} signal, usually by typing @kbd{C-z}. +it a @code{SIGTSTP} signal, usually by typing @kbd{Ctrl-z}. @node Simple Examples @section Simple Examples @@ -83,8 +88,10 @@ If you are new to Octave, we recommend that you try these examples to begin learning Octave by using it. Lines marked like so, -@samp{octave:13>}, are lines you type, ending each with a carriage -return. Octave will respond with an answer, or by displaying a graph. +@samp{octave:13>} or @samp{>> }, are lines you type, ending each with a +carriage return. (Don't type the text @samp{octave:13>} itself! That is only +the Octave prompt, which also looks like @code{>> } in the GUI. +Octave will respond to your commands with an answer, or by displaying a graph. @subsection Elementary Calculations diff -r cb5a5349a879 -r cf71a40131dc libgui/src/gui-preferences-ws.h --- a/libgui/src/gui-preferences-ws.h Wed May 01 22:15:33 2024 -0400 +++ b/libgui/src/gui-preferences-ws.h Thu May 02 20:13:12 2024 -0400 @@ -54,14 +54,6 @@ QT_TRANSLATE_NOOP ("octave::workspace_view", "Attribute") }; -const QStringList ws_columns_shown_keys = -{ - "workspaceview/show_class", - "workspaceview/show_dimension", - "workspaceview/show_value", - "workspaceview/show_attribute" -}; - extern gui_pref ws_max_filter_history; extern gui_pref ws_color_mode; diff -r cb5a5349a879 -r cf71a40131dc libgui/src/gui-settings.cc --- a/libgui/src/gui-settings.cc Wed May 01 22:15:33 2024 -0400 +++ b/libgui/src/gui-settings.cc Thu May 02 20:13:12 2024 -0400 @@ -473,7 +473,6 @@ } return max_style; } -#endif /*! * Copys the attributes bold, italic and underline from QFont @@ -494,7 +493,6 @@ return dest; } -#if defined (HAVE_QSCINTILLA) void gui_settings::read_lexer_settings (QsciLexer *lexer, int mode, int def) { diff -r cb5a5349a879 -r cf71a40131dc libgui/src/m-editor/octave-qscintilla.cc --- a/libgui/src/m-editor/octave-qscintilla.cc Wed May 01 22:15:33 2024 -0400 +++ b/libgui/src/m-editor/octave-qscintilla.cc Thu May 02 20:13:12 2024 -0400 @@ -894,14 +894,13 @@ if (line.startsWith ("%!")) // Handle tests and demos { - // Do not remove %! if keyword is directly following. - // Exception: assert - { - // assert might be used without leading space - line.replace (QRegularExpression("^%!assert(\\s*)([^\\s]+)"), "assert\\1\\2"); - // Remove "%! " - line.replace (QRegularExpression("^%!\\s+"), ""); - } + // Do not remove "%!" if keyword (e.g., "test", "demo", etc.) is + // directly following. Exception is "assert". + // assert might be used without leading space + line.replace (QRegularExpression ("^%!assert(\\s*)([^\\s]+)"), + "assert\\1\\2"); + // Remove "%! " from body of test/demo block + line.replace (QRegularExpression ("^%!\\s+"), ""); } QString line_escaped = line; diff -r cb5a5349a879 -r cf71a40131dc libgui/src/workspace-view.cc --- a/libgui/src/workspace-view.cc Wed May 01 22:15:33 2024 -0400 +++ b/libgui/src/workspace-view.cc Thu May 02 20:13:12 2024 -0400 @@ -53,7 +53,8 @@ m_view (new QTableView (this)), m_filter_checkbox (new QCheckBox ()), m_filter (new QComboBox (this)), - m_filter_widget (new QWidget (this)) + m_filter_widget (new QWidget (this)), + m_first (true) { set_title (tr ("Workspace")); setStatusTip (tr ("View the variables in the active workspace.")); @@ -149,13 +150,6 @@ if (! p) make_window (); - - // Initialize column order and width of the workspace. From this post, - // https://www.qtcentre.org/threads/26675-QTableView-saving-restoring-columns-widths - // this might fail if done directly in the constructor. This effect shows - // up in the GUI since Qt 6.6.x. As a solution, the following timer ensures - // that the header is restored when the event loop is idle. - QTimer::singleShot (0, this, SLOT(restore_header_state ())); } void @@ -194,10 +188,17 @@ { gui_settings settings; - m_model->notice_settings (); // update colors of model first + if (m_first) + m_first = false; + else + { + // Save current state in case some settings are messing up the state + settings.setValue (ws_column_state.settings_key (), + m_view->horizontalHeader ()->saveState ()); + settings.sync (); + } - for (int i = 0; i < ws_columns_shown.length (); i++) - m_view->setColumnHidden (i + 1, ! settings.value (ws_columns_shown_keys.at (i), true).toBool ()); + m_model->notice_settings (); // update colors of model first QString tool_tip; @@ -219,6 +220,14 @@ } setToolTip (tool_tip); + + // Initialize column order, visibility and width of the file browser. From this post, + // https://www.qtcentre.org/threads/26675-QTableView-saving-restoring-columns-widths + // this might fail if done directly after other actions. This effect shows + // up in the GUI since Qt 6.6.x. As a solution, the following timer ensures + // that the header is restored when the event loop is idle. + + QTimer::singleShot (0, this, SLOT(restore_header_state ())); } void @@ -311,7 +320,7 @@ &sig_mapper, SLOT (map ())); sig_mapper.setMapping (action, i); action->setCheckable (true); - action->setChecked (settings.value (ws_columns_shown_keys.at (i), true).toBool ()); + action->setChecked (! m_view->isColumnHidden (i+1)); } #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) @@ -328,17 +337,7 @@ void workspace_view::toggle_header (int col) { - gui_settings settings; - - QString key = ws_columns_shown_keys.at (col); - bool shown = settings.value (key, true).toBool (); - - m_view->setColumnHidden (col + 1, shown); - - settings.setValue (key, ! shown); - settings.sync (); - - octave_dock_widget::save_settings (); + m_view->setColumnHidden (col + 1, ! m_view->isColumnHidden (col + 1)); } void diff -r cb5a5349a879 -r cf71a40131dc libgui/src/workspace-view.h --- a/libgui/src/workspace-view.h Wed May 01 22:15:33 2024 -0400 +++ b/libgui/src/workspace-view.h Thu May 02 20:13:12 2024 -0400 @@ -126,6 +126,7 @@ QComboBox *m_filter; QWidget *m_filter_widget; bool m_filter_shown; + bool m_first; }; OCTAVE_END_NAMESPACE(octave) diff -r cb5a5349a879 -r cf71a40131dc libinterp/corefcn/sqrtm.cc --- a/libinterp/corefcn/sqrtm.cc Wed May 01 22:15:33 2024 -0400 +++ b/libinterp/corefcn/sqrtm.cc Thu May 02 20:13:12 2024 -0400 @@ -58,25 +58,21 @@ const octave_idx_type n = m.rows (); real_matrix_type abs_m = m.abs (); - real_elt_type max_abs_diag = 0; - for (octave_idx_type i = 0; i < n; i++) - max_abs_diag = std::max (max_abs_diag, abs_m(i,i)); + real_elt_type max_abs_diag = abs_m.diag ().max ()(0); const real_elt_type tol = n * max_abs_diag * std::numeric_limits::epsilon (); - for (octave_idx_type j = 0; j < n; j++) - { - for (octave_idx_type i = j-1; i >= 0; i--) - { + for (octave_idx_type j = 0; j < n && diagonal; j++) + { + for (octave_idx_type i = j-1; i >= 0; i--) + { if (abs_m(i,j) > tol) { diagonal = false; break; } } - if (! diagonal) - break; } element_type *mp = m.rwdata (); diff -r cb5a5349a879 -r cf71a40131dc scripts/linear-algebra/cross.m --- a/scripts/linear-algebra/cross.m Wed May 01 22:15:33 2024 -0400 +++ b/scripts/linear-algebra/cross.m Thu May 02 20:13:12 2024 -0400 @@ -68,11 +68,11 @@ nd = ndims (x); if (nargin < 3 && nd < 3 && ndims (y) < 3) - ## COMPATIBILITY -- mixed row/column vector inputs + ## Matlab Compatibility: mixed row/column vector inputs. ## Transpose x and y in the assignments below to get row output to match - ## matlab behavior (verified version: 2023b). - ## Recommend users instead ensure calling code has matched vectors to - ## remove any ambiguity in output form. + ## Matlab behavior (verified version: 2023b). + ## Recommend instead that programmers change calling code to use matched + ## vectors to remove any ambiguity in output form. if (columns (x) == 1 && rows (y) == 1) warning ("cross: cross product of column by row produces row output"); x = x.'; diff -r cb5a5349a879 -r cf71a40131dc scripts/plot/appearance/view.m --- a/scripts/plot/appearance/view.m Wed May 01 22:15:33 2024 -0400 +++ b/scripts/plot/appearance/view.m Thu May 02 20:13:12 2024 -0400 @@ -81,7 +81,7 @@ [az, el] = cart2sph (x(2), x(1), x(3)); if (x(1) == 0) - ## Compatability change to force +0 azimuth instead of +/-0 or + ## Matlab Compatibility: Force +0 azimuth instead of +/-0 or ## +/-180deg azimuth for z-aligned vector. az = 0; endif diff -r cb5a5349a879 -r cf71a40131dc scripts/set/unique.m --- a/scripts/set/unique.m Wed May 01 22:15:33 2024 -0400 +++ b/scripts/set/unique.m Thu May 02 20:13:12 2024 -0400 @@ -227,16 +227,13 @@ endif endif - ## Calculate i and j outputs (2nd and 3rd outputs) if (nargout > 1) - if (optsorted) - idx = find (match); if (! optlegacy && optfirst) - idx += 1; # in-place is faster than other forms of increment + idx += 1; endif i = j; @@ -245,9 +242,7 @@ if (nargout > 2) j(j) = cumsum (! [false; match(:)]); endif - else - ## Get inverse of sort index j so that sort(x)(k) = x(j)(k) = x. k = j; # cheap way to copy dimensions k(j) = 1:n; @@ -275,25 +270,23 @@ ni = numel (i); - u = find (uniquex); # Linear index of unique elements of sort(x) - l = u(cumsum (uniquex)); # Expand u for all elements in sort(x) + u = find (uniquex); # Linear index of unique elements of sort(x) + l = u(cumsum (uniquex)); # Expand u for all elements in sort(x) - p = j; # cheap way to copy dimensions - p(i) = 1:ni; # set p to contain the vector positions of i. + p = j; # cheap way to copy dimensions + p(i) = 1:ni; # set p to contain the vector positions of i. - j = p(j(l(k))); # Replace j with 3rd output mapping y->x. - + j = p(j(l(k))); # Replace j with 3rd output mapping y->x. endif endif if (optlegacy && isrowvec) i = i.'; - if (nargout > 2) j = j.'; endif + endif - endif endif endfunction @@ -461,4 +454,3 @@ %!error unique ({"a", "b", "c"}, "rows", "UnknownOption2") %!error unique ({"a", "b", "c"}, "UnknownOption1", "last") %!warning <"rows" is ignored for cell arrays> unique ({"1"}, "rows"); -