arithmetic/src/linearalgebra/vector/vector.tmpl


%
%  Quake functions to instantiate operations on generic vectors.
%

readonly proc Vector (nm, impl, rfield) is
  local base     = nm & "Vector"
  local rep      = base & "Rep"
  local sup      = base & "Support"
  local instimpl = base & impl
  build_generic_intf (base,     "Vector",        [rfield], VISIBLE)
  build_generic_impl (base,     "Vector",        [rfield, rep])
  build_generic_intf (rep,      "VectorRep",     [rfield, base, instimpl], VISIBLE)
  build_generic_impl (rep,      "VectorRep",     [rfield, base])
  build_generic_intf (sup,      "VectorSupport", [rfield], VISIBLE)
  build_generic_impl (sup,      "VectorSupport", [rfield])
  build_generic_intf (instimpl, "Vector" & impl, [rfield, base], VISIBLE)
  build_generic_impl (instimpl, "Vector" & impl, [rfield, base])
end

readonly proc VectorTrans (nm, field) is
  local rfield = field & "Basic"
  local rtrans = field & "Trans"
  local cfield = nm
  local ctrans = nm & "Trans"
  local vfield = nm & "Vector"
  local vtrans = nm & "VectorTrans"
  local vrep   = nm & "VectorRep"
  build_generic_intf (vtrans, "VectorTrans", [rfield, vfield], VISIBLE)
  build_generic_impl (vtrans, "VectorTrans", [rfield, rtrans, ctrans])
end

readonly proc VectorComplex (nm, field) is
  local rfield  = field & "Basic"
  local vfield  = nm & "Vector"
  local cvfield = nm & "ComplexVector"
  local vcmplx  = nm & "VectorComplex"
  build_generic_intf (vcmplx, "VectorComplex", [vfield, cvfield], VISIBLE)
  build_generic_impl (vcmplx, "VectorComplex", [vfield, cvfield])
end

readonly proc VectorFmtLex (nm, rfield) is
  local rfmt   = nm & "FmtLex"
  local rseq   = nm & "Seq"
  local vfield = nm & "Vector"
  local vfmt   = nm & "VectorFmtLex"
  local vrep   = nm & "VectorRep"
  build_generic_intf (vfmt, "VectorFmtLex", [rfmt, vfield], VISIBLE)
  build_generic_impl (vfmt, "VectorFmtLex", [rfmt, rseq])
end