Main Page | Modules | File List | Globals

gdsl_perm.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of the Generic Data Structures Library (GDSL).
00003  * Copyright (C) 1998-2004 Nicolas Darnis <ndarnis@free.fr>.
00004  *
00005  * The GDSL library is free software; you can redistribute it and/or 
00006  * modify it under the terms of the GNU General Public License as 
00007  * published by the Free Software Foundation; either version 2 of
00008  * the License, or (at your option) any later version.
00009  *
00010  * The GDSL library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with the GDSL library; see the file COPYING.
00017  * If not, write to the Free Software Foundation, Inc., 
00018  * 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
00019  *
00020  * $RCSfile: gdsl__perm_8h-source.html,v $
00021  * $Revision: 1.4 $
00022  * $Date: 2004/10/03 14:35:38 $
00023  */
00024 
00025 #ifndef _GDSL_PERM_H_
00026 #define _GDSL_PERM_H_
00027 
00028 
00029 #include "gdsl_types.h"
00030 
00031 
00032 #ifdef __cplusplus
00033 extern "C" 
00034 {
00035 #endif /* __cplusplus */
00036 
00037 
00049 typedef struct gdsl_perm* gdsl_perm_t;
00050 
00054 typedef enum
00055 {
00057     GDSL_PERM_POSITION_FIRST = 1,
00058 
00060     GDSL_PERM_POSITION_LAST = 2
00061 
00062 } gdsl_perm_position_t;
00063 
00072 typedef void (* gdsl_perm_write_func_t) 
00073      (ulong E,
00074       FILE* OUTPUT_FILE,
00075       gdsl_perm_position_t POSITION,
00076       void* USER_DATA
00077       );
00078 
00079 /******************************************************************************/
00080 /* Management functions of permutations                                       */
00081 /******************************************************************************/
00082 
00099 extern gdsl_perm_t
00100 gdsl_perm_alloc (const char* NAME,
00101          const ulong N
00102          );
00103 
00115 extern void
00116 gdsl_perm_free (gdsl_perm_t P
00117         );
00118 
00133 extern gdsl_perm_t
00134 gdsl_perm_copy (const gdsl_perm_t P
00135         );
00136 
00137 /******************************************************************************/
00138 /* Consultation functions of permutations                                     */
00139 /******************************************************************************/
00140 
00150 extern const char*
00151 gdsl_perm_get_name (const gdsl_perm_t P
00152             );
00153 
00163 extern ulong
00164 gdsl_perm_get_size (const gdsl_perm_t P
00165             );
00166 
00177 extern ulong
00178 gdsl_perm_get_element (const gdsl_perm_t P,
00179                const ulong INDIX
00180                );
00181 
00191 extern ulong*
00192 gdsl_perm_get_elements_array (const gdsl_perm_t P
00193                   );
00194 
00202 extern ulong
00203 gdsl_perm_linear_inversions_count (const gdsl_perm_t P
00204                    );
00205 
00214 extern ulong
00215 gdsl_perm_linear_cycles_count (const gdsl_perm_t P
00216                    );
00217 
00226 extern ulong
00227 gdsl_perm_canonical_cycles_count (const gdsl_perm_t P
00228                   );
00229 
00230 /******************************************************************************/
00231 /* Modification functions of permutations                                     */
00232 /******************************************************************************/
00233 
00247 extern gdsl_perm_t
00248 gdsl_perm_set_name (gdsl_perm_t P,
00249             const char* NEW_NAME
00250             );
00251 
00264 extern gdsl_perm_t
00265 gdsl_perm_linear_next (gdsl_perm_t P
00266                );
00267 
00280 extern gdsl_perm_t
00281 gdsl_perm_linear_prev (gdsl_perm_t P
00282                );
00283 
00299 extern gdsl_perm_t
00300 gdsl_perm_set_elements_array (gdsl_perm_t P,
00301                   const ulong* ARRAY
00302                   );
00303 
00304 /******************************************************************************/
00305 /* Operations functions of permutations                                       */
00306 /******************************************************************************/
00307 
00322 extern gdsl_perm_t
00323 gdsl_perm_multiply (gdsl_perm_t RESULT,
00324             const gdsl_perm_t ALPHA,
00325             const gdsl_perm_t BETA
00326             );
00327   
00341 extern gdsl_perm_t
00342 gdsl_perm_linear_to_canonical (gdsl_perm_t Q,
00343                    const gdsl_perm_t P
00344                    );
00345 
00359 extern gdsl_perm_t
00360 gdsl_perm_canonical_to_linear (gdsl_perm_t Q,
00361                    const gdsl_perm_t P
00362                    );
00363 
00373 extern gdsl_perm_t
00374 gdsl_perm_inverse (gdsl_perm_t P
00375            );
00376 
00385 extern gdsl_perm_t
00386 gdsl_perm_reverse (gdsl_perm_t P
00387            );
00388 
00400 extern gdsl_perm_t
00401 gdsl_perm_randomize (gdsl_perm_t P
00402              );
00403 
00414 extern gdsl_element_t*
00415 gdsl_perm_apply_on_array (gdsl_element_t* V,
00416               const gdsl_perm_t P
00417               );
00418 
00419 /******************************************************************************/
00420 /* Input/output functions of permutations                                     */
00421 /******************************************************************************/
00422 
00439 extern void
00440 gdsl_perm_write (const gdsl_perm_t P,
00441          const gdsl_perm_write_func_t WRITE_F,
00442          FILE* OUTPUT_FILE,
00443          void* USER_DATA
00444          );
00445 
00464 extern void
00465 gdsl_perm_write_xml (const gdsl_perm_t P,
00466              const gdsl_write_func_t WRITE_F,
00467              FILE* OUTPUT_FILE,
00468              void* USER_DATA
00469              );
00470 
00488 extern void
00489 gdsl_perm_dump (const gdsl_perm_t P,
00490         const gdsl_write_func_t WRITE_F,
00491         FILE* OUTPUT_FILE,
00492         void* USER_DATA
00493         );
00494 
00495 /*
00496  * @}
00497  */
00498 
00499 
00500 #ifdef __cplusplus
00501 }
00502 #endif /* __cplusplus */
00503 
00504 
00505 #endif /* _GDSL_PERM_H_ */
00506 

Generated on Sun Oct 3 16:15:50 2004 for GDSL by doxygen 1.3.5