Please edit /home/shhu/Documents/SageMath/local/lib/python2.7/site- packages/sage/graphs/lovasz_theta.py to insert
print "output was: ", lines after "lines = subprocess.check_output(...)" remove /home/shhu/Documents/SageMath/local/lib/python2.7/site- packages/sage/graphs/lovasz_theta.pyc and start Sage again. Post the output of the result. Hopefully it will explain (perhaps it does return some 'NaN' for some reason or something like this...) ------------------------------------------------------- I presume you run Linux. Which version, what hadware? What Sage version? Post the output of cat /proc/cpuinfo The next step would be to create the input file for this graph for the executable theta and run it in the shell, without invoking Sage. On Tuesday, May 10, 2016 at 5:52:03 PM UTC+1, Sihuang Hu wrote: > > $sage -sh > > Starting subshell with Sage environment variables set. Don't forget > to exit when you are done. Beware: > * Do not do anything with other copies of Sage on your system. > * Do not use this for installing Sage packages using "sage -i" or for > running "make" at Sage's root directory. These should be done > outside the Sage shell. > > Bypassing shell configuration files... > > Note: SAGE_ROOT=/home/shhu/Documents/SageMath > (sage-sh) shhu@shhu-ee-tau:Program$ theta > Usage: > > theta <graph> > ----------------------------------------------------------------- > I have 'csdp' installed, and this theta function works for many other > graphs. > However, it doesn't work for this graph... > > > 在 2016年5月10日星期二 UTC+3下午7:45:24,Dima Pasechnik写道: >> >> and on other graphs either? >> (e.g. on graphs.CycleGraph(7)) >> >> Start sage prompt (sage -sh) and check that you have the program called >> theta available: >> $ sage -sh >> >> Starting subshell with Sage environment variables set. Don't forget >> to exit when you are done. Beware: >> * Do not do anything with other copies of Sage on your system. >> * Do not use this for installing Sage packages using "sage -i" or for >> running "make" at Sage's root directory. These should be done >> outside the Sage shell. >> >> Bypassing shell configuration files... >> >> Note: SAGE_ROOT=/home/dima/software/sage >> (sage-sh) dima@dimpase:~$ theta >> Usage: >> >> theta <graph> >> (sage-sh) dima@dimpase:~$ >> >> ------------- >> if you don't have it then reinstall csdp: >> sage -f csdp >> >> >> >> On Tuesday, May 10, 2016 at 5:14:09 PM UTC+1, Sihuang Hu wrote: >>> >>> It didn't work for me. :( >>> >>> sage: g=Graph([[0,1],[2,3]]) >>> sage: g.lovasz_theta() >>> >>> --------------------------------------------------------------------------- >>> ValueError Traceback (most recent call >>> last) >>> <ipython-input-2-1d4d0397a94f> in <module>() >>> ----> 1 g.lovasz_theta() >>> >>> /home/shhu/Documents/SageMath/local/lib/python2.7/site-packages/sage/graphs/lovasz_theta.pyc >>> >>> in lovasz_theta(graph) >>> 78 tf.close() >>> 79 lines = subprocess.check_output([os.path.join(SAGE_LOCAL, >>> 'bin', 'theta'), tf_name]) >>> ---> 80 return float(lines.split()[-1]) >>> >>> ValueError: could not convert string to float: failed. >>> >>> >>> 在 2016年5月10日星期二 UTC+3下午6:33:50,Dima Pasechnik写道: >>>> >>>> all this works for me just fine: >>>> >>>> sage: g=Graph([[0,1],[2,3]]) >>>> sage: g.lovasz_theta() >>>> 2.0 >>>> sage: G = graphs.CycleGraph(7) >>>> sage: V = Set(G.vertices()) >>>> sage: L = [] >>>> sage: for s in V.subsets(): >>>> ....: L.append(G.subgraph(s)) >>>> ....: >>>> sage: L[68].lovasz_theta() >>>> 2.0 >>>> >>>> Can you try the following: >>>> sage: g=Graph([[0,1],[2,3]]) >>>> sage: g.lovasz_theta() >>>> >>>> >>>> >>>> On Tuesday, May 10, 2016 at 2:32:04 PM UTC+1, Sihuang Hu wrote: >>>>> >>>>> The adjacency matrix of the graph is >>>>> >>>>> [0 1 0 0] >>>>> [1 0 0 0] >>>>> [0 0 0 1] >>>>> [0 0 1 0] >>>>> >>>>> >>>>> 在 2016年5月10日星期二 UTC+3下午4:30:06,Dima Pasechnik写道: >>>>>> >>>>>> What is your L[68] ? >>>>>> This is probably something like a graph without edges... >>>>>> >>>>>> On Tuesday, May 10, 2016 at 1:53:17 PM UTC+1, Sihuang Hu wrote: >>>>>>> >>>>>>> Thanks for the comments. >>>>>>> I have installed package 'csdp' before. I got this error after I >>>>>>> installed it. >>>>>>> >>>>>>> 在 2016年5月10日星期二 UTC+3下午3:32:59,vdelecroix写道: >>>>>>>> >>>>>>>> The error you get is quite strange. On my computer with sage-7.1 I >>>>>>>> got >>>>>>>> >>>>>>>> sage: graphs.CycleGraph(7).lovasz_theta() >>>>>>>> Traceback (most recent call last): ur ... >>>>>>>> PackageNotFoundError: the package 'csdp' was not found. You can >>>>>>>> install >>>>>>>> it by running 'sage -i csdp' in a shell >>>>>>>> >>>>>>>> Which is very explicit about what to do... could you install the >>>>>>>> csdp >>>>>>>> package and try again? >>>>>>>> >>>>>>>> On 10/05/16 06:58, Sihuang Hu wrote: >>>>>>>> > Hi guys, >>>>>>>> > >>>>>>>> > When I try to compute the lovasz theta number of some graph, it >>>>>>>> says that >>>>>>>> > >>>>>>>> > *ValueError: could not convert string to float: failed.:*G = >>>>>>>> > graphs.CycleGraph(7) >>>>>>>> > V = Set(G.vertices()) >>>>>>>> > L = [] >>>>>>>> > for s in V.subsets(): >>>>>>>> > L.append(G.subgraph(s)) >>>>>>>> > >>>>>>>> > L[68].lovasz_theta() >>>>>>>> > >>>>>>>> --------------------------------------------------------------------------- >>>>>>>> >>>>>>>> > ValueError Traceback (most recent >>>>>>>> call last) >>>>>>>> > <ipython-input-53-0ad2fb49c2b1> in <module>() >>>>>>>> > ----> 1 L[Integer(68)].lovasz_theta() >>>>>>>> > >>>>>>>> > >>>>>>>> /home/shhu/Documents/SageMath/local/lib/python2.7/site-packages/sage/graphs/lovasz_theta.pyc >>>>>>>> >>>>>>>> >>>>>>>> > in lovasz_theta(graph) >>>>>>>> > 78 tf.close() >>>>>>>> > 79 lines = >>>>>>>> subprocess.check_output([os.path.join(SAGE_LOCAL, >>>>>>>> > 'bin', 'theta'), tf_name]) >>>>>>>> > ---> 80 return float(lines.split()[-1]) >>>>>>>> > >>>>>>>> > ValueError: could not convert string to float: failed. >>>>>>>> > >>>>>>>> > Thanks in advance! >>>>>>>> > >>>>>>>> >>>>>>> -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.