Home | Develop | Download | Contact
pdsbvector.h
1 /*
2  * pdsbvector.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 __PDSBVECTOR_H__
34 #define __PDSBVECTOR_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 {
74 }PdsBVector;
75 
83 
84 
92 int pds_bvector_init(PdsBVector *BVector, PdsBaBit Bit);
93 
94 
103 
104 
113 int pds_bvector_cmp(const PdsBVector *BVector1,const PdsBVector *BVector2, PdsBaNatural *n);
114 
115 
124 int pds_bvector_cp(PdsBVector *BVector1,const PdsBVector *BVector2);
125 
126 
137 
138 
147 int pds_bvector_get_byte(const PdsBVector *BVector,PdsBaNatural n,PdsBaByte *m);
148 
149 
159 
160 
169 int pds_bvector_get_bit(const PdsBVector *BVector,PdsBaNatural n,PdsBaBit *m);
170 
171 
181 
182 
183 
191 int pds_bvector_weight_bvector(const PdsBVector *BVector,PdsBaNatural *n);
192 
193 
201 int pds_bvector_mean_bvector(const PdsBVector *BVector,PdsBaReal *m);
202 
203 
212 int pds_bvector_xor_bvector(PdsBVector *BVector1,const PdsBVector *BVector2);
213 
214 
224 int pds_bvector_xor_bvectors(PdsBVector *BVector1,const PdsBVector *BVector2,const PdsBVector *BVector3);
225 
226 
240 int pds_bvector_cor_bvector(const PdsBVector *VectorX,const PdsBVector *VectorY, PdsBaReal *c);
241 
242 
249 int pds_bvector_printf(const PdsBVector *BVector);
250 
251 
258 void pds_bvector_free(PdsBVector *BVector);
259 
260 
267 void pds_bvector_destroy(PdsBVector **BVector);
268 
269 
274 #ifdef __cplusplus
275 }
276 #endif
277 
278 #endif
279 /* FPRNEURON_H */
280 
int pds_bvector_cp(PdsBVector *BVector1, const PdsBVector *BVector2)
Copia el contenido del vector BVector2 a BVector1, ambos vectores deben tener el mismo tamaño...
void pds_bvector_destroy(PdsBVector **BVector)
Libera un vector de tipo puntero PdsBVector.
PdsBaByte * V
Definition: pdsbvector.h:69
int pds_bvector_set_bit(PdsBVector *BVector, PdsBaNatural n, PdsBaBit m)
Escribe el bit de la posición n del vector BVector y lo carga desde m.
unsigned char PdsBaByte
Definition: pdsbaglobal.h:43
int pds_bvector_xor_bvectors(PdsBVector *BVector1, const PdsBVector *BVector2, const PdsBVector *BVector3)
realiza a operación: BVector1 = BVector2 XOR BVector3;
int pds_bvector_get_byte(const PdsBVector *BVector, PdsBaNatural n, PdsBaByte *m)
Obtiene el byte de la posición n del vector BVector y lo carga en m.
int pds_bvector_xor_bvector(PdsBVector *BVector1, const PdsBVector *BVector2)
realiza a operación: BVector1 = BVector1 XOR BVector2;
PdsBaNatural Nel
Definition: pdsbvector.h:71
int pds_bvector_set_natural(PdsBVector *BVector, PdsBaNatural n)
Escribe un número natural codificado en binario, en el vector BVector. Si el número en binario es may...
int pds_bvector_init(PdsBVector *BVector, PdsBaBit Bit)
Inicia con el valor Bit los Nel bits del vector.
float PdsBaReal
Definition: pdsbaglobal.h:61
int pds_bvector_printf(const PdsBVector *BVector)
Imprime en pantalla todos los elementos del vector;.
void pds_bvector_free(PdsBVector *BVector)
Libera un vector de tipo puntero PdsBVector.
PdsBaNatural Nbytes
Definition: pdsbvector.h:73
int pds_bvector_mean_bvector(const PdsBVector *BVector, PdsBaReal *m)
Retorna el valor medio del vector binario BVector.
int pds_bvector_cor_bvector(const PdsBVector *VectorX, const PdsBVector *VectorY, PdsBaReal *c)
Devuelve el valor del coeficiente de correlación muestral de los vectores VectorX y VectorY...
int pds_bvector_init_rand(PdsBVector *BVector, PdsBaReal p)
Inicia el vector con algunos "1"s, cada bit tiene una probabilidad p de ser "1" (P{V_i=1}=p).
int pds_bvector_cmp(const PdsBVector *BVector1, const PdsBVector *BVector2, PdsBaNatural *n)
Encuentra el número de elementos distintos entre los dos vectores.
unsigned char PdsBaBit
Definition: pdsbaglobal.h:49
int pds_bvector_get_bit(const PdsBVector *BVector, PdsBaNatural n, PdsBaBit *m)
Obtiene el bit de la posición n del vector BVector y lo carga en m.
int pds_bvector_set_byte(PdsBVector *BVector, PdsBaNatural n, PdsBaByte m)
Escribe en el byte de la posición n del vector BVector, desde m.
PdsBVector * pds_bvector_new(PdsBaNatural Nel)
Crea una matriz de tipo PdsBVector.
unsigned int PdsBaNatural
Definition: pdsbaglobal.h:55
int pds_bvector_weight_bvector(const PdsBVector *BVector, PdsBaNatural *n)
Retorna el peso del vector binario BVector.
La estructura tipo PdsBVector . Esta estructura genera un vector binario de Nel bits. Para usar incluir pds/pdsbvector.h.
Definition: pdsbvector.h:66

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed