[bug #68434] Function gsvd crashes when matrices have 10 or more columns

"Dmitri A. Sergatskov" <[email protected]> Mon, 15 Jun 2026 17:18:32 -0400 (EDT)
Newsgroups gmane.comp.gnu.octave.bugs
Message-ID <[email protected]>
Please use the bug tracker to post updates to a bug report.  The mailing list is intended as a read-only notification stream.  Info posted to this mailing list address won't appear in the tracker database where it is most useful.

Follow-up Comment #17, bug #68434 (group octave):

Attached CSET (file bug68434_gsvd_20260615_100.cset) fixes both memory
corruption and code algorithm problem.

octave:1> M = 4; P = 2; N = 8;
octave:2> A = [1:8; 1:8; 1:8; 1:8];
octave:3> B = [8:-1:1; 8:-1:1];
octave:4>  [U, V, X, C, S] = gsvd (A, B)
U =

  -5.0000e-01  -8.6603e-01  -5.6156e-17  -2.5375e-17
  -5.0000e-01   2.8868e-01   8.1650e-01  -9.0181e-17
  -5.0000e-01   2.8868e-01  -4.0825e-01  -7.0711e-01
  -5.0000e-01   2.8868e-01  -4.0825e-01   7.0711e-01

V =

  -0.7071  -0.7071
  -0.7071   0.7071

X =

   -2.0000  -11.3137         0         0         0         0         0
0
   -4.0000   -9.8995         0         0         0         0         0
0
   -6.0000   -8.4853         0         0         0         0         0
0
   -8.0000   -7.0711         0         0         0         0         0
0
  -10.0000   -5.6569         0         0         0         0         0
0
  -12.0000   -4.2426         0         0         0         0         0
0
  -14.0000   -2.8284         0         0         0         0         0
0
  -16.0000   -1.4142         0         0         0         0         0
0

C =

   1.0000        0        0        0        0        0        0        0
        0   0.0000        0        0        0        0        0        0
        0        0        0        0        0        0        0        0
        0        0        0        0        0        0        0        0

S =

   0   1   0   0   0   0   0   0
   0   0   0   0   0   0   0   0

octave:5> A - U * C * X'
ans =

  -1.7764e-15  -8.8818e-16            0  -8.8818e-16  -8.8818e-16  -1.7764e-15
           0            0
            0   6.6613e-16   1.3323e-15   4.4409e-16            0  -8.8818e-16
           0            0
            0   6.6613e-16   1.3323e-15   4.4409e-16            0  -8.8818e-16
           0            0
            0   6.6613e-16   1.3323e-15   4.4409e-16            0  -8.8818e-16
           0            0

octave:6> B - V * S * X'
ans =

   1.7764e-15   4.4409e-15   1.7764e-15   2.6645e-15   1.7764e-15   8.8818e-16
  8.8818e-16  -8.8818e-16
  -1.7764e-15   1.7764e-15            0   1.7764e-15   8.8818e-16            0
  4.4409e-16  -1.3323e-15

octave:7> 



This probably should go to stable branch. I have some further improvements to
gsvd code (mostly Matlab compatibility) but that will go, eventually, to
48807
https://savannah.gnu.org/bugs/?48807
(and to dev branch)

Dmitri.
-- 


(file #58721)

    _______________________________________________________

Additional Item Attachment:

Name: bug68434_gsvd_20260615_100.cset Size: 9.6KiB

<https://file.savannah.gnu.org/file/bug68434_gsvd_20260615_100.cset?file_id=58721>


    AGPL NOTICE

These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://git.savannah.nongnu.org/cgit/administration/savane.git/snapshot/savane-c36938be85ff6c1b727bc7dd7fd30e48f9142870.tar.gz


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68434>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCajBsKAAKCRCqLAuaBUf3
TnA4APwNmL3sU4LIcjC8kpJ183L+pOtob79OQupqciw9jVXTAQD+Obpjs1Tl6008
hfufElVWKua8821htim7csFVMwxatAw=
=0ELg
-----END PGP SIGNATURE-----