From: David B. <Dav...@mo...> - 2003-07-24 09:25:38
|
Dear Ramine, Firstly this is clearly an octave-forge problem and not one in octave itself. The problem is that SuperLU behaves badly if the matrix is singular, as any matrix with only one element (as in your case) is. As a test spinv(sparse([1 1], [1 2], [1 1], 3, 3)) will also crash. Using gdb on your case gives. % gdb octave (gdb) run octave:1> b=sprand(3,3,.1); octave:2> c=[1,1,1]' c = 1 1 1 octave:3> b\c Program received signal SIGSEGV, Segmentation fault. 0x41398d27 in dpivotL (jcol=1, u=1, usepr=0xbfffe340, perm_r=0x8b9c918, iperm_r=0x0, iperm_c=0x8b90778, pivrow=0xbfffe344, Glu=0x413c2900) at SuperLU/SRC/dpivotL.c:122 122 perm_r[*pivrow] = jcol; (gdb) back #0 0x41398d27 in dpivotL (jcol=1, u=1, usepr=0xbfffe340, perm_r=0x8b9c918, iperm_r=0x0, iperm_c=0x8b90778, pivrow=0xbfffe344, Glu=0x413c2900) at SuperLU/SRC/dpivotL.c:122 #1 0x41395e91 in dgstrf (refact=0xbfffe3fb "N\230\"<A\004", A=0xbfffe400, diag_pivot_thresh=1, drop_tol=0, relax=5, panel_size=10, etree=0x8b9c968, work=0x0, lwork=0, perm_r=0x8b9c918, perm_c=0x8b9c908, L=0xbfffe580, U=0xbfffe560, info=0xbfffe47c) at SuperLU/SRC/dgstrf.c:308 #2 0x41395847 in dgssv (A=0xbfffe5c0, perm_c=0x8b9c908, perm_r=0x8b9c918, L=0xbfffe580, U=0xbfffe560, B=0xbfffe540, info=0xbfffe47c) at SuperLU/SRC/dgssv.c:175 #3 0x4137114a in oct_binop_s_f_ldiv(octave_value const&, octave_value const&) (a1=@0x8bda570, a2=@0x8988c10) at sparse_ops.cc:1014 #4 0x4017a636 in do_binary_op(octave_value::binary_op, octave_value const&, octave_value const&) (op=op_ldiv, v1=@0xbfffe700, v2=@0xbfffe710) at ov.h:246 #5 0x4019382f in tree_binary_expression::rvalue() (this=0x8b9c860) at ov.h:246 #6 0x401932df in tree_binary_expression::rvalue(int) (this=0x8b9c860, nargout=0) at oct-obj.h:50 #7 0x401b8a29 in tree_statement::eval(bool, int, bool) (this=0x8bc7d08, silent=false, nargout=0, in_function_body=0) at oct-obj.h:78 #8 0x401b8f61 in tree_statement_list::eval(bool, int) (this=0x8b9c888, silent=false, nargout=0) at oct-obj.h:78 #9 0x40140634 in main_loop(std::string const&) (fun_to_call=@0x40377f48) at toplev.cc:155 #10 0x401d4ef2 in octave_main (argc=1, argv=0xbfffec44, embedded=0) at octave.cc:612 #11 0x08049948 in main (argc=1, argv=0xbfffec44) at main.c:35 #12 0x40fe2280 in __libc_start_main () from /lib/libc.so.6 So *pivrow in dpivotL is greater than 2 in your case.... The only real solution I can suggest is to write an oct-file that calls the [dz]gscon function of SuperLU first to test the condition number before trying a solution. In the long run the only real solution is to modify SuperLU so that it gracefully fails on badly conditioned matrices. Alternatively in the ldiv and inverse functions of the octave-forge package call [dz]gscon prior to the left-division or inverse to ensure a well conditioned matrix.. Regards David -- David Bateman Dav...@mo... Motorola CRM +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary |