[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51950] sparse qr may return a malformed spars
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries |
Date: |
Wed, 6 Sep 2017 19:27:51 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
Follow-up Comment #9, bug #51950 (project octave):
The code in question is at line 271 of sparse-qr.cc
template <>
SparseMatrix
sparse_qr<SparseMatrix>::sparse_qr_rep::R (bool econ) const
{
#if defined (HAVE_CXSPARSE)
// Drop zeros from R and sort
// FIXME: Is the double transpose to sort necessary?
BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
CXSPARSE_DNAME (_dropzeros) (N->U);
CXSPARSE_DNAME () *D = CXSPARSE_DNAME (_transpose) (N->U, 1);
CXSPARSE_DNAME (_spfree) (N->U);
N->U = CXSPARSE_DNAME (_transpose) (D, 1);
CXSPARSE_DNAME (_spfree) (D);
END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
octave_idx_type nc = N->U->n;
octave_idx_type nz = N->U->nzmax;
SparseMatrix ret ((econ ? (nc > nrows ? nrows : nc) : nrows), nc, nz);
for (octave_idx_type j = 0; j < nc+1; j++)
ret.xcidx (j) = N->U->p[j];
for (octave_idx_type j = 0; j < nz; j++)
{
ret.xridx (j) = N->U->i[j];
ret.xdata (j) = N->U->x[j];
}
return ret;
I used gdb to step through the code and display ret before it is returned.
display-sparse-array ret
sparse object: {<MSparse<double>> = {<Sparse<double>> = {
_vptr.Sparse = 0x7f75c48174e0 <vtable for SparseMatrix+16>, rep =
0x606000e4f500,
dimensions = {rep = 0x6030003b0db0}}, <No data fields>}, <No data
fields>}
dimensions.rep[0] = ndims: 2
dims: {5, 6}
dimensions.rep[1] = 6
rep = {d = 0x6030003b0e00, r = 0x6030003b0dd0, c = 0x606000e4f4a0, nzmx = 3,
nrows = 5,
ncols = 6, count = {count = 1}}
rep.d = {-0.80000000000000004, -1.3999999999999999, 0.5}
rep.r = {0, 1, 5}
rep.c = {0, 1, 2, 2, 2, 2, 3}
(gdb) p N->U->i[2]
$26 = 5
(gdb) p N->U->i[1]
$27 = 1
(gdb) p N->U->i[0]
$28 = 0
So it is the output of the library code in N that is the problem. I don't
know if we are not feeding the QR factorization the right values, or whether
it is this sort routine that is the problem
BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
CXSPARSE_DNAME (_dropzeros) (N->U);
CXSPARSE_DNAME () *D = CXSPARSE_DNAME (_transpose) (N->U, 1);
CXSPARSE_DNAME (_spfree) (N->U);
N->U = CXSPARSE_DNAME (_transpose) (D, 1);
CXSPARSE_DNAME (_spfree) (D);
END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51950>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #51950] Segfault during a sparse QR factorization, Joseph Young, 2017/09/05
- [Octave-bug-tracker] [bug #51950] Segfault during a sparse QR factorization, Doug Stewart, 2017/09/05
- [Octave-bug-tracker] [bug #51950] Segfault during a sparse QR factorization, Dmitri A. Sergatskov, 2017/09/05
- [Octave-bug-tracker] [bug #51950] Segfault during a sparse QR factorization, Marco Caliari, 2017/09/06
- [Octave-bug-tracker] [bug #51950] Segfault during a sparse QR factorization, Mike Miller, 2017/09/06
- [Octave-bug-tracker] [bug #51950] Segfault during a sparse QR factorization, Mike Miller, 2017/09/06
- [Octave-bug-tracker] [bug #51950] Segfault during a sparse QR factorization, Mike Miller, 2017/09/06
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Mike Miller, 2017/09/06
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Marco Caliari, 2017/09/06
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Rik, 2017/09/06
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries,
Rik <=
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Rik, 2017/09/06
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Dmitri A. Sergatskov, 2017/09/07
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Joseph Young, 2017/09/07
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Marco Caliari, 2017/09/07
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Joseph Young, 2017/09/09
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Rik, 2017/09/09
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Dmitri A. Sergatskov, 2017/09/09
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Dmitri A. Sergatskov, 2017/09/09
- [Octave-bug-tracker] [bug #51950] sparse qr may return a malformed sparse matrix R with out of bounds entries, Rik, 2017/09/24