Stay up-to-date with everything C++!
Content directly fetched from the subreddit just for you.
Join our group for discussions : @programminginc
Powered by : @r_channels
Post #24701
21
C+ @r_cpp
Showing posts older than #24702 · Back to latest
gf2 exercise in a third language someday!
gf2 focuses on efficient numerical work in bit-space, where mathematical entities such as vectors, matrices, and polynomial coefficients are limited to zeros and ones.XOR operation, and multiplication/division becomes the AND operation. gf2 uses those equivalences to efficiently perform most operations by simultaneously operating on entire blocks of bit elements at a time. We never have to worry about overflows or carries as we would with normal integer arithmetic. Moreover, these operations are highly optimised in modern CPUs, enabling fast computation even on large bit-matrices and bit-vectors.gf2 are:BitArray|BitArray|A fixed-size vector of bits.|BitVec|BitVec|A dynamically-sized vector of bits.|BitSpan|BitSlice|A non-owning view into contiguous ranges of bits.|BitPoly|BitPoly|A polynomial over GF(2).|BitMat|BitMat|A dynamically-sized matrix of bits.|BitSpan class corresponds to the BitSlice type in Rust (C++ uses spans, Rust uses slices). There are other changes in the same vein elsewhere — C++ vectors have a size() method, Rust vectors have a len() method, and so on.BitArray, BitVec, and BitSpan/BitSlice classes and types share many methods. In C++, each satisfies the requirements of a BitStore concept. In Rust, they implement a BitStore trait. In either case, the BitStore core provides a rich common interface for manipulating collections of bits. Those functions include bit accessors, mutators, fills, queries, iterators, stringification methods, bit-wise operators on and between bit-stores, arithmetic operators, and more.gf2 to support linear algebra operations, such as solving systems of linear equations, finding matrix inverses, and computing eigenvalues and eigenvectors. Among other things, the interface includes methods for examining the eigen-structure of large bit-matrices.BitPoly class provides methods to compute x^N mod p(x), where p(x) is a bit-polynomial and N is a potentially large integer.docs.rs does not support MathJax—a long-standing issue for scientific Rust.
auto fn(){
Type object{};
object.~Type();
new (&object) Type;
}