packages feed

cao-0.1.1: backend_lib/C_generic/CAO_modpol.h

/*  CAO Compiler
    Copyright (C) 2014 Cryptography and Information Security Group, HASLab - INESC TEC and Universidade do Minho

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#ifndef CAO_MODPOL_H
#define CAO_MODPOL_H

#include "CAO_globals.h"

#ifdef __cplusplus

#include "CAO_bool.h"
#include "CAO_int.h"
#include "CAO_ubits.h"
#include "CAO_sbits.h"
#include "CAO_mod.h"
#include "CAO_modpol.h"
#include "CAO_struct.h"
#include "CAO_vector.h"
#include "CAO_matrix.h"
#include "CAO_globalOp.h"
#include "CAO_rint.h"
#include <NTL/ZZ_pE.h>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cstdlib>

NTL_CLIENT

typedef struct CAO_ModPol_s {
	ZZ_pEBak *bakE;
	ZZ_pBak *bak;
	ZZ_pE *val;
} CAO_modpol_s;

extern "C" {
#endif

	//TODO remove when deploy
	//CAO_RES CAO_modpol_decl(CAO_modpol *, CAO_rint, CAO_int, CAO_int *);
	CAO_RES CAO_modpol_decl(CAO_modpol *, CAO_int, CAO_int, CAO_int *);
	CAO_RES _CAO_modpol_decl (CAO_modpol *, CAO_rint, CAO_mod *);

	CAO_RES CAO_modpol_init(CAO_modpol , const char *); 
	CAO_RES CAO_modpol_assign(CAO_modpol , CAO_modpol );
	CAO_RES CAO_modpol_assign_one(CAO_modpol);
	CAO_RES CAO_modpol_assign_zero(CAO_modpol);
	CAO_RES CAO_modpol_clone(CAO_modpol *, CAO_modpol);
	CAO_RES CAO_modpol_equal(CAO_bool r, CAO_modpol , CAO_modpol);
	CAO_RES CAO_modpol_add(CAO_modpol,CAO_modpol,CAO_modpol);
	CAO_RES CAO_modpol_addTo(CAO_modpol,CAO_modpol);
	CAO_RES CAO_modpol_subTo(CAO_modpol,CAO_modpol);
	CAO_RES CAO_modpol_sub(CAO_modpol,CAO_modpol,CAO_modpol);
	CAO_RES CAO_modpol_mul(CAO_modpol,CAO_modpol,CAO_modpol);
	CAO_RES CAO_modpol_div(CAO_modpol,CAO_modpol,CAO_modpol);
	CAO_RES CAO_modpol_pow(CAO_modpol,CAO_modpol,CAO_int);
	CAO_RES CAO_modpol_sym(CAO_modpol,CAO_modpol);
	#define CAO_modpol_equal(a,b,c) a = _CAO_modpol_equal(b,c)
	CAO_bool _CAO_modpol_equal(CAO_modpol, CAO_modpol);
	#define CAO_modpol_nequal(a,b,c) a = _CAO_modpol_nequal(b,c)
	CAO_bool _CAO_modpol_nequal(CAO_modpol, CAO_modpol);
	CAO_RES CAO_modpol_dump(CAO_modpol);
	CAO_RES CAO_modpol_dispose(CAO_modpol);
	CAO_RES CAO_mod_cast_modpol(CAO_modpol, CAO_mod);
	CAO_RES CAO_matrix_cast_modpol(CAO_modpol, CAO_matrix);
	CAO_RES CAO_modpol_cast_matrix(CAO_matrix, CAO_modpol);
	CAO_RES CAO_vector_cast_modpol(CAO_modpol, CAO_vector);
	CAO_RES CAO_modpol_cast_vector(CAO_vector, CAO_modpol);

#ifdef __cplusplus
}
#endif

#endif