This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <stdint.h> | |
| #include <math.h> | |
| //clear && gcc Bounded.c -lm -o m.o && ./m.o | |
| uint64_t BinomialCoefficient(int n, int k) | |
| { | |
| if (k < 0 || k > n) return 0; | |
| if (k > n - k) k = n - k; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #//Full walkthrough: https://leetarxiv.substack.com/p/coding-guide-monte-carlo-methods | |
| import hashlib | |
| import random | |
| import time | |
| class EllipticCurve: | |
| def __init__(self, a, b, p): | |
| self.a = a | |
| self.b = b | |
| self.p = p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| #include <assert.h> | |
| #include <stdbool.h> | |
| #include <flint/flint.h> | |
| #include <flint/fmpz.h> | |
| #include <flint/fq.h> | |
| #include <flint/fq_poly.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <math.h> | |
| #include <assert.h> | |
| #define STB_DS_IMPLEMENTATION | |
| #include "stb_ds.h" | |
| //clear && gcc Murage.c -lm -o m.o && ./m.o | |
| typedef struct kibicho_tensor_struct *KibichoTensor; | |
| typedef struct chebyshev_kan_layer_struct *ChebyshevKANLayer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void FP2_Multiply(AlgebraicInteger result, AlgebraicInteger a, AlgebraicInteger b, fmpz_t primeNumber) | |
| { | |
| if(!fmpz_equal(a->D, b->D)) | |
| { | |
| flint_printf("FP2_Multiply Error: Different D values\n"); | |
| exit(1); | |
| } | |
| fmpz_t temp1; | |
| fmpz_init(temp1); | |
| //result->x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Full walkthrough: https://leetarxiv.substack.com/p/coding-guide-monte-carlo-methods | |
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| #include <assert.h> | |
| #include <stdbool.h> | |
| #include <gmp.h> | |
| //clear && gcc PollardRho_EllipticCurve.c -lm -lgmp -o m.o && ./m.o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Full guide: https://leetarxiv.substack.com/p/coding-guide-monte-carlo-methods | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <math.h> | |
| #include <stdbool.h> | |
| #include <gmp.h> | |
| //clear && gcc PollardRho_IntegerDLP.c -lm -lgmp -o m.o && ./m.o | |
| void PollardRho_IntegerUpdate(mpz_t setElement, mpz_t exponentAnimal0, mpz_t exponentAnimal1, mpz_t desiredGenerator, mpz_t desiredResult, mpz_t primeNumberMinOne, mpz_t primeNumber, mpz_t temporary) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void TestMatmul() | |
| { | |
| int integerBits = 8; | |
| int fractionBits= 20; | |
| assert(integerBits + fractionBits < 32);assert(integerBits > -1);assert(fractionBits > -1); | |
| /*Create mandatory constants*/ | |
| PMat32 ONE_CONSTANT = (1 << fractionBits); | |
| PMat32 MAX_CONSTANT = (1 << (integerBits + fractionBits)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| // Helper to get/set elements in a 1D matrix (row-major) | |
| #define MAT(m, row, col, numCols) ((m)[(row)*(numCols)+(col)]) | |
| // Swap two rows in a 1D array | |
| void swapRows(int *matrix, int row1, int row2, int numCols) { | |
| for (int col = 0; col < numCols; col++) { | |
| int temp = MAT(matrix, row1, col, numCols); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Full guide : https://leetarxiv.substack.com/p/solving-pell-equations-with-index | |
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| #include <assert.h> | |
| #include <stdbool.h> | |
| #include <math.h> | |
| #include <gmp.h> | |
| #define STB_DS_IMPLEMENTATION |