Richard
  • Member for 6 years, 6 months
  • Last seen this week
How do I find the minimum-area ellipse that encloses a set of points?
Accepted answer
21 votes

Theory The 1997 paper "Smallest Enclosing Ellipses -- Fast and Exact" by Gärtner and Schönherr addresses this question. The same authors provide a C++ implementation in their 1998 paper &...

View answer
What are some good strategies to test a floating point arithmetic implementation for double numbers?
Accepted answer
20 votes

You should test transition points. Floating-point numbers have several distinct "ranges": Standard/Normal arithmetic Subnormal arithmetic Infinite arithmetic NaN arithmetic Zero arithmetic ...

View answer
C++ Best practices for dealing with many constants, variables in scientific codes
Accepted answer
15 votes

If you have constants that will not change before runs, declare them in a header file: //constants.hpp #ifndef PROJECT_NAME_constants_hpp #define PROJECT_NAME_constants_hpp namespace constants { ...

View answer
How to find the smallest ellipse covering a given fraction of a set of points?
Accepted answer
13 votes

You asked for the smallest ellipse. An ellipse so small that its smallestness needs to be italicized. Others have provided answers that identify smallish ellipses, but, as Miracle Max says, "...

View answer
Should benchmarkings be done at all? What is the point?
10 votes

Yes, benchmarking should be done. I make this claim as an Editor, Author, and Reviewer. Below, I represent these roles' stances slightly hyperbolically. But let me strongman your argument first. In ...

View answer
What guidelines should I follow for simulation software projects?
Accepted answer
10 votes

"developers lack the skills". Maybe. I think it's much more likely that the developers lack the incentives. Making solid code is difficult and expensive and, in academia, comes with minimal-to-...

View answer
How to choose a python parallelization library?
Accepted answer
8 votes

Dask schedules tasks across processes and across nodes, so it is appropriate for use on a single computer, supercomputer, or cloud. Dask also provides specialized data structures to aid in this. ...

View answer
Estimate the number of self-avoiding walks of length $n$
Accepted answer
7 votes

Background The number of self-avoiding walks of length N on a square lattice is: 0 1 1 4 2 12 3 36 4 100 5 284 6 780 7 2172 8 5916 9 16268 10 44100 11 120292 12 ...

View answer
Going to try to move some of my scipy/numpy calculation to a new GPU, how to avoid disappointing results?
5 votes

I buy the wrong CUDA GPU and the speed up is minimal or nonexistent. It is highly unlikely that your choice of GPU will have a significant impact on your speed-up unless your model is very big. To a ...

View answer
Approximating the boundary between two sets of points (in 2D): Fitting a region
5 votes

Theory Clustering is unlikely to work in this case because your red points are separated from each other by the green points. You could use more clusters, but this will require a lot of manual ...

View answer
Solving absolute value systems
5 votes

Mathematical Preliminaries First, let's do some mathematical manipulation. The equation you start with is: $$ z-A|z|=b $$ We would like to reduce this to something we know how to solve, like a ...

View answer
CPU usage when a MPI rank waits during a blocking communication
5 votes

It depends on the communication settings you use for MPI. In blocking communication, MPI has three wait modes. Aggressive busy wait. This is a kind of default mode. Open MPI, at least, uses this when ...

View answer
Do most statistical packages and libraries in high-level programming languages rely on LAPACK for their matrix inversion operations?
Accepted answer
5 votes

tl;dr Yes. But your question doesn't make it clear that you understand what LAPACK is about. LAPACK is both a software as well as an interface. That is, the operations that LAPACK defines are standard ...

View answer
How to stack N boxes of varying heights into M stacks, most evenly
Accepted answer
4 votes

Overview An optimization problem like this has almost always been considered previously, so one of the first lines of attack is to think of all the different ways your problem could be expressed and ...

View answer
Stochastic cellular automata - algorithm limited by 1 cell per timestep
Accepted answer
4 votes

