Algebra-and-topology-related type traits, fundamental functions etc. in C++

76 Views Asked by At

The C++ standard library has type traits such as is_arithmetic is_integral and is_floating_point, but

  • complex numbers are arithmetic but you can't, say, compare them to each other,
  • no is_algebraic_number or has_transcendents
  • no is_well_ordered (ok, you could nitpick and say that all types in "real life" are nicely enumerable by a computer lexicographically by memory representation, so they are well-ordered in that sence, but you know what I mean)
  • etc.

Also, on the function front while there are functions like abs() and fabs() (no general template absolute value function though), it doesn't look like we don't really have distance functions, nor norm functions etc.

So, all in all, it seems the standard library does not equip us very well for algebraic (/ topological) reasoning in code.

My questions are:

  • While there certainly are domain-specific languages in which things are better (I guess Mathmetica's language? Maybe Matlab/Octave symbolics?), is this common among general-purpose programming languages?
  • Are there initiatives or efforts to change this situation, i.e. expand the formal math aspects of the standard library (as opposed to numerics, fast math etc.)?
0

There are 0 best solutions below