blas error and crash when doing ldivide/rdivide of a scalar by a vector

Jason Riedy ejr at cs.berkeley.edu
Sun Jan 13 17:51:41 CST 2008


And Carlo de Falco writes:
> Bug report for Octave 3.0.0 configured for i386-apple-darwin8.9.1

Erg.  No, it appears to be an LAPACK bug.  Sorry.

> "Parameter 10 to routine DGEBRD was incorrect
> Mac OS BLAS parameter error in DGEBRD, parameter #0, (unavailable),
> is 0"

The workspace computation in xGELSD doesn't match the usage later
in the function.  The workspace query goes for "Path 2a" but
generates an LWORK that triggers "Path 2".  I've appended a quick
workaround inside LAPACK that should generalize to a workaround
in Octave; it's also the message going to the other LAPACK folks.

Since I haven't traced through what's *supposed* to happen, there
may still be a bug lurking.  But at least the easy test works.

Thanks for the perfect test case!

Jason

--
>From 9b319fff78a6f5b6fdf19c87ccf05de1e89c828c Mon Sep 17 00:00:00 2001
From: Jason Riedy <ejr at cs.berkeley.edu>
Date: Sun, 13 Jan 2008 15:36:40 -0800
Subject: [PATCH] Work-around a xGELSD workspace computation bug.

Reported by Carlo de Falco <carlo.defalco at gmail.com> in
bug-octave at octave.org[1].  The following command triggers the
problem:
  octave --eval 'for n=1:1000, x = ones(1,n)\1; endfor'

It appears that the workspace query decides to take "Path 2a"
but doesn't return an LWORK big enough to trigger "Path 2a"
later in the code.  This hack just maxes LWORK with the "Path 2a"
threshold.  The resulting LWORK may be bigger than intended, but
I haven't followed through all the sizes.

I also don't know why dgelsd is indented differently.  Could
someone look at this?

Jason

[1] Message-ID: <E39CE342-6A7A-4490-83F7-26D69C10DFCF at gmail.com>
---
 SRC/cgelsd.f |    4 ++++
 SRC/dgelsd.f |    4 ++++
 SRC/sgelsd.f |    4 ++++
 SRC/zgelsd.f |    4 ++++
 4 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/SRC/cgelsd.f b/SRC/cgelsd.f
index 25316b8..157602f 100644
--- a/SRC/cgelsd.f
+++ b/SRC/cgelsd.f
@@ -261,6 +261,10 @@
                      MAXWRK = MAX( MAXWRK, M*M + 2*M )
                   END IF
                   MAXWRK = MAX( MAXWRK, M*M + 4*M + M*NRHS )
+*                 XXX: Ensure this is at least the value used in the threshold
+*                 below for executing path 2a.
+                  MAXWRK = MAX( MAXWRK,
+     $                 4*M+M*M+MAX( M, 2*M-4, NRHS, N-3*M ) )
                ELSE
 *
 *                 Path 2 - underdetermined.
diff --git a/SRC/dgelsd.f b/SRC/dgelsd.f
index 123e5ea..d628eab 100644
--- a/SRC/dgelsd.f
+++ b/SRC/dgelsd.f
@@ -240,6 +240,10 @@
                MAXWRK = MAX( MAXWRK, M+NRHS*
      $                  ILAENV( 1, 'DORMLQ', 'LT', N, NRHS, M, -1 ) )
                MAXWRK = MAX( MAXWRK, M*M+4*M+WLALSD )
+*              XXX: Ensure this is at least the value used in the threshold
+*              below for executing path 2a.
+               MAXWRK = MAX( MAXWRK,
+     $              4*M+M*M+MAX( M, 2*M-4, NRHS, N-3*M, WLALSD ) )
             ELSE
 *
 *              Path 2 - remaining underdetermined cases.
diff --git a/SRC/sgelsd.f b/SRC/sgelsd.f
index 851e00b..bcf063a 100644
--- a/SRC/sgelsd.f
+++ b/SRC/sgelsd.f
@@ -246,6 +246,10 @@
                   MAXWRK = MAX( MAXWRK, M + NRHS*ILAENV( 1, 'SORMLQ',
      $                          'LT', N, NRHS, M, -1 ) )
                   MAXWRK = MAX( MAXWRK, M*M + 4*M + WLALSD )
+*                 XXX: Ensure this is at least the value used in the threshold
+*                 below for executing path 2a.
+                  MAXWRK = MAX( MAXWRK,
+     $                 4*M+M*M+MAX( M, 2*M-4, NRHS, N-3*M, WLALSD ) )
                ELSE
 *
 *                 Path 2 - remaining underdetermined cases.
diff --git a/SRC/zgelsd.f b/SRC/zgelsd.f
index 4a68402..a2685b3 100644
--- a/SRC/zgelsd.f
+++ b/SRC/zgelsd.f
@@ -260,6 +260,10 @@
                      MAXWRK = MAX( MAXWRK, M*M + 2*M )
                   END IF
                   MAXWRK = MAX( MAXWRK, M*M + 4*M + M*NRHS )
+*                 XXX: Ensure this is at least the value used in the threshold
+*                 below for executing path 2a.
+                  MAXWRK = MAX( MAXWRK,
+     $                4*M+M*M+MAX( M, 2*M-4, NRHS, N-3*M ) )
                ELSE
 *
 *                 Path 2 - underdetermined.
-- 
1.5.4.rc2.1097.gb6e0d



More information about the Bug-octave mailing list