File : scalvectors.ads
with Ada.Text_IO, Reps, Vectors;
use Ada.Text_IO, Reps;
pragma Elaborate (Reps);
generic
-------------------- begin_include scalars Scalar
type Scalar is private;
--- addition and multiplication
with function IsZero(S: Scalar) return Boolean is <>;
with procedure SetZero(S: out Scalar) is <>;
with procedure Neg(S: in out Scalar) is <>;
with procedure Neg(S1: in Scalar; S2: out Scalar) is <>;
with function "-"(S: Scalar) return Scalar is <>;
with procedure Add(S1: in Scalar; S2: in out Scalar) is <>;
with procedure Sum(S1,S2: in Scalar; S3: out Scalar) is <>;
with function "+"(S1,S2: Scalar) return Scalar is <>;
with procedure Sub(S1: in Scalar; S2: in out Scalar) is <>;
with procedure Diff(S1,S2: in Scalar; S3: out Scalar) is <>;
with function "-"(S1,S2: Scalar) return Scalar is <>;
with procedure Mult(I: in Integer; S: in out Scalar) is <>;
with procedure Prod(I: in Integer; S1: in Scalar; S2: out Scalar) is <>;
with function "*"(I: Integer; S: Scalar) return Scalar is <>;
with procedure MultAdd(I: Integer; S1: in Scalar; S2: in out Scalar) is <>;
with procedure Mult(S1: in Scalar; S2: in out Scalar) is <>;
with procedure Prod(S1,S2: in Scalar; S3: out Scalar) is <>;
with function "*"(S1,S2: Scalar) return Scalar is <>;
with procedure MultAdd(S1,S2: in Scalar; S3: in out Scalar) is <>;
with function "**"(S: Scalar; I: Integer) return Scalar is <>;
--- conversion and i/o
with function Scal(K: Integer) return Scalar is <>;
with function Scal(R: Rep) return Scalar is <>;
with procedure ShowType(S: in Scalar) is <>;
with procedure Show1(N: in String; S: in Scalar) is <>;
with procedure Show2(N: in String; S,S2: in Scalar) is <>;
with procedure Get(F: in File_Type; S: out Scalar; Decimal: in Boolean := False) is <>;
with procedure Put(F: in File_Type; S: in Scalar; Decimal: in Boolean := False) is <>;
-------------------- end_include scalars
with function "/"(S1,S2: Scalar) return Scalar is <>;
package ScalVectors is -- vectors with scalar components
pragma Elaborate_Body;
package ScalVecs is new Vectors (Scalar => Scalar, Component => Scalar);
use ScalVecs;
subtype ScalVec is ScalVecs.Vector;
subtype ScalMat is ScalVecs.Matrix;
function Diag(V: ScalVec) return ScalMat;
procedure SetRow(I: in Integer; V: in ScalVec; A: in out ScalMat);
function GetRow(I: Integer; A: ScalMat) return ScalVec;
procedure SetColumn(J: in Integer; V: in ScalVec; A: in out ScalMat);
function GetColumn(J: Integer; A: ScalMat) return ScalVec;
--- simplest cases
subtype ScalVec2 is ScalVec(1..2);
subtype ScalMat2 is ScalMat(1..2,1..2);
subtype ScalVec3 is ScalVec(1..3);
subtype ScalMat3 is ScalMat(1..3,1..3);
procedure Inv2(A: in ScalMat2; Ai: out ScalMat2; Det: out Scalar);
function Inv2(A: ScalMat2) return ScalMat2;
procedure Inv3(A: in ScalMat3; Ai: out ScalMat3; Det: out Scalar);
function Inv3(A: ScalMat3) return ScalMat3;
end ScalVectors;