1. with Ada.Numerics.Generic_Real_Arrays; 
  2. with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; 
  3. with HTML;                  use HTML; 
  4. generic 
  5.    Dimension : Natural := 3; 
  6. package Geometric_Algebra_Generic is 
  7.  
  8.    function Get_Dimension return Natural; 
  9.    type Signature_Type is array (1 .. Dimension) of Integer with 
  10.         Default_Component_Value => 1; 
  11.  
  12.       -- Number of base vectors for the construction of a multivector 
  13.    Base_Dimension : constant Natural := 2**Dimension; 
  14.  
  15.    package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays (Float); 
  16.  
  17.    subtype Vector_Type is Real_Arrays.Real_Vector (1 .. Get_Dimension); 
  18.    function Scalar_Product (Left, Right : Vector_Type) return Float; 
  19.  
  20.    type Canonic_Base_Element_Type is private; 
  21.    function "*" (Left : Canonic_Base_Element_Type; Right : Canonic_Base_Element_Type) return Canonic_Base_Element_Type; 
  22.  
  23.    type Multi_Vector_Type is private; 
  24.  
  25.    Canonic_Base : constant Multi_Vector_Type; 
  26.    Zero_Multivector : constant Multi_Vector_Type; 
  27.    One : constant Multi_Vector_Type; 
  28.  
  29.    Multi_Vector_not_Inizialised : exception; 
  30.  
  31.    procedure Put_Line (Value : Multi_Vector_Type); 
  32.    procedure Put_Multi_Vector (Value : Multi_Vector_Type); 
  33.  
  34.    function "+" (Left : Multi_Vector_Type; Right : Multi_Vector_Type) return Multi_Vector_Type; 
  35.    function "-" (Left : Multi_Vector_Type; Right : Multi_Vector_Type) return Multi_Vector_Type; 
  36.  
  37.    function "*" (Left : Float; Right : Multi_Vector_Type) return Multi_Vector_Type; 
  38.    function "*" (Left : Multi_Vector_Type; Right : Float) return Multi_Vector_Type; 
  39.    -- 
  40.    function "*" (Left : Multi_Vector_Type; Right : Multi_Vector_Type) return Multi_Vector_Type; 
  41.    function "/" (Left : Multi_Vector_Type; Right : Multi_Vector_Type) return Multi_Vector_Type; 
  42.  
  43.    procedure Set_Element (Multi_Vector : in out Multi_Vector_Type; Element : Natural; Value : Float); 
  44.  
  45.    -- This function creates an Unbounded_String containing the names of the base vectors which have the same grade 
  46.    function Get_Base_of_Same_Grad (Grade : Natural) return Unbounded_String; 
  47.  
  48.    subtype String_Matrix_Type is HTML.String_Matrix_Type; 
  49.  
  50.    -- These function creates a matrix that contains the names of the base vectors of a multivector in different format. 
  51.    function Prepare_Base_Name_Table_ASCII return String_Matrix_Type; 
  52.    function Prepare_Base_Name_Table_HTML return String_Matrix_Type; 
  53.    function Prepare_Base_Name_Table_LaTex return String_Matrix_Type; 
  54.  
  55.    -- This procedure creates a base vector table as HTML-table and writes this table in an external HTML-file. 
  56.    procedure Create_Base_Vector_Table_HTML (File_Name : String := "base_vectors_table.html"); 
  57.    procedure Create_Multipikation_Table_HTML (File_Name : String := "multiplication_table.html"); 
  58.    procedure Create_Multipikation_Table_HTML_Short_Form (File_Name : String := "multiplication_table_short.html"); 
  59.  
  60.    procedure Create_Base_Vector_Table_LaTex (File_Name : String := "base_vectors_table.lat"; Formular_Elements : Boolean := true); 
  61.    procedure Create_Multiplication_Table_Latex (File_Name : String := "multiplication_table.lat"); 
  62.    procedure Create_Multiplication_Table_Latex_Short_Form (File_Name : String := "multiplication_table.lat"); 
  63.  
  64.    type Bit_Type is range 0 .. 1 with 
  65.         Default_Value => 0; 
  66.  
  67.    type Bit_Array_Type is array (1 .. Dimension) of Bit_Type with 
  68.         Default_Component_Value => 0; 
  69.  
  70.    function Signum (Left : Bit_Array_Type; Right : Bit_Array_Type) return Integer; 
  71.  
  72. -------------------------------------------------------------------------------- 
  73. private ------------------------------------------------------------------------ 
  74. -------------------------------------------------------------------------------- 
  75.  
  76.    function Create_Canonic_Base return Multi_Vector_Type; 
  77.    function Create_Zero_Multivector return Multi_Vector_Type; 
  78.    function Get_Max_Blade_Length return Natural; 
  79.  
  80.    type Canonic_Base_Element_Type is record 
  81.       Value      : Float            := 0.0; 
  82.       Base       : Bit_Array_Type; 
  83.       Name       : Unbounded_String := Null_Unbounded_String; 
  84.       HTML_Name  : Unbounded_String := Null_Unbounded_String; 
  85.       Short_Name : Unbounded_String := Null_Unbounded_String; 
  86.       Latex_Name : Unbounded_String := Null_Unbounded_String; 
  87.       Grade      : Natural          := 0; 
  88.    end record; 
  89.  
  90.    type Multi_Vector_Type is array (0 .. Base_Dimension - 1) of Canonic_Base_Element_Type; 
  91.  
  92.    Canonic_Base     : constant Multi_Vector_Type := Create_Canonic_Base; 
  93.    One              : constant Multi_Vector_Type := Create_Canonic_Base; 
  94.    Zero_Multivector : constant Multi_Vector_Type := Create_Zero_Multivector; 
  95.    Max_Blade_Length : constant Natural           := Get_Max_Blade_Length; 
  96.  
  97. -------------------------------------------------------------------------------- 
  98. end Geometric_Algebra_Generic; ------------------------------------------------- 
  99. --------------------------------------------------------------------------------