33 votes
Accepted

Is it possible for user written algorithms to outperform libraries' built-in optimized functions?

Although LAPACK has some incredibly optimized code, it can still be worth it to write your own version in a few cases. The most important reason (and the reason they make you do it in your course). ...
Thijs Steel's user avatar
  • 1,558
11 votes
Accepted

Arbitrary Precision Optimization Libraries?

Optim.jl from Julia will work with the number types that you give it, so if you make it use BigFloats then it'll do that. Local derivative based, derivative-free, global, and integrates with automatic ...
Chris Rackauckas's user avatar
10 votes

How to properly calculate CPU and GPU FLOPS performance?

You can calculate GFLOP rates this way, but the numbers are pretty meaningless on today's hardware: Floating point operations require a variable number of clock cycles. An addition is generally ...
Wolfgang Bangerth's user avatar
9 votes

Fast, lightweight C++ tensor library for dimension-agnostic code

FTensor is a lightweight, header only, fully templated library that includes ergonomic summation notation. It has been tested extensively in 2, 3, and 4 dimensions, but should work fine for any ...
Damascus Steel's user avatar
8 votes

Is it possible for user written algorithms to outperform libraries' built-in optimized functions?

@ThiysSteel covers a lot, here is another perspective I find important: Even if you have available excellent implementations of any algorithm you might need, you still need to understand some of the ...
Simon's user avatar
  • 181
7 votes

Arbitrary Precision Optimization Libraries?

Chris code doesn't work on my machine, so here is my solution. ...
urojony's user avatar
  • 71
7 votes
Accepted

Getting to know about various BLAS implementations

I'm the primary author of many Julia libraries geared toward "architecture-specific optimizations", including LoopVectorization.jl and Octavian.jl. For BLAS-like operations, one of the most ...
Chris Elrod's user avatar
7 votes

Is it possible for user written algorithms to outperform libraries' built-in optimized functions?

To clarify @ThiysSteel's good answer: The point is not to attempt to surpass the optimization of code written by very experienced people, who'd wrangled with it for decades. The point is to acquaint ...
paul garrett's user avatar
7 votes

Is it possible for user written algorithms to outperform libraries' built-in optimized functions?

I used to try to optimize code via using assembly language (as opposed to C). I had some clear success, where a real-time microphone array worked with assembly language, but it would not work at all ...
JosephDoggie's user avatar
6 votes

Fast, lightweight C++ tensor library for dimension-agnostic code

XTensor is a modern approach and is getting more and more popular. https://github.com/QuantStack/xtensor
Jingpeng Wu's user avatar
6 votes

Fast, lightweight C++ tensor library for dimension-agnostic code

I think this new taco lib is really good too. The Tensor Algebra Compiler (taco) is a C++ library that computes tensor algebra expressions on sparse and dense ...
Dhi Aurrahman's user avatar
6 votes

Looking for Runge-Kutta 8th order in C/C++

summarizing some points: If it's a long-term integration of a non-dissapative model, a symplectic integrator is what you're looking for. Otherwise, since it's an equation of motion, Runge-Kutta ...
Chris Rackauckas's user avatar
6 votes
Accepted

Using GSL for basic operations

Of course it makes sense to use the GSL (or another library for that matter) for several reasons: Don't reinvent the wheel. The work has been done, you can spend your time on more useful things. If ...
GertVdE's user avatar
  • 6,179
6 votes

I've developed a derivative-free optimization method, looking for comments

I would like to hear comments from users that have some practical models (e.g. black-box hyperparameter optimization) which are still needed to be solved acceptably - whether this method works or not ...
GoHokies's user avatar
  • 2,186
6 votes

Is it possible for user written algorithms to outperform libraries' built-in optimized functions?

This might be tangent but i feel it worth adding. A common way for user code to beat libraries is to exploit structure the libraries are not aware of. Block diagonal matrices are easier to work in ...
worldsmithhelper's user avatar
6 votes

Solve a large-scale linear system of equations with millions of unknowns

You're going to need a large cluster or a supercomputer to solve this. Memory usage is like arc_lupus commented, a double-precision float takes 8 bytes and there will be 1e-6^2 entries. We store just ...
Neil Lindquist's user avatar
5 votes
Accepted

Does the IEEE-754 standard mandate that exp2 is rounded correctly?

According to [1]: "However, the IEEE-754 standard specifies nothing for elementary functions" and "Indeed, the mathematical libraries (libm) provided by operating systems do not guarantee correct ...
Ondřej Čertík's user avatar
5 votes
Accepted

FEM libraries with weak forms

You may not be able to express the weak form in deal.II as a mathematical formula, but you come pretty close. For elasticity, the bilinear form reads $$ a({\mathbf \varphi}_i, {\mathbf \varphi}_j) = ...
Wolfgang Bangerth's user avatar
5 votes

Profiling scientific computing codes on MacOS

One way to approach this would be to record the performance information on your machine (compile with -pg (gprof) compiler option), run your program like you normally would, and write that data to a ...
MPIchael's user avatar
  • 2,792
4 votes
Accepted

New releases of libraries

Lets assume typical versioning semantic as a.b.c, in that case: a - MAJOR version, where incompatibilities and API changes can occur, b - MINOR version, where new functionality can be added but in a ...
Krzysztof Bzowski's user avatar
4 votes
Accepted

C or fortran library to solve linear 2D/3D elliptic PDE

Most of the widely used finite element libraries are written in C++. If all you really care for -- and if all you will ever care for -- is solving an elliptic PDE on a rectangle, then it's probably ...
Wolfgang Bangerth's user avatar
4 votes

Is it possible for user written algorithms to outperform libraries' built-in optimized functions?

The point of learning how to write "the QR iteration algorithm" is not because eig will be slower. It is because "the QR iteration algorithm" ...
Yakk - Adam Nevraumont's user avatar
3 votes

Software that does naïve or formal simplification of mathematical expressions

What you are looking for is a Computer Algebra System. You should be able to do that in Mathematica, Maple, Maxima or SymPy. Particularly, I show an example in SymPy below. ...
nicoguaro's user avatar
  • 8,490
3 votes

FEM libraries with weak forms

I myself have not had much experience with computational science. Stil relativity new. However, with the experience that I have had, I will try to answer with the best of my ability. I would have to ...
philm's user avatar
  • 489
3 votes
Accepted

Code to update dense QR and Cholesky factorizations

You can use the package qrupdate that is the one linked in Octave. It's in Fortran... but it should be self contained. If you need to link it to a C++ project you can look at the Octave source code, ...
N74's user avatar
  • 231
3 votes

Solve a very large linear system (question about a library linear algebra to do this)

LSQR uses only 4 N-vectors of MEMORY. It might be your choice if storage must be minimized. It is fairly good otherwise, too, but probably not the best one (unless your matrix is non-square; then the ...
Convexity's user avatar
  • 161
3 votes

Solve a very large linear system (question about a library linear algebra to do this)

Since the matrix is considerably sparse and well-conditioned (if it is true), I suggest you can try to use Krylov subspace method, which can only use the information of matrix-vector product; such as ...
Hsien-Ming Ku's user avatar
3 votes
Accepted

library for arithmetic operations on unstructured xyz

I would recommend looking at the griddata method in SciPy, which seems to have the functionality you need. Pay attention to the 'fill value' argument if you are looking at points outside your $x,y$ ...
Jannis Teunissen's user avatar
3 votes

Looking for Runge-Kutta 8th order in C/C++

I would like to add that while what Geoff Oxberry suggests for long-term integration (using symplectic integrators) is true, in some cases it won't work. More specifically, if you have dissipative ...
viiv's user avatar
  • 45

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