# Tag Info

52

Python (as of 2.6 and 3.0) now searches in the ~/.local directory for local installs, which do not require administrative privileges to install, so you just need to point your installer to that directory. If you have already downloaded the package foo and would like to install it manually, type: cd path/to/foo python setup.py install --user If you are ...

33

Pick your poison. I recommend using Homebrew. I have tried all of these methods except for "Fink" and "Other Methods". Originally, I preferred MacPorts when I wrote this answer. In the two years since, Homebrew has grown a lot as a project and has proved more maintainable than MacPorts, which can require a lot of PATH hacking. Installing a version that ...

24

This document was written in March 2009 to help in the choice of a linear algebra library for a scientific library. It evaluates portability, high-level interface and licensing for several libraries, among them Eigen, GSL, Lapack++ MTL, PETSc, Trilinos and uBlas. It seems to be particularly fond of Flens and Seldon. (One of the requirements was that C++ ...

24

Disclaimer: I sometimes get annoyed when somebody tries to tell me what they think I ought to do rather than answering the question I asked. But I'm going to take a risk and suggest an alternative to you. I would suggest looking at Python's scientific computing packages: numpy, matplotlib, and scipy. Together, they provide you most of the core ...

20

What you are asking for is the Elsivier grand challenge of the "Executable Paper". While many approaches have been tried, none are as compelling as the authors might suggest. Here are a few examples of techniques used. Madagascar Project takes your approach, inside the make script have the simulations run that produce the figures and paper simultaneously. ...

17

GNU Octave is "mostly compatible with Matlab", certain subtleties means not all scripts are portable from MATLAB to Octave. It is worth reading the documentation for the language and/or compatibility notes in the FAQs or on wikibooks. There are also porting notes. Packages similar to MATLAB toolboxes exist, but you will need to check them out to work out ...

17

In rough order of importance. Source Code Make the code that implements the key aspects of your algorithm available. Even if the user can't build or run it, they can read exactly what is done. I have several times noticed simple decisions that weren't documented in a paper, but which a couple minutes with the source code answered conclusively. Make it ...

15

In the vast majority of cases, improvements in algorithms make a bigger difference than improvement in optimization. Algorithms are also more portable than low-level optimizations. My advice is to follow general best practices with respect to memory layout for cache reuse, avoiding excessive copies or communication, treating the file system in a sane way, ...

15

As far as I know, Lapack is the only publicly available implementation of a number of algorithms (nonsymmetric dense eigensolver, pseudo-quadratic time symmetric eigensolver, fast Jacobi SVD). Most libraries that don't rely on BLAS+Lapack tend to support very primitive operations like matrix multiplication, LU factorization, and QR decomposition. Lapack ...

14

As some comments have suggested, this approach has long been developed in the R community by building on Sweave and more recently, knitr. Obviously this approach has the disadvantage of being language-specific at the moment, but the advantage that its regularly used in academic papers. Use of Sweave in real publications The Journal of Biostatistics ...

14

If you want something open-source, you probably want to try COIN's CBC code (they also have a couple other MILP solvers, like a branch-and-price framework, or SYMPHONY). Gurobi and CPLEX will be considerably faster, and as of the 2011 or 2012 INFORMS meeting, Gurobi was faster than CPLEX (though the performance metrics are of course problem dependent). On ...

13

You look at how deal.II (http://www.dealii.org/) does it -- there, dimension independence lies at the very heart of the library, and is modeled as a template argument to most data types. See, for example, the dimension-agnostic Laplace solver in the step-4 tutorial program: http://www.dealii.org/developer/doxygen/deal.II/step_4.html See also https://...

13

I have not had a lot of success in using other people's solutions to this problem. I usually just want something simple that works for me and gets the job done. To this end, I generally try to write one python script which is in charge of running all the results, parsing the output, as well as building the figures/tables. I write my codes to generate ...

12

Yes you can learn MATLAB via Octave. But Octave syntax is less restrictive and more in line with modern scripting languages. MATLAB seems behind in this respect. See this wiki link MATLAB Programming/Differences between Octave and MATLAB Another major difference to me were the availability of certain libraries for MATLAB but not for Octave.

12

For logging that allows full reproducibility, I highly recommend the Sumatra python package. It nicely links the version control commit number, machine state, and output files to each program run and has a django web interface to interact with the database of run info. The python API makes it very easy to include logging in my scripts.

12

The question highlights that most "plain" programming languages (C, Fortran, at least) do not allow you to do this cleanly. An added constraint is that you want notational convenience and good performance. Therefore, instead of writing a dimension-specific code, consider writing a code that generates a dimension-specific code. This generator is dimension-...

11

If you want Matrix classes with an intuitive interface All the LAPACK and BLAS features Easy to learn and use API Easy to install Then I recommend you to have a look at my library FLENS. I designed it for exactly these kind of tasks. However, it requires a C++11 conform compiler (e.g. gcc 4.7 or clang). FLENS gives you exactly the same performance as ...

11

I think you'll get most out of it if you contribute to projects you actively use for other work, since that motivates you to develop functionality you need yourself. Ultimately, this is how most open source software is written: by people who needed the functionality for one reason or another. In the context of our own project, deal.II, I had written a ...

11

If you want to write something general-purpose, you can do it either with shell scripts if it is something very simple, as Pedro suggests, or aggregate in a higher-level mathematical programming language such as Python or MATLAB. I agree that plain text files are useful for smaller amounts of data, but you should probably switch to binary data for anything ...

11

I would say that there are a number of reasons why there are no computational science contests besides the potentially massive computational resources required. Time limits: Writing scientific computing code is usually not something that you want to rush. A lot of emphasis is on making sure it is correct, and thorough consideration of test/corner cases. ...

11

I maintain (and am the main coder of) a simulation software that has been developed for ~8 years and is used by few hundreds people. It all started as a side project during my PhD, and it clearly outgrew itself. It is both over- and under-engineered: the architecture of some parts is too complicated for their own good, whereas some other parts (whose ...

10

#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt def fun (n, x): if n <= x <= n + 1: return float(x) - n elif n + 1 <= x <= n + 2: return 2.0 - x + n return 0.0 vfun = np.vectorize(fun) x = np.linspace(0, 10, 1000) y = vfun(3, x) plt.plot(x, y, '-') plt.show()

10

BoomerAMG is a part of the Hypre package, which is dead simple to acquire. A much less complex code if you're starting out looking at these methods might be PyAMG.

10

Just some comments on two of your points: Logging run data: Your best bet is probably piping output through the tee command, which should be available in most shells. Plotting data according to parameter: I guess it's a matter of taste, but when I have to do complex data aggregation, I store the results in plain text, read them into Matlab as matrices, and ...

10

In my opinion, being a beginning graduate student doesn't change the answer by David Ketcheson here to the question you've linked in your post. Code minimal versions of algorithms you want to learn. Then set them aside. Coding your own algorithms is most useful for learning, but for research (or production) code, unless your research goals are to write ...

10

I'd like to give some more breadth to Geoff's thoughtful answer. In particular, I want to give you a little more perspective on the value of your programming efforts as opposed to your research efforts in your early career as an academic. You will find that being able to write software to augment your scientific research will make you a valuable member of ...

10

LibMesh supports Clough-Tocher and tensor product Hermite $C^1$ elements, see the biharmonic example. FEniCS has a biharmonic example that does uses a mixed continuous-discontinuous Galerkin formulation. Any package with $C^0$ elements that can compute second derivatives and can integrate DG jump terms can also use this approach. PetIGA Supports isogeometric ...

10

I'll give you my perspective, which is encoded in the deal.II project that you reference. First, there are two kinds of error conditions: Errors that can be recovered from, and errors that can not be recovered from. The former is, for example, if an input file can't be read -- for example if you are reading information from a file such as \$HOME/.dealii ...

9

For generally learning M-language programming and how MATLAB works, yes, Octave is just fine. If you need a particular toolbox as part of your work, though, and no one has implemented a free version of it, then you're out of luck. A student edition of MATLAB isn't that expensive. If you're at a university, it's even possible that they have a site license. ...

9

Due to the under-resolved boundary layer near the lid, the velocity in the adjacent cells is significantly lower than the lid. This section is showing you a trick to make the code run faster while still being stable. Increasing the Courant number would normally make the method unstable, but since the velocity in all interior cells is significantly less than ...

Only top voted, non community-wiki answers of a minimum length are eligible