Porting everything from Coretran to stdlib #104
Labels
topic: algorithms
searching and sorting, merging, ...
topic: mathematics
linear algebra, sparse matrices, special functions, FFT, random numbers, statistics, ...
topic: utilities
containers, strings, files, OS/environment integration, unit testing, assertions, logging, ...
Based of @certik rundown of his fortran-utils!
I think Coretran has some useful stuff that could go into stdlib.
Here is what's in Coretran at the moment. I will list from more to less important.
Important, None of my routines handle arbitrary defined types. I.e. I can't sort an array of Joe's custom made classes.
Random
I have implemented the Xorshift128+ algorithm that lets you jump the state of the PRNG. I need to switch to Xoroshiro128+/* because I read that it's more robust. Most languages provide a Mersenne Twister generator, but its not good for parallel applications. My PRNG is OO and thread safe since a local state is used on each thread.
Dynamic Arrays
I think these are akin to C++ vectors? OO.
Memory starts low, as entries are added, memory is reallocated only when its full and increases by a set factor. Similarly, if entries are removed the memory is only reallocated once it is 25% full.
Overloaded for r32, r64, i32, i64.
Searching
These will be fundamental when it comes to developing other functions within the stdlib if we want fast algorithms.
Sorting (#98)
I think a TimSort is better than a quicksort from what I gather but I could never implement it. And from Sparse matrix support #38 a quicksort wont be great for sparse things.
Spatial
Geometry
I implemented Shewchuk's algorithms for exactly computing whether a point is inside the a) circumcircle of a triangle or b) the circumsphere of a tetrahedron. I was going to use this to write a Delaunay triangulation and/or Voronoi mesh. Shewchuk's algorithms use the naive determinant of a matrix, and add terms if needed until the computation is exact. It handles floating point round-off error.
Maths
Median. I use an on average O(n) quickselect to find median values.
cumsum. Should this be a Kahan summation?
cumprod
std
mean
etc!
Types (Already in stdlib_experimental_kinds.f90)
My entire library is built around these so its easy at least to switch those out.
The text was updated successfully, but these errors were encountered: