[sage-devel] Re: Sparse numerical matrices
The next version of CVXOPT will include our own library for computations with chordal matrices - including multifrontal Cholesky factorizations. http://abel.ee.ucla.edu/chompack/ We did not develop the library primarily for the Cholesky routines, but they seem to be competitive with CHOLMOD, and they are integrated nicely with the sparse matrices in CVXOPT, so you might find them useful. The next version of CHOMPACK also includes routines for solving sparse + low-rank systems, which is useful for solving large sparse convex problems. On Nov 27, 4:37 pm, Dag Sverre Seljebotn wrote: > I need a convenient matrix class for some numerical work. SciPy doesn't > accept GPL code and besides I heavily dislike the NumPy matrix class. So > why not put my efforts into improving Sage (or at least write something > Sage-compatible for myself)... > > In particular I need to Cholesky-factor Hermitian matrices (possibly > sparse and possibly million-by-million elements), and it would be nice > to be able to abstract away which library does the factorization (dense > or sparse) from case to case by simpling passing "sparse=True" to the > matrix function... > > Here's the list of I need (I think) -- thoughts? Would you accept this > into Sage, or should I just write my own custom class? Is it allowed to > only submit new features over RDF and CDF or should any new API item > work on all parents to be accepted? > > (Apologies if some of this is already in, I'm mostly ignorant about the > Sage matrix classes): > > 1) Efficient sparse matrix class for RDF and CDF. (I don't think this > exist currently? At least I get > sage.matrix.matrix_generic_sparse.Matrix_generic_sparse which doesn't > feel right.) > > 2) I haven't checked but I think converting all my sparse values to a > Python dict to get it into a Sage matrix would be too slow, at least it > is wasteful. So I'd like something like > > matrix(CDF, I=I, J=J, V=V, sparse=True) > > where I, J, and V are vectors containing respectively rows, columns, and > values, element by element. > > 3) Support for declaring a matrix as Hermitian (or symmetric), and then > only store half of it. Something like > > sage: a = matrix(..., hermitian=True) > sage: a[1,0] = 1+1j > sage: print a[0,1] > (1-1j) > > or perhaps > > sage: a = matrix(..., hermitian='upper') > sage: a[1,0] = 1+1j > Traceback... > ... > ValueError: Matrix is defined by its upper-triangular elements only > > This would allow storing only half the elements (and probably trigger > Cholesky solving for log_determinant etc.). > > 4) Explicit diagonal matrices. And probably explicit > lower/upper-triangular matrices as well (with efficient back-solving etc.) > > sage: a = matrix(CDF, ..., diagonal=True) > sage: a[1,0] = 2 > Traceback... > ... > ValueError: Assigning outside of diagonal on a diagonal matrix > > and similar for matrix(..., lower=True) and ...upper=True... > > 5) Call CHOLMOD to do sparse Cholesky, either through cvxopt or more > likely through a recent wrapper by Nathaniel Smith. CHOLMOD is already > in Sage through cvxopt. > > -- > Dag Sverre -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Sparse numerical matrices
I CVXOPT, the arguments for cvxopt.spmatrix() can also be CVXOPT nx1 dense matrices, i.e., you don't have to create Python lists, although that overhead is probably not too severe. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: python sage : new cvxopt package planned ?
CVXOPT is developed on Ubuntu, and I've never had to do anything special to build it. If you identified a problem in the build process, please report it on the CVXOPT forum. best regards Joachim On Jan 26, 2:19 pm, Harald Schilly wrote: > Hi, I've just upgraded it a few minutes ago. See my comments > here:http://trac.sagemath.org/sage_trac/ticket/6456 > I'm by far not an expert on building software and I only know that I > wasn't able to compile cvxopt on my ubuntu linux machine. Therefore I > did what I described above. If this spkg works for you I'm happy, > otherwise these notes (and those in "SPKG.txt" inside the spkg file > [it's a tar.gz]) might help you to accomplish something similar. > > About getting this official: One requirement is that it must build and > work on all supported platforms. In the past there were patches > necessary for solaris and right now there are patches necessary to get > it running on ubuntu linux. Therefore there is still a lot to do to > get this running everywhere! > > greez harald > > On Jan 26, 1:47 pm, Dima Pasechnik wrote: > > > > > good that I saw this thread, as I was planning to create a > > cvxopt-1.1.2 spkg > > (I need it for my work...) > > So, can this spkg be made "official" ? > > > Thanks, > > Dima > > > On Jan 26, 7:35 am, William Stein wrote: > > > > On Mon, Jan 25, 2010 at 3:33 PM, Harald Schilly > > > > wrote: > > > > > On Jan 25, 11:43 pm, William Stein wrote: > > > >> On Mon, Jan 25, 2010 at 7:11 AM, wrote: > > > > >> > However, I saw that SAGE is using CVXOPT 0.9 wheras the latest > > > >> > version is > > > >> > 1.1.2 > > > > >> > Are you planning to upgrade that module ? > > > > > CVXOPT is GPLv3+ , but we try to stay GPLv2+ ... so it's a licensing > > > > issue. > > > > It's not a show stopper though. > > > > William > > > > > I package a separate cvxopt spkg for me here: > > > >http://boxen.math.washington.edu/home/schilly/sage/spkg/ > > > > > Note, it's not the official cvxopt, it's modified to work with ubuntu > > > > linux and from an ubuntu/debian software directory. > > > > > H > > > > > -- > > > > To post to this group, send email to sage-supp...@googlegroups.com > > > > To unsubscribe from this group, send email to > > > > sage-support+unsubscr...@googlegroups.com > > > > For more options, visit this group > > > > athttp://groups.google.com/group/sage-support > > > > URL:http://www.sagemath.org > > > > -- > > > William Stein > > > Associate Professor of Mathematics > > > University of Washingtonhttp://wstein.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: OT: CPLEX anyone?
MOSEK provides state-of-the-art commercial LP and SOCP solvers as well as MIP solvers. They have a python interface and their academic license is free. Joachim On Jan 28, 7:23 pm, kcrisman wrote: > We also have CPLEX (which is indeed VERY high quality) through our OR > guy's NSF grant. It would be very good to have a CPLEX-Sage > interface, imho. > > - kcrisman > > > > > > > Having never used CPLEX myself (my colleagues use it through a Java > > interface), could you also give me the arguments which I should give > > to Cplex so that you obtain the output you need ? > > > If you send them to me now, I could make it run tonight :-) > > > Nathann -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: OT: CPLEX anyone?
If you go to http://mosek.com/index.php?id=99 you can get a free license for academics, but you have to renew it after 30 days. On Jan 29, 11:05 am, Martin Albrecht wrote: > On Thursday 28 January 2010, dahl.joac...@gmail.com wrote: > > > MOSEK provides state-of-the-art commercial LP and SOCP solvers as > > well as MIP solvers. They have a python interface and their academic > > license is free. > > Actually, their academic license isn't free: > > http://www.mosek.com/index.php?id=126 > > Harald Schilly pointed me off list to > > http://scip.zib.de/ > > which seems to be a decent MIP solver (+ other stuff), it comes with sources > and is free for academic use. They have a sort of weird license though, where > you are legally bound to cite them in your paper etc. (stopping myself now, > further discussions on licenses -> [sage-flame]) > > Martin > > -- > name: Martin Albrecht > _pgp:http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99 > _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF > _www:http://www.informatik.uni-bremen.de/~malb > _jab: martinralbre...@jabber.ccc.de -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: R + GLPK
CVXOPT has no dependencies on Numpy (but can exchange data with Numpy arrays efficiently via a buffer protocol). On Jul 15, 11:04 am, François Bissey wrote: > > On 07/14/10 10:58 PM, Nathan Dunfield wrote: > > >> On a similar note cvxopt can make use of glpk as well. > > > > Yes, it can --- I was just using this yesterday. > > > > The trick is that you have to tell cvxopt that glpk is available when > > > it is compiled/installed. Now that glpk is standard, the install > > > script for cvxopt should be told to make use of it. You just need to > > > edit a couple of lines in setup.py to make this happen. Has this > > > already been done, or should I file a patch for this? > > > > Best, > > > > Nathan > > > I strongly suspect you would also need to make sure glpk builds before > > cvxopt by editing spkg/standard/deps. The cvxopt entry would then look > > like this. > > > $(INST)/$(CVXOPT): $(BASE) $(INST)/$(FORTRAN) $(INST)/$(F2C) \ > > $(INST)/$(LAPACK) $(INST)/$(BLAS) $(INST)/$(NUMPY) \ > > $(INST)/$(ATLAS) $(INST)/$(CEPHES) $(INST)/$(GLPK) > > > If you wanted to use the GLPK library in R, then the R entry would need to > > be modified by adding the "$(INST)/$(GLPK)" on the end too. > > > You might find it works without doing the above, but unless you specify the > > build order, it will be semi-random, especially with parallel builds. > > Just checked the source, it is definitely a build time dependency so > this is needed otherwise the build will fail. > However as far as I can see cvxopt shouldn't depend on numpy (unless > that's a change between version 0.9 and 1.1). > > Francois -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Add matplotlib as dependency of cvxopt (#12742) needs review
matplotlib is only used for some of the examples with CVXOPT; there is no reason to introduce such a dependency. If it's a matter of automated tests, then it would be much better to comment out the plotting in the few examples. Den tirsdag den 27. marts 2012 09.03.49 UTC+2 skrev Jeroen Demeyer: > > Blocker ticket #12742 needs review. It adds matplotlib as dependency of > cvxopt. cvxopt's sage-check will fail without matplotlib installed. > > Please review this one-line patch: > http://trac.sagemath.org/sage_trac/ticket/12742 > -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Attn: Confidential
+1! sorry for the spam... Den lørdag den 14. april 2012 09.30.49 UTC+2 skrev Harald Schilly: > > > > On Friday, April 13, 2012 8:56:18 PM UTC+2, Volker Braun wrote: >> >> On a related note: Enable 2-factor authentication for your Google >> account. I've recently switched it on and it works fine. > > > big +1! > > and fwiw, with such emails you can also always look into the source and > see the originators IP. the mail talks about Scotland, but when you track > down the IP from where it was sent from, it's california. > > h > -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: About GSoC
Another possibility could be to improve numerical computations in SAGE. What makes MATLAB very popular with engineers is not the large amount of toolboxes - it's MATLAB's excellent capabilities for numerical computations. Very often MATLAB users don't have the toolboxes available (which are expensive), or the toolboxes don't do exactly what you need, so practioneers and experts write their own functions. I don't think Python has yet made a notable impact in either engineering or numerical computations, so it might be worthwhile to target those areas at a more generic level. On 4 Mar., 15:05, David Kirkby wrote: > On 4 March 2011 09:28, Martin Albrecht wrote: > > > On Friday 04 March 2011, David Kirkby wrote: > >> Perhaps a very different approach is needed. One thing I feel Sage > >> lacks is engineering applications. How about basing the applications > >> upon building engineering applications on the top of maths software, > >> rather than adding more maths? > > > Hi David, if you take a look at last years application you'll see that it > > wasn't that particularly heavy on the mathematics. > > > http://wiki.sagemath.org/gsoc10 > > > Cheers, > > Martin > > I found the Wiki, but not the application. > > I take your point it was not too mathematica, but did look a bit > "unfocused" to me, though perhaps offering a wide range of possible > projects is useful. > > Some listed there were clearly not practical in the time frame of > 3-month. Ports to AIX or HP-UX would take a LOT more than 3 months. > However, making a number of packages play well on those platforms > would be quite doable - some would only take a day or less I think. > > More emphasis could have been put on a C99 library and its use to a > multitude of other projects - not just Sage. The following ideas > reflect my own bias, but something that might be better is: > > * Focus just on engineering applications for Sage. Make every project > related to engineering, as this is one area where MATLAB does very > well, and Mathematica a bit less so. MATLAB has a number of toolboxes > focused on engineering. > > http://www.mathworks.com/products/ > > Projects which might be suitable would be. > > * Electonic circuit analysis using symoblic maths like the "Nodal" > package for Mathematica does, and totally avoid numerical simulation > software, as there are plenty of very good tools for this - Spice > being the most well known of them all. (I think William had a student > who expressed some interst in this). > > * Antenna design. The equations for the typical Yagi-Uda antenna are > easy to solve, so getting something to compute the properties of a > Yagi Uda antenna would not be difficult. What is much more difficult, > is to optimise the element spacing and lengths to get an optimal > design. That's a global optimisation problem. I tried something like > this years ago using a genetic algorithm, though the GA approach was > not the best I found. > > * Add GPIB support for Linux only - probably the only platform where > this is doable with totally free software. FreeBSD would be possible > if the port was complete. Solaris and OS X would probably need to use > a commerical driver for the GPIB card. As I remarked the other day, > the real issue to get commerical developers to use Sage for instrument > control is having drivers for their instruments. But if the basic GPIB > driver was implemented, then a couple of commands could be written in > Sage to basically send and receive data. Drivers for specific > instruments would essentially require the user to write the code based > on their manual for the instrument. Getting a cheap instrument to test > the basic code on is very easy. > > * Digital filter design tool. MATLAB has this too in a toolbox. Basic > filter would be quite easy to implement. More sophisticated adaptive > filters would be possible for the brightest students. As the filters > get more sophisticed, so does the maths behind them. > > * Analogue filter design - some comments apply as for digital filters. > > * Implement any of the MATLAB toolboxes where a suitable mentor could > be found. In cases like an aerospace toobox, I doubt there's a > suitable mentor available in the Sage community. > > * Solving thermal problems such as heat transfer through walls, > subject to the boundary conditions specified. I see quite an > intersting request from someone recently who wanted to find the > optimal dimensions for a heat spreader for a heatsink. Basially one > has > ** Transistor dumping heat in a small area - the dimension of its package. > ** Large alluminium (Al) heat since, but alluminium is not a great > conductor of heat. This would be cooled by a fan, so convection is the > dominate mode of heat transfer and conduction and radiation could be > ignored. > ** A copper (Cu) "heat spreader" of dimenssion x y z which sits > between the transistor and heat sink . Assuming the only method of > heat transfer from the heat spreade
[sage-devel] Re: MATLAB: viable alternative...?
I develop optimization software professionally, and I use both Matlab and Python extensively. I only use Matlab for prototyping numerical algorithms and inspecting and manipulation matrices. I tend to stick with Matlab/Octave because constructing/inspecting matrices is so simple and the linear algebra expression are simple and look similar to what I started with on paper. I don't use Matlab as a real programming language, and I've never had to use any of the toolboxes. I use Python whenever I need to prototype a more complicated algorithm, where the challenge is more on efficient data structures, etc., than straightforward linear algebra. For me, Python works perfectly for such problems. What I personally want from Python, for it to be a viable alternative to Matlab is the following (viewpoints that I believe are shared by many colleagues in academia and industry): * Simple construction of sparse dense and matrices. Simple linear algebra. We are working on matrices, so the datastructures should be and act like matrices. Matlab got it right, why change it? In 99% of the time, I need ordinary 2D matrices, so make that feel simple and natural. * It's fine that some things only work for dense matrices and others only work for sparse matrices, but both datatypes should be present, and whatever you expect to be able to do with them from C, you should be able to do simply from Python. * Easy interface to sparse and dense matrices from C. A while back I was involved in developing a Python software package CVXOPT (included in Sage, by the way), where we had to develop our own matrix library because there was no viable alternative at the time. Since then Numpy/Scipy probably improved, but they still feel like they were designed by people who did not have numerical linear algebra in mind. On Aug 16, 9:17 pm, Dima Pasechnik wrote: > Yes and no. I know a largish community, people working on interior point > methods for nonlinear optimization, where it is rather hard to get around > without Matlab. Partly this is due to relative easiness of creating Matlab > interfaces to C and Fortran code, which makes experimenting easier > Matlab is used as a fronend to advanced high performance code. Sometimes to > the point that the only way to use this code is to call it from Matlab. > Partly it's inertia, of course. > > Dima -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: MATLAB: viable alternative...?
Personally I don't mind that the syntax is different. I was about to give some examples of indexing and slicing of Numpy arrays, which I remembered to be odd for matrices, but then I realized that the indexing/slicing works exactly like I expect it to, e.g., >>> A[:, i] picks out the i'th column. Has this always been the case with Numpy? If that's the case, some of my objections against Numpy are based on my own ignorance. On Aug 19, 9:55 am, "Johan S. R. Nielsen" wrote: > > Seems this thread *has* been hijacked. ;-) > > Just want to add my opinion, which belongs in some void between the > original thread and the hijacked one ;-) > > I am a ph.d. student in algebra, but have a background in computer > science. I don't do much numerics anymore, so I'm not exactly the > right person to ask, but I do hang around with a lot of numerics > people. So far, I agree with some of the very insightful comments on > the problems with working numerically in Sage *once you got the > matrices* that has come up (like the posts from Jordi Hermoso, Chris > Godsil and Tim Lahey). > > However, I really don't believe that the current matrix-construction > syntax is what is seriously keeping Matlab people away from Sage -- > and if it is, then that's simply silly! Comparing > > M = [1 2; > 3 4; > 5 6] > > with > > M = matrix(RR,2,3,[ > 1, 2, > 3, 4, > 5, 6 ]) > > that's a very small syntax price to pay for 1) unambiguous, > straightforward syntax 2) complete control of element space. I always > disliked Matlab for its happy-go-lucky, ambiguous syntax, and I think > it is unnecessary to make specialised, ad-hoc syntax in Sage for (2D) > matrices (over X-bit floats). > > My impression from my own math department is that a lot of Matlab > users know more or less only Matlab as a programming language, and > that they have always used this, and their advisor also used/s this. > They have the opinion that it is really difficult to learn a new > language, and will dislike *any* difference between Matlab and > "Alternative X", no matter how minute (much like Jordi mentioned > earlier). I think it would be silly to start introducing Matlab syntax > and renaming functions to look as much as possible like Matlab for > this reason. The ex-Matlab users would not stop complaining until Sage > was a completely compatible superset of Matlab anyway. > > On the other hand, I think it would of course think it would be great > if all functionality needed for numerics people would be readily > available in Sage. Though not at the expense of a dichotomised syntax > and namespace to cater for Matlab devotees. In time, I think this > would make people migrate to Sage because of expense, ideology and > functionality. > > Cheers, > Johan S. R. Nielsen -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: MATLAB: viable alternative...?
It's a good point that for most work you don't type in matrices by hand. What is more useful is probably various ways of inspecting matrices easily (print submatrices, plot the sparsity pattern, evaluate expressions involving the matrix, etc.) On 20 Aug., 00:21, Simon King wrote: > On 19 Aug., 21:26, Jason Grout wrote: > > > But then what about: > > > [1, 2, > > 3, 4] > > Note the small difference: > [1,2, > 3,4] > is a list in Python. But > [1,2 > 3,4] > (if I am not mistaken) is a syntax error in Python, and thus the > preparser could preprocess it and turn it into a matrix: > > The line break replaces the semicolon, hence, the example that you > give corresponds to [1,2,;3,4] (which hopefully is a syntax error in > Matlab), while the second version becomes [1,2;3,4] (which seems to be > the matlab idea of a matrix). > > That said, I think one of the strength of Sage is to use a mainstream > language. It should not be weakened too much by syntactical sugar, in > particular if it lacks precision (by gratuitous assumptions on the > base ring). > > Concerning some matlab users feeling irritated by any deviation from > matlab syntax: I guess that Sage is not going to be a Matlab clone, > and thus that kind of users is lost. > > Every thinking person must be aware that, to some extent, *the same* > idea can be expressed in different languages. I hope that every person > working in numerics would not mind to use a CAS with a decent > programming language, provided that it offers *the functions* (but not > necessarily the function names or the syntax) of Matlab. > > Concerning matrices: Are people working in numerics really > interactively typing in matrices? Or are they usually just reading > matrices from files that are created by programs (e.g., based on data > from an experiment)? If the latter is the case then syntactical sugar > wouldn't really matter. > > Cheers, > Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org