Download cstack/include/l1_pmat.h from Snapkitty/flash-attention-rtl: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/Snapkitty/flash-attention-rtl/resolve/main/cstack/include/l1_pmat.h
- Command line
-
hf download hf://Snapkitty/flash-attention-rtl/cstack/include/l1_pmat.h
-
curl -L -o l1_pmat.h https://huggingface.co/Snapkitty/flash-attention-rtl/resolve/main/cstack/include/l1_pmat.h
1.04 kB
| /* Layer 1 - UAC: dense matrices over F_p (PMat). Row-major. */ | |
| typedef struct pmat { | |
| size_t rows, cols; | |
| gl_t *d; | |
| } pmat; | |
| cs_status pmat_new(pmat *m, size_t rows, size_t cols); /* zero-filled */ | |
| void pmat_free(pmat *m); | |
| cs_status pmat_identity(pmat *m, size_t n); | |
| gl_t pmat_get(const pmat *m, size_t r, size_t c); /* caller guarantees in range */ | |
| void pmat_set(pmat *m, size_t r, size_t c, gl_t v); | |
| int pmat_equal(const pmat *a, const pmat *b); | |
| cs_status pmat_add(const pmat *a, const pmat *b, pmat *out); | |
| cs_status pmat_sub(const pmat *a, const pmat *b, pmat *out); | |
| cs_status pmat_scale(const pmat *a, gl_t k, pmat *out); | |
| cs_status pmat_mul(const pmat *a, const pmat *b, pmat *out); | |
| cs_status pmat_transpose(const pmat *a, pmat *out); | |
| cs_status pmat_det(const pmat *a, gl_t *det); /* square only */ | |
| cs_status pmat_inverse(const pmat *a, pmat *out); /* CS_ERR_SINGULAR if det = 0 */ | |