# Tag Info

Accepted

### What is the difference between MATLAB and FORTRAN?

When one uses a lowâ€“level programming language, e.g. C++ or FORTRAN, one essentially controls lots of things: how parameters are passed, how data structures are aligned in memory, what is the most ...
• 901
Accepted

### Accuracy loss in single-precision Euclidean norm computation

The squares are harmless (as long as they don't overflow/underflow), because the relative perturbation they introduce is of the order of the machine precision $u\approx 10^{-8}$. Your troubles here ...
• 11.8k
Accepted

### Loop optimization with f2py, Cython and Numba

I think that the problem is linked to the way in which f2py generates the fortran interface: the argument to fortranrun.f2py should be stored as a F_CONTIGUOUS ...
• 3,839

### Recommended language/environment for large scale semi-continuous biological models

You should consider giving Julia a try. Let me explain what's going on in the design space right now that would be of interest to you. Full disclosure I am the lead developer of JuliaDiffEq. ...
• 12.4k

### Small quadratic programming problem - a simple Fortran code needed

John Burkardt provides parallelepiped_point_dist_3d in his geometry library. The Fortran90 version: https://people.sc.fsu.edu/~...
• 716
Accepted

### Non-uniform Gaussian spaced vector

What you need is the Gaussian quantile function. The quantile function outputs the value of a random variable such that its probability is less than or equal to an input probability value. The ...
• 206

### What is the difference between MATLAB and FORTRAN?

In general, you will be much more productive writing software in a higher-level language (e.g MATLAB) that has features useful in describing problems in your particular domain (e.g. matrices in ...
• 6,229

### Why there are people that still prefer fortran 77 over new versions?

I think it's generally true that there are no advantages of Fortran 77 over either newer versions of Fortran or in fact any number of other programming languages that are widely used in scientific ...
• 56.1k

### Why Is This Python Code Faster Than Fortran Wrapper with F2PY?

Shoutout to Kyle Mandli and Endulum who each contributed to this answer in the comments. First, I took Endulum's suggestion and removed the redundant reshapes. ...
Accepted

### Small quadratic programming problem - a simple Fortran code needed

Your problem is a bounded variables least squares (BVLS) problem. For small instances, an active set method can quickly solve the problem. Lawson and Hanson have Fortran code for this in their book ...
• 18.9k

### How do I write dimensionally agnostic code?

The clear answers if you want to keep Fortran speed are to use a language which has proper code generation like Julia or C++. C++ templates have already been mentioned, so I'll mention Julia's tools ...
• 12.4k

### Fortran code for Ewald summation

The National Institute of Standards and Technology (NIST) proposes different inputs and outputs to test your implementation. Have a look there: https://www.nist.gov/mml/csd/chemical-informatics-...
• 207
Accepted

### derivative of an array

Purely in terms of terminology, it's probably better to talk about taking discrete partial derivatives of variable fields stored in an array, rather than differentiating an array itself. Regarding ...
• 2,269
Accepted

• 8,701

### Interpolation of 1D solution from an original grid to a new grid

A "better technique" is rather subjective. You mean faster, more accurate, easier to program, something else?? Since it's only 1-D, the numerical cost is small (compared to 2D/3D) and there ...
• 206

### Alternative to messy grid node indexing within multiple layers of loops

This is not a good way to do modern programming for many reasons. First of all, as you pointed out, this kind of code is hard to read and maintain. Secondly, this tends to be done in old versions of ...
• 12.4k

### A fast I/O file format readable by Fortran, Java, PHP?

HDF5 appears to have some JavaScript support via its HDF Server product. You might be able to use this, though it's a web API and not a native reader. Do you need to use this on the backend (like via ...
• 10.9k

### Constructing sparsity pattern of the Jacobian of a FORTRAN subroutine

If you were using Julia, then SparsityDetection.jl solves (1) by using non-standard analysis with concolic fuzzing to directly determine the sparsity pattern from the function's AST, and ...
• 12.4k
Accepted

### Declare variable to substitute one calculate only once

Common subexpression elimination and inlining code are like the bread and butter of compiler optimizations, the first and easiest optimizations that a compiler can do. There is every reason to think ...
• 11.5k