tifa_factor.h File Reference

TIFA's generic factorization function. More...

#include <gmp.h>
#include "array.h"
#include "factoring_machine.h"
#include "exit_codes.h"

Go to the source code of this file.

Defines

#define _TIFA_TIFA_FACTOR_H_

Functions

ecode_t tifa_factor (mpz_array_t *const factors, uint32_array_t *const multis, const mpz_t n, const factoring_mode_t mode)
 Generic Integer factorization.


Detailed Description

TIFA's generic factorization function.

Author:
Jerome Milan
Date:
Fri Jun 10 2011
Version:
2011-06-10
This is the TIFA library's generic factorization function: it picks the most suitable factoring algorithm depending on the size of the number to factor.

Definition in file tifa_factor.h.


Define Documentation

#define _TIFA_TIFA_FACTOR_H_

Standard include guard.

Definition at line 36 of file tifa_factor.h.


Function Documentation

ecode_t tifa_factor ( mpz_array_t *const   factors,
uint32_array_t *const   multis,
const mpz_t  n,
const factoring_mode_t  mode 
)

Generic Integer factorization.

Attempts to factor the non perfect square integer n with the most suitable algorithm (chosen according to the size of n) and with the factoring mode given by mode. Found factors are then stored in factors. Additionally, if the factoring mode used is set to FIND_COMPLETE_FACTORIZATION, factors' multiplicities are stored in the array multis. For the time being, no trial divisions are performed so depending on the situation, it could be worthwhile to carry out such a step before calling tifa_factor.

Note:
If the factoring mode used is different from FIND_COMPLETE_FACTORIZATION, multis is allowed to be a NULL pointer. Otherwise, using a NULL pointer will lead to a fatal error.
Warning:
If the factors and multis arrays have not enough room to store the found factors (and the multiplicities, if any), they will be automatically resized to accommodate the data. This has to be kept in mind when trying to do ingenious stuff with memory management (hint: don't try to be clever here).
Parameters:
[out] factors Pointer to the found factors of n.
[out] multis Pointer to the multiplicities of the found factors (only computed if mode is set to FIND_COMPLETE_FACTORIZATION).
[in] n The non perfect square integer to factor.
[in] mode The factoring mode to use.
Returns:
An exit code.


Generated on Fri Jun 17 11:10:12 2011 for TIFA by Doxygen 1.5.5