factoring_machine.h File Reference

Abstraction of an integer factorization algorithm. More...

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

Go to the source code of this file.

Data Structures

struct  struct_factoring_machine
 Defines a structure to represent the logic behind all factorization algorithms. More...

Defines

#define _TIFA_FACTORING_MACHINE_H_

Typedefs

typedef enum factoring_mode_enum factoring_mode_t
 Equivalent to struct factoring_mode_enum.
typedef struct
struct_factoring_machine 
factoring_machine_t
 Equivalent to struct_factoring_machine.

Enumerations

enum  factoring_mode_enum {
  SINGLE_RUN, FIND_SOME_FACTORS, FIND_SOME_COPRIME_FACTORS, FIND_SOME_PRIME_FACTORS,
  FIND_COMPLETE_FACTORIZATION
}

Functions

ecode_t run_machine (factoring_machine_t *machine)
 Attempt to factor an integer.

Variables

static const int mode_to_outcome [5]


Detailed Description

Abstraction of an integer factorization algorithm.

Author:
Jerome Milan
Date:
Fri Jun 10 2011
Version:
2011-06-10
Implements a machine-like abstraction of an integer factorization algorithm.

Definition in file factoring_machine.h.


Define Documentation

#define _TIFA_FACTORING_MACHINE_H_

Standard include guard.

Definition at line 35 of file factoring_machine.h.


Enumeration Type Documentation

An enumeration of the factoring mode available to the implemented factorization algorithm.

Enumerator:
SINGLE_RUN  Perform only a single run of the factorization algorithm.
FIND_SOME_FACTORS  Run the factorization algorithm until either some factors are found or the abort limit (defined on a per-algorithm basis) is reached.
FIND_SOME_COPRIME_FACTORS  Run the factorization algorithm until either some coprime factors are found or the abort limit (defined on a per-algorithm basis) is reached.
FIND_SOME_PRIME_FACTORS  Run the factorization algorithm until either some prime factors are found or the abort limit (defined on a per-algorithm basis) is reached.

Note:
This is probably not useful at all. Why would we discard found factors even if they are not prime? This should better be left to the client application.
FIND_COMPLETE_FACTORIZATION  Run the factorization algorithm until either the complete factorization (as a product of prime numbers) is found or the abort limit (defined on a per-algorithm basis) is reached.

Definition at line 53 of file factoring_machine.h.


Function Documentation

ecode_t run_machine ( factoring_machine_t machine  ) 

Attempt to factor an integer.

Attempt to factor an integer with all parameters given by machine.

Note:
This function is meant to be a starting point for implementations of factorization algorithms and is obviously not intended to be directly used as a factoring function all by itself.
Parameters:
machine A pointer to the factoring_machine_t to use.


Variable Documentation

const int mode_to_outcome[5] [static]

Initial value:

Global constant array mapping factoring modes to their respective best outcome.

Definition at line 96 of file factoring_machine.h.


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