M4RIE  0.20111004
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
permutation.h
Go to the documentation of this file.
1 
8 #ifndef M4RIE_PERMUTATION_H
9 #define M4RIE_PERMUTATION_H
10 
11 /******************************************************************************
12 *
13 * M4RIE: Linear Algebra over GF(2^e)
14 *
15 * Copyright (C) 2011 Martin Albrecht <martinralbrecht@googlemail.com>
16 *
17 * Distributed under the terms of the GNU General Public License (GEL)
18 * version 2 or higher.
19 *
20 * This code is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * General Public License for more details.
24 *
25 * The full text of the GPL is available at:
26 *
27 * http://www.gnu.org/licenses/
28 ******************************************************************************/
29 
30 #include <m4ri/mzp.h>
31 #include <m4rie/mzed.h>
32 #include <m4rie/mzd_slice.h>
33 
43 static inline void mzed_apply_p_left(mzed_t *A, mzp_t const *P) {
44  mzd_apply_p_left(A->x, P);
45 }
46 
56 static inline void mzed_apply_p_left_trans(mzed_t *A, mzp_t const *P) {
57  mzd_apply_p_left_trans(A->x, P);
58 }
59 
69 static inline void mzed_apply_p_right(mzed_t *A, mzp_t const *P) {
70  if(A->nrows == 0)
71  return;
72  rci_t const length = MIN(P->length, A->ncols);
73  for (rci_t i = length-1; i >= 0; --i) {
74  mzed_col_swap(A, i, P->values[i]);
75  }
76 }
77 
87 static inline void mzed_apply_p_right_trans(mzed_t *A, mzp_t const *P) {
88  if(A->nrows == 0)
89  return;
90  rci_t const length = MIN(P->length, A->ncols);
91  for (rci_t i = 0; i < length; ++i) {
92  mzed_col_swap(A, i, P->values[i]);
93  }
94 }
95 
105 static inline void mzd_slice_apply_p_left(mzd_slice_t *A, mzp_t const *P) {
106  for(int i=0; i<A->depth; i++) {
107  mzd_apply_p_left(A->x[i], P);
108  }
109 }
110 
120 static inline void mzd_slice_apply_p_left_trans(mzd_slice_t *A, mzp_t const *P) {
121  for(int i=0; i<A->depth; i++) {
122  mzd_apply_p_left_trans(A->x[i], P);
123  }
124 }
125 
135 static inline void mzd_slice_apply_p_right(mzd_slice_t *A, mzp_t const *P) {
136  for(int i=0; i<A->depth; i++) {
137  mzd_apply_p_right(A->x[i], P);
138  }
139 }
140 
150 static inline void mzd_slice_apply_p_right_trans(mzd_slice_t *A, mzp_t const *P) {
151  for(int i=0; i<A->depth; i++) {
152  mzd_apply_p_right_trans(A->x[i], P);
153  }
154 }
155 
167 static inline void mzd_slice_apply_p_right_trans_tri(mzd_slice_t *A, mzp_t const *P) {
168  for(int i=0; i<A->depth; i++) {
169  mzd_apply_p_right_trans_tri(A->x[i], P);
170  }
171 }
172 
173 
174 #endif // M4RIE_PERMUTATION_H
Dense matrices over represented as packed matrices.
Definition: mzed.h:59
unsigned int depth
Definition: mzd_slice.h:60
static void mzd_slice_apply_p_right_trans_tri(mzd_slice_t *A, mzp_t const *P)
Definition: permutation.h:167
mzd_t * x
Definition: mzed.h:60
rci_t nrows
Definition: mzed.h:62
static void mzed_apply_p_left_trans(mzed_t *A, mzp_t const *P)
Definition: permutation.h:56
static void mzed_apply_p_right_trans(mzed_t *A, mzp_t const *P)
Definition: permutation.h:87
static void mzd_slice_apply_p_right(mzd_slice_t *A, mzp_t const *P)
Definition: permutation.h:135
rci_t ncols
Definition: mzed.h:63
mzd_t * x[16]
Definition: mzd_slice.h:57
static void mzd_slice_apply_p_left_trans(mzd_slice_t *A, mzp_t const *P)
Definition: permutation.h:120
static void mzed_apply_p_right(mzed_t *A, mzp_t const *P)
Definition: permutation.h:69
Dense matrices over represented as slices of matrices over .
Definition: mzd_slice.h:56
static void mzed_apply_p_left(mzed_t *A, mzp_t const *P)
Definition: permutation.h:43
static void mzed_col_swap(mzed_t *M, const rci_t cola, const rci_t colb)
Swap the two columns cola and colb.
Definition: mzed.h:940
static void mzd_slice_apply_p_right_trans(mzd_slice_t *A, mzp_t const *P)
Definition: permutation.h:150
static void mzd_slice_apply_p_left(mzd_slice_t *A, mzp_t const *P)
Definition: permutation.h:105