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-2006 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.h,v $
00021  * $Revision: 1.21 $
00022  * $Date: 2006/03/04 16:32:05 $
00023  */
00024 
00025 
00026 #ifndef _GDSL_PERM_H_
00027 #define _GDSL_PERM_H_
00028 
00029 
00030 #include "gdsl_types.h"
00031 
00032 
00033 #ifdef __cplusplus
00034 extern "C" 
00035 {
00036 #endif /* __cplusplus */
00037 
00038 
00050 typedef struct gdsl_perm* gdsl_perm_t;
00051 
00055 typedef enum
00056 {
00058     GDSL_PERM_POSITION_FIRST = 1,
00059 
00061     GDSL_PERM_POSITION_LAST = 2
00062 
00063 } gdsl_perm_position_t;
00064 
00073 typedef void (* gdsl_perm_write_func_t) 
00074     (ulong E,
00075      FILE* OUTPUT_FILE,
00076      gdsl_location_t POSITION,
00077      void* USER_DATA
00078      );
00079 
00080 typedef struct gdsl_perm_data* gdsl_perm_data_t;
00081 
00082 /******************************************************************************/
00083 /* Management functions of permutations                                       */
00084 /******************************************************************************/
00085 
00102 extern gdsl_perm_t
00103 gdsl_perm_alloc (const char* NAME,
00104          const ulong N
00105          );
00106 
00118 extern void
00119 gdsl_perm_free (gdsl_perm_t P
00120         );
00121 
00136 extern gdsl_perm_t
00137 gdsl_perm_copy (const gdsl_perm_t P
00138         );
00139 
00140 /******************************************************************************/
00141 /* Consultation functions of permutations                                     */
00142 /******************************************************************************/
00143 
00153 extern const char*
00154 gdsl_perm_get_name (const gdsl_perm_t P
00155             );
00156 
00166 extern ulong
00167 gdsl_perm_get_size (const gdsl_perm_t P
00168             );
00169 
00180 extern ulong
00181 gdsl_perm_get_element (const gdsl_perm_t P,
00182                const ulong INDIX
00183                );
00184 
00194 extern ulong*
00195 gdsl_perm_get_elements_array (const gdsl_perm_t P
00196                   );
00197 
00205 extern ulong
00206 gdsl_perm_linear_inversions_count (const gdsl_perm_t P
00207                    );
00208 
00217 extern ulong
00218 gdsl_perm_linear_cycles_count (const gdsl_perm_t P
00219                    );
00220 
00229 extern ulong
00230 gdsl_perm_canonical_cycles_count (const gdsl_perm_t P
00231                   );
00232 
00233 /******************************************************************************/
00234 /* Modification functions of permutations                                     */
00235 /******************************************************************************/
00236 
00250 extern gdsl_perm_t
00251 gdsl_perm_set_name (gdsl_perm_t P,
00252             const char* NEW_NAME
00253             );
00254 
00267 extern gdsl_perm_t
00268 gdsl_perm_linear_next (gdsl_perm_t P
00269                );
00270 
00283 extern gdsl_perm_t
00284 gdsl_perm_linear_prev (gdsl_perm_t P
00285                );
00286 
00302 extern gdsl_perm_t
00303 gdsl_perm_set_elements_array (gdsl_perm_t P,
00304                   const ulong* ARRAY
00305                   );
00306 
00307 /******************************************************************************/
00308 /* Operations functions of permutations                                       */
00309 /******************************************************************************/
00310 
00325 extern gdsl_perm_t
00326 gdsl_perm_multiply (gdsl_perm_t RESULT,
00327             const gdsl_perm_t ALPHA,
00328             const gdsl_perm_t BETA
00329             );
00330   
00344 extern gdsl_perm_t
00345 gdsl_perm_linear_to_canonical (gdsl_perm_t Q,
00346                    const gdsl_perm_t P
00347                    );
00348 
00362 extern gdsl_perm_t
00363 gdsl_perm_canonical_to_linear (gdsl_perm_t Q,
00364                    const gdsl_perm_t P
00365                    );
00366 
00376 extern gdsl_perm_t
00377 gdsl_perm_inverse (gdsl_perm_t P
00378            );
00379 
00388 extern gdsl_perm_t
00389 gdsl_perm_reverse (gdsl_perm_t P
00390            );
00391 
00403 extern gdsl_perm_t
00404 gdsl_perm_randomize (gdsl_perm_t P
00405              );
00406 
00417 extern gdsl_element_t*
00418 gdsl_perm_apply_on_array (gdsl_element_t* V,
00419               const gdsl_perm_t P
00420               );
00421 
00422 /******************************************************************************/
00423 /* Input/output functions of permutations                                     */
00424 /******************************************************************************/
00425 
00442 extern void
00443 gdsl_perm_write (const gdsl_perm_t P,
00444          const gdsl_write_func_t WRITE_F,
00445          FILE* OUTPUT_FILE,
00446          void* USER_DATA
00447          );
00448 
00467 extern void
00468 gdsl_perm_write_xml (const gdsl_perm_t P,
00469              const gdsl_write_func_t WRITE_F,
00470              FILE* OUTPUT_FILE,
00471              void* USER_DATA
00472              );
00473 
00491 extern void
00492 gdsl_perm_dump (const gdsl_perm_t P,
00493         const gdsl_write_func_t WRITE_F,
00494         FILE* OUTPUT_FILE,
00495         void* USER_DATA
00496         );
00497 
00498 /*
00499  * @}
00500  */
00501 
00502 
00503 #ifdef __cplusplus
00504 }
00505 #endif /* __cplusplus */
00506 
00507 
00508 #endif /* _GDSL_PERM_H_ */
00509 
00510 

Generated on Tue Nov 7 17:53:33 2006 for gdsl by  doxygen 1.4.6