Home | Develop | Download | Contact
pdsbmatrix.h
1 /*
2  * pdsbmatrix.h
3  *
4  * Copyright 2011 Fernando Pujaico Rivera <fernando.pujaico.rivera@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  */
22 
33 #ifndef __PDSBMATRIX_H__
34 #define __PDSBMATRIX_H__
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 
41 #ifndef TRUE
42  #define TRUE 1
43 #endif
44 
45 #ifndef FALSE
46  #define FALSE 0
47 #endif
48 
49 #include <stdio.h>
50 #include <pds/pdsbaglobal.h>
51 
66 typedef struct
67 {
76 }PdsBMatrix;
77 
78 
87 
88 
96 
97 
107 int pds_bmatrix_get_bit(const PdsBMatrix *BMatrix,PdsBaNatural lin,PdsBaNatural col,PdsBaBit *m);
108 
109 
120 
121 
131 
132 
142 
143 
154 
155 
165 
166 
176 
177 
188 
189 
198 int pds_bmatrix_alist_save(const PdsBMatrix *m,const char *filename);
199 
200 
209 int pds_bmatrix_is_zero(const PdsBMatrix *BMatrix, PdsBaNatural Lin);
210 
211 
218 int pds_bmatrix_printf(const PdsBMatrix *BMatrix);
219 
220 
227 void pds_bmatrix_free(PdsBMatrix *BMatrix);
228 
229 
236 void pds_bmatrix_destroy(PdsBMatrix **BMatrix);
237 
238 
243 #ifdef __cplusplus
244 }
245 #endif
246 
247 #endif
248 
249 
PdsBMatrix * pds_bmatrix_new(PdsBaNatural Nlin, PdsBaNatural Ncol)
Crea una matriz de tipo PdsBMatrix.
PdsBMatrix * pds_bmatrix_new_bmatrix(const PdsBMatrix *M)
Crea una matriz de tipo PdsBMatrix que es una copia de outra matriz.
int pds_bmatrix_set_first_zero(PdsBMatrix *M, PdsBaNatural j)
Obliga con XOR de la linea j que todos los vectores abajo y arriba de la fila j sean 0 en la columna ...
PdsBaNatural Nlin
Definition: pdsbmatrix.h:69
unsigned char PdsBaByte
Definition: pdsbaglobal.h:43
int pds_bmatrix_row_weight(const PdsBMatrix *BMatrix, PdsBaNatural lin, PdsBaNatural *m)
Retorna la cantidad de unos en la linea lin de la matriz BMatrix.
int pds_bmatrix_xor_row(PdsBMatrix *BMatrix, PdsBaNatural row1, PdsBaNatural row2)
Ejejcuta la siguiente operacion BMatrix[row1]=BMatrix[row1] XOR BMatrix[row2].
PdsBaByte ** M
Definition: pdsbmatrix.h:75
int pds_bmatrix_alist_save(const PdsBMatrix *m, const char *filename)
Escribe la matriz en un archivo con nombre filename en formato Alist. Mackay,.
int pds_bmatrix_find_first_one(PdsBMatrix *M, PdsBaNatural j)
Encuentra una linea que inicie en 1 en la columna "j" a partir de la fila "j"(inclusive). La primera fila que encuentre la coloca en la fila j.
PdsBMatrix * pds_bmatrix_systematize(const PdsBMatrix *S, PdsBaNatural *pos)
Retorna una matriz systemática o hasta donde se pueda sistematizar, carga en pos la linea del ultimo ...
int pds_bmatrix_printf(const PdsBMatrix *BMatrix)
Imprime en pantallala la matriz BMatrix.
PdsBaNatural Ncol
Definition: pdsbmatrix.h:73
La estructura tipo PdsBMatrix . Esta estructura genera una matriz binaria de Nel bits. Para usar incluir pds/pdsbmatrix.h.
Definition: pdsbmatrix.h:66
PdsBaNatural Nbytes
Definition: pdsbmatrix.h:71
void pds_bmatrix_free(PdsBMatrix *BMatrix)
Libera una matriz de tipo puntero PdsBMatrix.
unsigned char PdsBaBit
Definition: pdsbaglobal.h:49
int pds_bmatrix_get_bit(const PdsBMatrix *BMatrix, PdsBaNatural lin, PdsBaNatural col, PdsBaBit *m)
Obtiene el bit de la posición n del vector BMatrix y lo carga en m.
unsigned int PdsBaNatural
Definition: pdsbaglobal.h:55
int pds_bmatrix_is_zero(const PdsBMatrix *BMatrix, PdsBaNatural Lin)
Averigua si la matriz es nula desde la linea Lin (incluindo) hasta el final.
int pds_bmatrix_column_weight(const PdsBMatrix *BMatrix, PdsBaNatural col, PdsBaNatural *m)
Retorna la cantidad de unos en la columna col de la matriz BMatrix.
void pds_bmatrix_destroy(PdsBMatrix **BMatrix)
Libera una matriz de tipo puntero PdsBMatrix y ademas carga NULL en el puntero.
int pds_bmatrix_set_bit(PdsBMatrix *BMatrix, PdsBaNatural lin, PdsBaNatural col, PdsBaBit value)
Escribe el valor binario value en la posición (lin,col) de la matriz BMatrix.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed