summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/math/lgsFp.cpp26
-rw-r--r--content/other/other.tex10
2 files changed, 18 insertions, 18 deletions
diff --git a/content/math/lgsFp.cpp b/content/math/lgsFp.cpp
index a4f3d0f..a8d7fc7 100644
--- a/content/math/lgsFp.cpp
+++ b/content/math/lgsFp.cpp
@@ -1,20 +1,20 @@
-vector<int> piv;
-void gauss(){
- for(int r = 0, c = 0; c < m; c++){
- for(int i = r; i < n; i++){
- if(mat[i][c] != 0){
+vector<int> pivots; // ith pivot is in ith row
+void gauss(int n, int m) {
+ for (int r = 0, c = 0; c < m; c++) {
+ for (int i = r; i < n; i++) {
+ if (mat[i][c] != 0){
swap(mat[r], mat[i]);
break;
}}
- if(mat[r][c] == 0) continue;
+ if (mat[r][c] == 0) continue;
ll f = multInv(mat[r][c], mod);
- for(ll &x : mat[r]) x = x * f % mod;
- for(int i = 0; i < n; i++){
- if(i == r) continue;
+ for (ll& x : mat[r]) x = x * f % mod;
+ for (int i = 0; i < n; i++) {
+ if (i == r) continue;
f = mat[i][c];
- for(int j = c; j < sz(mat[r]); j++){
+ for (int j = c; j < m; j++) {
mat[i][j] = (mat[i][j] - f * mat[r][j] % mod + mod) % mod;
}}
- piv.push_back(c);
- if(++r == n) break;
-}} \ No newline at end of file
+ pivots.push_back(c);
+ if (++r == n) break;
+}} // no solution if pivots.back() == m-1
diff --git a/content/other/other.tex b/content/other/other.tex
index a38f6da..a5004fb 100644
--- a/content/other/other.tex
+++ b/content/other/other.tex
@@ -18,9 +18,9 @@
\begin{expandtable}
\begin{tabularx}{\linewidth}{|lR|}
\hline
- Addition & \code{__builtin_saddll_overflow(a, b, &c)} \\
- Subtraktion & \code{__builtin_ssubll_overflow(a, b, &c)} \\
- Multiplikation & \code{__builtin_smulll_overflow(a, b, &c)} \\
+ Addition & \code{__builtin_saddll_overflow(a, b, \&c)} \\
+ Subtraktion & \code{__builtin_ssubll_overflow(a, b, \&c)} \\
+ Multiplikation & \code{__builtin_smulll_overflow(a, b, \&c)} \\
\hline
\end{tabularx}
\end{expandtable}
@@ -30,9 +30,9 @@
\begin{expandtable}
\begin{tabularx}{\linewidth}{|Ll|}
\hline
- Bit an Position j lesen & \code{(x & (1 << j)) != 0} \\
+ Bit an Position j lesen & \code{(x \& (1 << j)) != 0} \\
Bit an Position j setzten & \code{x |= (1 << j)} \\
- Bit an Position j löschen & \code{x &= ~(1 << j)} \\
+ Bit an Position j löschen & \code{x \&= ~(1 << j)} \\
Bit an Position j flippen & \code{x ^= (1 << j)} \\
Anzahl an führenden nullen ($x \neq 0$) & \code{__builtin_clzll(x)} \\
Anzahl an schließenden nullen ($x \neq 0$) & \code{__builtin_ctzll(x)} \\