I'd need a TimestepInterval of less than a second - this increases the algorithms computational burden by more than a factor of 10, and is wasteful is food areas with lower RoS. Nonetheless, your ...

View answer
How to store a TB size array in C++ on a cluster
4 votes

You could try using UPC++, which sets up a globally accessible address space distributed across your nodes. A more standard approach would be to learn how to use MPI.

View answer
Disciplined convex programming expression of $x\sqrt{1-x}$
4 votes

I don't think you can represent this as a concave function in the (cvxpy-)DCP sense: import cvxpy as cp x=cp.Variable() a=x*cp.sqrt(1-x) a.curvature 'UNKNOWN' However, you can represent it using ...

View answer
MINLP with GEKKO - Modeling discrete variables
4 votes

If they don't have a variable that is constrained to a discrete set you can formulate it like so: b1 = m.Var(lb=0,ub=1,integer=True) #Binary variable b2 = m.Var(lb=0,ub=1,integer=True) #Binary ...

View answer
Efficient algorithm to decide if a graph is a cactus?
Accepted answer
4 votes

This is a fun question! After academic searches and Wiki came up bare, I dug through the source code of SageMath. That gets us to this: #A graph is called *cactus graph* if it is connected and every ...

View answer
Time complexity analysis
Accepted answer
4 votes

It's O(n), but it depends on the sorting algorithm you use. Finding unique elements is O(n) with a hash table. You use one for loop to count incidents and a subsequent loop to extract uniques. ...

View answer
Is there an optimization scheme/algorithm that converges, for this non-convex scenario but with some special properties
4 votes

Despite your claim that these functions have "special properties", the properties you've supplied still leave f and g extremely general. This means the answers you're going to get must be ...

View answer
Nystrom approximation of SVD for asymmetric matrices
Accepted answer
4 votes

Nemtsov, Averbuchm, and Schclar's "Matrix compression using the Nyström method" (2016) seems relevant: The Nyström method is routinely used for out-of-sample extension of kernel matrices. We ...

View answer
A name for a numerical phenomena when using numerical methods
3 votes

You could call this a "scaling" problem. Your $c$ variables essential form the weights on a multi-objective optimization problem. If $c_1\gg c_2$, then the objective associated with $c_1$ ...

View answer
Is it more efficient to capture many constraints in one constraint?
3 votes

I'd recommend setting each variable to 0, rather than trying to do something clever. This is for two reasons: You might be too clever and make a mistake. For instance, setting each variable to zero ...

View answer
Is Highams' computation of mean worth the price?
Accepted answer
3 votes

Higham's algorithm seems very useful for online algorithms or algorithms in which you have limited storage capacity such as edge processing. In these situations it is probably always worth the cost. ...

View answer
How to choose the parameters for a collision free comet trajectory
Accepted answer
3 votes

You're trying to solve the n-body problem, which has some known approximations that can be used to accelerate computation; however, it's still unclear how you can turn these into artistically ...

View answer
MPI data broadcast or not in C
3 votes

The question I think you're asking, based on your code, is: A. Better to have each node do redundant work B. Better to have one node do the work distribute the results. The answer is usually A. To ...

View answer
Disjunctive programming software
2 votes

I haven't used it, but Pyomo, a seemingly well-supported modeling software includes a module for generalized disjunctive programming. One of the many examples they provide at the above link appears as ...

View answer
Python solvers for MINLP in Pyomo in Google Colab
2 votes

There are so many MINLP solvers out there that this isn't really a well-defined question. Anyway, here's how you can get some: # Install some solvers # GLPK probably includes GLPK_MI which does MIP !...

View answer
Find the smallest convex hull that enclose an arbitrary point
Accepted answer
2 votes

It's often best to start with the simplest, easiest-to-implement algorithm you can think of to test that your intuition on a problem is correct and that what you've built will match what you need. In ...

View answer