[BACK]Return to generic_complex_numbers.ads CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Numbers

Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Numbers/generic_complex_numbers.ads, Revision 1.1.1.1

1.1       maekawa     1: with Abstract_Ring;
                      2: with Abstract_Ring.Field;
                      3:
                      4: generic
                      5:
                      6:   with package Ring is new Abstract_Ring(<>);
                      7:   with package Field is new Ring.Field(<>);
                      8:
                      9: package Generic_Complex_Numbers is
                     10:
                     11: -- DESCRIPTION :
                     12: --   Offers a Cartesian view on the complex numbers, where the type of the
                     13: --   reals is left for instantiation.
                     14:
                     15:   use Ring; use Field;
                     16:
                     17:   type Complex_Number is private;
                     18:
                     19: -- CREATORS :
                     20:
                     21:   function Create ( i : integer ) return Complex_Number;
                     22:   function Create ( f : number ) return Complex_Number;
                     23:   function Create ( re,im : number ) return Complex_Number;
                     24:   function Conjugate ( c : Complex_Number ) return Complex_Number;
                     25:
                     26: -- SELECTORS :
                     27:
                     28:   function REAL_PART ( x : Complex_Number ) return number;
                     29:   function IMAG_PART ( x : Complex_Number ) return number;
                     30:
                     31:   function AbsVal ( x : Complex_Number ) return number;  -- x=a+bi, |x|=|a|+|b|
                     32:   function AbsVal ( x : Complex_Number ) return Complex_Number;
                     33:
                     34: -- COMPARISON/COPYING :
                     35:
                     36:   function Equal ( x,y : Complex_Number ) return boolean;
                     37:   procedure Copy ( x : in Complex_Number; y : in out Complex_Number );
                     38:
                     39:   function "<" ( x,y : Complex_Number ) return boolean;  -- return |x|<|y|
                     40:   function ">" ( x,y : Complex_Number ) return boolean;  -- return |x|>|y|
                     41:
                     42: -- ARITHMETHIC OPERATIONS AS FUNCTIONS :
                     43:
                     44:   function "+" ( x : Complex_Number; y : number ) return Complex_Number;
                     45:   function "-" ( x : Complex_Number; y : number ) return Complex_Number;
                     46:   function "*" ( x : Complex_Number; y : number ) return Complex_Number;
                     47:   function "/" ( x : Complex_Number; y : number ) return Complex_Number;
                     48:
                     49:   function "+" ( x : number; y : Complex_Number ) return Complex_Number;
                     50:   function "-" ( x : number; y : Complex_Number ) return Complex_Number;
                     51:   function "*" ( x : number; y : Complex_Number ) return Complex_Number;
                     52:   function "/" ( x : number; y : Complex_Number ) return Complex_Number;
                     53:
                     54:   function "+" ( x,y : Complex_Number ) return Complex_Number;
                     55:   function "+" ( x : Complex_Number )   return Complex_Number;  -- copies x
                     56:   function "-" ( x,y : Complex_Number ) return Complex_Number;
                     57:   function "-" ( x : Complex_Number )   return Complex_Number;
                     58:   function "*" ( x,y : Complex_Number ) return Complex_Number;
                     59:   function "/" ( x,y : Complex_Number ) return Complex_Number;
                     60:
                     61:   function "**" ( x : Complex_Number; m : integer ) return Complex_Number;
                     62:
                     63: -- ARITHMETIC OPERATIONS AS PROCEDURES :
                     64:
                     65:   procedure Add ( x : in out Complex_Number; y : in number );
                     66:   procedure Sub ( x : in out Complex_Number; y : in number );
                     67:   procedure Mul ( x : in out Complex_Number; y : in number );
                     68:   procedure Div ( x : in out Complex_Number; y : in number );
                     69:
                     70:   procedure Add ( x : in out Complex_Number; y : in Complex_Number );
                     71:   procedure Sub ( x : in out Complex_Number; y : in Complex_Number );
                     72:   procedure Min ( x : in out Complex_Number );
                     73:   procedure Mul ( x : in out Complex_Number; y : in Complex_Number );
                     74:   procedure Div ( x : in out Complex_Number; y : in Complex_Number );
                     75:
                     76: -- DESTRUCTOR :
                     77:
                     78:   procedure Clear ( x : in out Complex_Number );
                     79:
                     80: private
                     81:
                     82:   type Complex_Number is
                     83:     record
                     84:       RE,IM : number;
                     85:     end record;
                     86:
                     87: end Generic_Complex_Numbers;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>