|
From: <ap...@us...> - 2025-12-09 06:08:19
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Maxima CAS".
The branch, master has been updated
via 1406e6ed34252b55cfe2b9caf2accd7aad8062fa (commit)
from 1c6a095f833c3b3e15d13880c2476065a09bf9cf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1406e6ed34252b55cfe2b9caf2accd7aad8062fa
Author: Robert Dodier <rob...@so...>
Date: Mon Dec 8 22:07:44 2025 -0800
New flag display_matrix_padding_vertical to control between-rows padding for matrix display.
Default value is true (blank line between rows).
When false, omit the blank line; rows are adjacent.
This commit includes a reference manual item and
some examples in tests/test_matrix_display.mac.
Incidentally silence a warning about the unused variable
DUMMY in the function definition for DIM-MBOX-OR-MLABOX.
diff --git a/doc/info/Matrices.texi.m4 b/doc/info/Matrices.texi.m4
index 4a4792ecc..b30582984 100644
--- a/doc/info/Matrices.texi.m4
+++ b/doc/info/Matrices.texi.m4
@@ -1622,6 +1622,58 @@ only the matrix elements are displayed.
@end deffn
+@c -----------------------------------------------------------------------------
+@anchor{display_matrix_padding_vertical}
+@deffn {Option variable} display_matrix_padding_vertical
+Default value: @code{true}
+
+When @code{display_matrix_padding_vertical} is @code{true},
+matrices are displayed with an empty line between successive rows.
+
+When @code{display_matrix_padding_vertical} is @code{false},
+matrices are not displayed with an empty line between successive rows;
+successive rows are immediately adjacent to each other.
+
+Examples:
+
+@c ===beg===
+@c display_matrix_padding_vertical;
+@c foo: matrix ([a, b, c], [d, e, f], [g, h, i]);
+@c display_matrix_padding_vertical: false;
+@c foo;
+@c ===end===
+@example maxima
+@group
+(%i1) display_matrix_padding_vertical;
+(%o1) true
+(%i2) foo: matrix ([a, b, c], [d, e, f], [g, h, i]);
+ ┌ ┐
+ │ a b c │
+ │ │
+(%o2) │ d e f │
+ │ │
+ │ g h i │
+ └ ┘
+@end group
+@group
+(%i3) display_matrix_padding_vertical: false;
+(%o3) false
+(%i4) foo;
+ ┌ ┐
+ │ a b c │
+(%o4) │ d e f │
+ │ g h i │
+ └ ┘
+@end group
+@end example
+
+@opencatbox{Categories:}
+@category{Matrices}
+@category{Display flags and variables}
+@closecatbox
+
+@end deffn
+
@c -----------------------------------------------------------------------------
@anchor{matrix}
@deffn {Function} matrix (@var{row_1}, @dots{}, @var{row_n})
@@ -1666,7 +1718,8 @@ See @mrefcomma{eigenvalues} @mrefcomma{eigenvectors} @mrefcomma{determinant}@w{}
@mrefcomma{echelon} and @mrefdot{rank}
@c CHECK -- WE PROBABLY WANT EXHAUSTIVE LIST HERE
-@mref{display_matrix_brackets} governs the display of matrices.
+Option variables @mref{display_matrix_brackets} and @mref{display_matrix_padding_vertical}
+govern the display of matrices.
Examples:
diff --git a/src/displa.lisp b/src/displa.lisp
index 353f727f0..10b7bdf73 100644
--- a/src/displa.lisp
+++ b/src/displa.lisp
@@ -1201,6 +1201,7 @@
(displa-def %matrix dim-$matrix)
(defmvar $display_matrix_brackets t)
+(defmvar $display_matrix_padding_vertical t)
(defun dim-$matrix (form result)
(prog (dmstr rstr cstr consp cols)
@@ -1227,7 +1228,7 @@
(do ((c (cdar r) (cdr c))
(nc dmstr (cdr nc))
(cs cstr (cdr cs)) (dummy) (h2 0) (d2 0))
- ((null c) (setq d1 (+ d1 h1 h2) h1 (1+ d2)))
+ ((null c) (setq d1 (+ (if (or $display_matrix_padding_vertical (null rstr)) d1 (1- d1)) h1 h2) h1 (1+ d2)))
(setq dummy (dimension (car c) nil 'mparen 'mparen nil 0)
h2 (max h2 height) d2 (max d2 depth))
(cond ((not (checkfit (+ 14. width))) (setq consp t) (return nil))
@@ -1283,7 +1284,7 @@
(displa-def mbox dim-mbox-or-mlabox)
(displa-def %mbox dim-mbox-or-mlabox)
-(defun dim-mbox-or-mlabox (form result &aux dummy)
+(defun dim-mbox-or-mlabox (form result)
(if (= (length form) 3)
(dim-mlabox form result)
(dim-mbox form result)))
diff --git a/tests/test_matrix_display.mac b/tests/test_matrix_display.mac
index d20617023..87e9e6c6f 100644
--- a/tests/test_matrix_display.mac
+++ b/tests/test_matrix_display.mac
@@ -143,3 +143,15 @@ print (recip_abs_box_foo3) $
print (recip_abs_box_foo4) $
print (recip_abs_box_foo5) $
+display_matrix_padding_vertical: false;
+
+recip_abs_box_foo5;
+print (recip_abs_box_foo5);
+
+blurf: print (box (genmatrix (lambda ([i, j], x^i/sum (y[k], k, 1, j)), 8, 5)));
+
+display_matrix_brackets: true;
+
+print (blurf);
+
+reset ();
-----------------------------------------------------------------------
Summary of changes:
doc/info/Matrices.texi.m4 | 55 ++++++++++++++++++++++++++++++++++++++++++-
src/displa.lisp | 5 ++--
tests/test_matrix_display.mac | 12 ++++++++++
3 files changed, 69 insertions(+), 3 deletions(-)
hooks/post-receive
--
Maxima CAS
|