20namespace layer1_foundations {
21namespace linear_algebra {
38 std::string &Berlekamp_matrix_coeffs,
41 int f_v = (verbose_level >= 1);
44 cout <<
"linear_algebra_global::Berlekamp_matrix" << endl;
68 for (i = 0; i <= da; i++) {
69 if (data_A[i] < 0 || data_A[i] >= F->
q) {
70 data_A[i] = NT.
mod(data_A[i], F->
q);
72 FX.
s_i(A, i) = data_A[i];
90 cout <<
"linear_algebra_global::Berlekamp_matrix before FX.Berlekamp_matrix" << endl;
98 cout <<
"linear_algebra_global::Berlekamp_matrix after FX.Berlekamp_matrix" << endl;
102 cout <<
"B=" << endl;
110 cout <<
"The matrix B has rank " << r << endl;
116 cout <<
"linear_algebra_global::Berlekamp_matrix done" << endl;
125 int d,
int verbose_level)
127 int f_v = (verbose_level >= 1);
131 cout <<
"linear_algebra_global::compute_normal_basis "
132 <<
" q=" << F->
q << endl;
133 cout <<
"verbose_level=" << verbose_level << endl;
145 cout <<
"linear_algebra_global::compute_normal_basis "
146 "chosen irreducible polynomial is " << poly << endl;
158 cout <<
"linear_algebra_global::compute_normal_basis "
159 "chosen irreducible polynomial m = ";
174 cout <<
"linear_algebra_global::compute_normal_basis "
175 "before FX.Frobenius_matrix" << endl;
179 cout <<
"linear_algebra_global::compute_normal_basis "
180 "Frobenius_matrix = " << endl;
186 cout <<
"linear_algebra_global::compute_normal_basis "
187 "before compute_normal_basis" << endl;
193 cout <<
"linear_algebra_global::compute_normal_basis "
194 "Normal_basis = " << endl;
200 cout <<
"linear_algebra_global::compute_normal_basis done" << endl;
207 int *M,
int m,
int n,
208 int f_normalize_from_the_left,
int f_normalize_from_the_right,
211 int f_v = (verbose_level >= 1);
219 cout <<
"linear_algebra_global::do_nullspace" << endl;
228 cout <<
"linear_algebra_global::do_nullspace before Linear_algebra->perp_standard" << endl;
234 cout <<
"linear_algebra_global::do_nullspace after Linear_algebra->perp_standard" << endl;
239 cout <<
"linear_algebra_global::do_nullspace after perp_standard:" << endl;
241 cout <<
"rk=" << rk << endl;
246 FALSE , NULL , n - rk, n, n,
251 cout <<
"linear_algebra_global::do_nullspace after RREF" << endl;
253 cout <<
"rank of nullspace = " << rk1 << endl;
255 cout <<
"linear_algebra_global::do_nullspace coefficients:" << endl;
259 cout <<
"$$" << endl;
260 cout <<
"\\left[" << endl;
262 cout <<
"\\right]" << endl;
263 cout <<
"$$" << endl;
266 if (f_normalize_from_the_left) {
268 cout <<
"linear_algebra_global::do_nullspace normalizing from the left" << endl;
270 for (i = rk; i < n; i++) {
275 cout <<
"linear_algebra_global::do_nullspace after normalize from the left:" << endl;
277 cout <<
"rk=" << rk << endl;
279 cout <<
"$$" << endl;
280 cout <<
"\\left[" << endl;
282 cout <<
"\\right]" << endl;
283 cout <<
"$$" << endl;
287 if (f_normalize_from_the_right) {
289 cout <<
"linear_algebra_global::do_nullspace normalizing from the right" << endl;
291 for (i = rk; i < n; i++) {
296 cout <<
"linear_algebra_global::do_nullspace after normalize from the right:" << endl;
298 cout <<
"rk=" << rk << endl;
300 cout <<
"$$" << endl;
301 cout <<
"\\left[" << endl;
303 cout <<
"\\right]" << endl;
304 cout <<
"$$" << endl;
315 snprintf(str, 1000,
"nullspace_%d_%d.tex", m, n);
317 snprintf(title, 1000,
"Nullspace");
339 cout <<
"linear_algebra_global::do_nullspace before report" << endl;
343 ost <<
"\\noindent Input matrix:" << endl;
345 ost <<
"\\left[" << endl;
347 ost <<
"\\right]" << endl;
350 ost <<
"RREF:" << endl;
352 ost <<
"\\left[" << endl;
354 ost <<
"\\right]" << endl;
357 ost <<
"Basis for Perp:" << endl;
359 ost <<
"\\left[" << endl;
361 ost <<
"\\right]" << endl;
366 cout <<
"linear_algebra_global::do_nullspace after report" << endl;
375 cout <<
"linear_algebra_global::do_nullspace written file " << fname <<
" of size "
386 cout <<
"linear_algebra_global::do_nullspace done" << endl;
392 int *M,
int m,
int n,
393 int f_normalize_from_the_left,
int f_normalize_from_the_right,
396 int f_v = (verbose_level >= 1);
403 cout <<
"linear_algebra_global::do_RREF" << endl;
412 cout <<
"linear_algebra_global::do_RREF input matrix A:" << endl;
418 FALSE , NULL , m, n, n,
423 cout <<
"linear_algebra_global::do_RREF after RREF:" << endl;
425 cout <<
"rk=" << rk << endl;
427 cout <<
"coefficients:" << endl;
431 cout <<
"$$" << endl;
432 cout <<
"\\left[" << endl;
434 cout <<
"\\right]" << endl;
435 cout <<
"$$" << endl;
440 if (f_normalize_from_the_left) {
442 cout <<
"normalizing from the left" << endl;
444 for (i = 0; i < rk; i++) {
449 cout <<
"after normalize from the left:" << endl;
451 cout <<
"rk=" << rk << endl;
455 if (f_normalize_from_the_right) {
457 cout <<
"normalizing from the right" << endl;
459 for (i = 0; i < rk; i++) {
464 cout <<
"after normalize from the right:" << endl;
466 cout <<
"rk=" << rk << endl;
481 cout <<
"linear_algebra_global::do_RREF done" << endl;
487 int *A,
int m,
int n,
int verbose_level)
489 int f_v = (verbose_level >= 1);
492 cout <<
"linear_algebra_global::RREF_demo" << endl;
502 snprintf(str, 1000,
"RREF_example_q%d_%d_%d.tex", F->
q, m, n);
504 snprintf(title, 1000,
"RREF example $q=%d$", F->
q);
526 cout <<
"linear_algebra_global::RREF_demo before RREF_with_steps_latex" << endl;
530 cout <<
"linear_algebra_global::RREF_demo after RREF_with_steps_latex" << endl;
539 cout <<
"written file " << fname <<
" of size "
545 cout <<
"linear_algebra_global::RREF_demo done" << endl;
551 std::ostream &ost,
int *A,
int m,
int n,
int verbose_level)
553 int f_v = (verbose_level >= 1);
560 cout <<
"linear_algebra_global::RREF_with_steps_latex" << endl;
564 ost <<
"{\\bf \\Large" << endl;
571 ost <<
"\\noindent A matrix over the field ${\\mathbb F}_{" << F->
q <<
"}$\\\\" << endl;
573 ost <<
"\\left[" << endl;
575 ost <<
"\\right]" << endl;
578 if ((cnt % 3) == 0) {
590 i, j, base_cols, verbose_level)) {
591 ost <<
"\\noindent Position $(i,j)=(" << i <<
"," << j <<
"),$ found pivot in column " << base_cols[i] <<
"\\\\" << endl;
593 ost <<
"\\left[" << endl;
595 ost <<
"\\right]" << endl;
598 if ((cnt % 3) == 0) {
607 ost <<
"\\noindent After making pivot 1:\\\\" << endl;
609 ost <<
"\\left[" << endl;
611 ost <<
"\\right]" << endl;
614 if ((cnt % 3) == 0) {
623 ost <<
"\\noindent After elimination below pivot:\\\\" << endl;
625 ost <<
"\\left[" << endl;
627 ost <<
"\\right]" << endl;
630 if ((cnt % 3) == 0) {
640 ost <<
"Did not find pivot. The rank of the matrix is " << rk <<
".\\\\" << endl;
644 for (i = rk - 1; i >= 0; i--) {
646 ost <<
"\\noindent After elimination above pivot " << i <<
" in position (" << i <<
"," << base_cols[i] <<
"):\\\\" << endl;
648 ost <<
"\\left[" << endl;
650 ost <<
"\\right]" << endl;
653 if ((cnt % 3) == 0) {
662 ost <<
"\\\\" << endl;
670 cout <<
"linear_algebra_global::RREF_with_steps_latex done" << endl;
a collection of combinatorial functions
void PG_element_normalize_from_front(int *v, int stride, int len)
void PG_element_normalize(int *v, int stride, int len)
linear_algebra::linear_algebra * Linear_algebra
provides access to pre-computed combinatorial data in encoded form
void get_primitive_polynomial(std::string &poly, int p, int e, int verbose_level)
void do_nullspace(field_theory::finite_field *F, int *M, int m, int n, int f_normalize_from_the_left, int f_normalize_from_the_right, int verbose_level)
void compute_normal_basis(field_theory::finite_field *F, int d, int verbose_level)
void Berlekamp_matrix(field_theory::finite_field *F, std::string &Berlekamp_matrix_coeffs, int verbose_level)
void RREF_demo(field_theory::finite_field *F, int *A, int m, int n, int verbose_level)
void RREF_with_steps_latex(field_theory::finite_field *F, std::ostream &ost, int *A, int m, int n, int verbose_level)
void do_RREF(field_theory::finite_field *F, int *M, int m, int n, int f_normalize_from_the_left, int f_normalize_from_the_right, int verbose_level)
void RREF_elimination_above(int *A, int m, int n, int i, int *base_cols, int verbose_level)
int RREF_search_pivot(int *A, int m, int n, int &i, int &j, int *base_cols, int verbose_level)
int Gauss_int(int *A, int f_special, int f_complete, int *base_cols, int f_P, int *P, int m, int n, int Pn, int verbose_level)
void RREF_elimination_below(int *A, int m, int n, int &i, int &j, int *base_cols, int verbose_level)
void RREF_make_pivot_one(int *A, int m, int n, int &i, int &j, int *base_cols, int verbose_level)
int perp_standard(int n, int k, int *A, int verbose_level)
int rank_of_matrix(int *A, int m, int verbose_level)
basic number theoretic functions
long int mod(long int a, long int p)
a collection of functions related to file io
long int file_size(std::string &fname)
interface to create latex output files
void int_matrix_print_tex(std::ostream &ost, int *p, int m, int n)
void head(std::ostream &ost, int f_book, int f_title, const char *title, const char *author, int f_toc, int f_landscape, int f_12pt, int f_enlarged_page, int f_pagenumbers, const char *extras_for_preamble)
void foot(std::ostream &ost)
void get_vector_from_label(std::string &label, int *&v, int &sz, int verbose_level)
domain of polynomials in one variable over a finite field
void compute_normal_basis(int d, int *Normal_basis, int *Frobenius, int verbose_level)
int & s_i(unipoly_object p, int i)
void create_object_of_degree(unipoly_object &p, int d)
void Frobenius_matrix(int *&Frob, unipoly_object factor_polynomial, int verbose_level)
void create_object_by_rank(unipoly_object &p, long int rk, const char *file, int line, int verbose_level)
void create_object_by_rank_string(unipoly_object &p, std::string &rk, int verbose_level)
void Berlekamp_matrix(int *&B, unipoly_object factor_polynomial, int verbose_level)
void print_object(unipoly_object p, std::ostream &ost)
#define Int_vec_print_fully(A, B, C)
#define Int_matrix_print(A, B, C)
#define Int_vec_copy(A, B, C)
#define Int_vec_print(A, B, C)
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects