Parameters: draft the cases of a generic feed-join
In the general case, a base value and a feed can also be combined when the metric of both arguments differs; notably a linear multiplier can be applied to an logarithmic base value by adding its logarithm, and a logarithmic feed can be multiplied to a linear base value by taking the exponential function. Furthermore there are some cases involving nominal scales, which we can mark only, but leave unimplemented
This commit is contained in:
parent
a1b80c22df
commit
684bb2ca50
2 changed files with 107 additions and 8 deletions
|
|
@ -87,6 +87,16 @@ namespace par {
|
|||
template<typename SRC>
|
||||
VAL join (VAL const&, SRC const&, Scale<SRC> const&) const;
|
||||
VAL join (VAL const&, VAL const&) const;
|
||||
|
||||
private:
|
||||
template<typename TAR>
|
||||
VAL asFactor (VAL const&) const;
|
||||
|
||||
template<typename TAR>
|
||||
VAL baseScale (Metric targetMetric) const;
|
||||
|
||||
template<typename TAR>
|
||||
VAL asLogarithm (Metric targetMetric, VAL const&) const;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -195,8 +205,34 @@ namespace par {
|
|||
inline VAL
|
||||
Scale<VAL>::join (VAL const& value, SRC const& srcFeed, Scale<SRC> const& feedScale) const
|
||||
{
|
||||
VAL feed(preClamp<VAL> (srcFeed));
|
||||
return join (value, feed);
|
||||
VAL res{};
|
||||
if (NOM == metric)
|
||||
UNIMPLEMENTED ("nominal and ordinal scales");
|
||||
if (LIN == metric)
|
||||
{
|
||||
if (feedScale.isLogarithmic())
|
||||
assignConverted (res, value * feedScale.template asFactor<VAL> (srcFeed));
|
||||
else
|
||||
if (this->isFactor())
|
||||
assignConverted (res, value * srcFeed);
|
||||
else
|
||||
assignConverted (res, value + srcFeed);
|
||||
}
|
||||
else
|
||||
if (this->isLogarithmic())
|
||||
{
|
||||
if (feedScale.isLogarithmic())
|
||||
assignConverted (res, value + feedScale.template baseScale<VAL>(metric) * srcFeed);
|
||||
else
|
||||
if (feedScale.isFactor())
|
||||
assignConverted (res, value + feedScale.template asLogarithm<VAL> (metric, srcFeed));
|
||||
else
|
||||
throw err::Invalid {"adding a non-logarithmic data feed on top of a logarithmic base value is pointless."};
|
||||
}
|
||||
else
|
||||
NOTREACHED ("Unexpected metric conversion case");
|
||||
|
||||
return conform (res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -211,6 +247,30 @@ namespace par {
|
|||
);
|
||||
}
|
||||
|
||||
template<typename VAL>
|
||||
template<typename TAR>
|
||||
inline VAL
|
||||
Scale<VAL>::asFactor (VAL const& value) const
|
||||
{
|
||||
UNIMPLEMENTED ("transform a logarithmic value into an exponential factor");
|
||||
}
|
||||
|
||||
template<typename VAL>
|
||||
template<typename TAR>
|
||||
inline VAL
|
||||
Scale<VAL>::baseScale (Metric targetMetric) const
|
||||
{
|
||||
UNIMPLEMENTED ("provide the adaptation factor from this logarithmic scale to the given other logarithmic scale");
|
||||
}
|
||||
|
||||
template<typename VAL>
|
||||
template<typename TAR>
|
||||
inline VAL
|
||||
Scale<VAL>::asLogarithm (Metric targetMetric, VAL const& value) const
|
||||
{
|
||||
UNIMPLEMENTED ("transform this value into a suitable logarithm for the target scale");
|
||||
}
|
||||
|
||||
|
||||
}} // namespace lib::par
|
||||
#endif /*LIB_PAR_SCALE_H*/
|
||||
|
|
|
|||
|
|
@ -85612,10 +85612,9 @@
|
|||
</node>
|
||||
<node CREATED="1789679178010" ID="ID_641923682" MODIFIED="1789679196411" TEXT="dazu genügt die preClamp-Funktion (generisch, mit Varianten)"/>
|
||||
<node CREATED="1789679234347" ID="ID_562560611" MODIFIED="1789679253968" TEXT="diese hängt aber (mit diversen weiteren Funktionen) in param-type.hpp"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1789679364793" ID="ID_1241002579" MODIFIED="1789681307994" TEXT="extrahieren in type-handler.hpp">
|
||||
<arrowlink COLOR="#723f52" DESTINATION="ID_517472625" ENDARROW="Default" ENDINCLINATION="368;-30;" ID="Arrow_ID_914959509" STARTARROW="None" STARTINCLINATION="-203;15;"/>
|
||||
<node COLOR="#435e98" CREATED="1789679364793" ID="ID_1241002579" MODIFIED="1789690095158" STYLE="fork" TEXT="extrahieren in type-handler.hpp">
|
||||
<arrowlink COLOR="#3f4b72" DESTINATION="ID_517472625" ENDARROW="Default" ENDINCLINATION="368;-30;" ID="Arrow_ID_914959509" STARTARROW="None" STARTINCLINATION="-199;17;"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1789165444623" ID="ID_1649021234" MODIFIED="1789165459491" TEXT="vereinfachte Variante für identische Scale"/>
|
||||
|
|
@ -85641,9 +85640,49 @@
|
|||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node CREATED="1789681257536" ID="ID_1700836715" MODIFIED="1789681261057" TEXT="Implementierung">
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1789681263702" ID="ID_517472625" MODIFIED="1789681294765" TEXT="type-handler.hpp verwenden">
|
||||
<linktarget COLOR="#723f52" DESTINATION="ID_517472625" ENDARROW="Default" ENDINCLINATION="368;-30;" ID="Arrow_ID_914959509" SOURCE="ID_1241002579" STARTARROW="None" STARTINCLINATION="-203;15;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1789681263702" ID="ID_517472625" MODIFIED="1789690087703" TEXT="type-handler.hpp verwenden">
|
||||
<linktarget COLOR="#3f4b72" DESTINATION="ID_517472625" ENDARROW="Default" ENDINCLINATION="368;-30;" ID="Arrow_ID_914959509" SOURCE="ID_1241002579" STARTARROW="None" STARTINCLINATION="-199;17;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1789690189866" ID="ID_1376240578" MODIFIED="1789690197006" TEXT="Einzelfälle...">
|
||||
<node CREATED="1789690461895" ID="ID_1698758358" MODIFIED="1789690470825" TEXT="Ziel linear">
|
||||
<node CREATED="1789690555041" ID="ID_1115887554" MODIFIED="1789690584237" TEXT="Quelle logarithmisch ⟹ in Faktor verwandeln"/>
|
||||
<node CREATED="1789690484811" ID="ID_1985479365" MODIFIED="1789690540680" TEXT="Quelle multiplikativ ⟹ Feed multiplizieren"/>
|
||||
<node CREATED="1789690518951" ID="ID_369458503" MODIFIED="1789690532408" TEXT="sonst: ⟹ Feed addieren"/>
|
||||
</node>
|
||||
<node CREATED="1789690604246" ID="ID_1698111641" MODIFIED="1789690609463" TEXT="Ziel logarithmisch">
|
||||
<node CREATED="1789690612021" ID="ID_699494084" MODIFIED="1789690620205" TEXT="Quelle logarithmisch">
|
||||
<node CREATED="1789690621353" ID="ID_369958191" MODIFIED="1789690631911" TEXT="ggfs Basis-Anpassungsfaktor"/>
|
||||
<node CREATED="1789690632759" ID="ID_169878566" MODIFIED="1789690643602" TEXT="sonst ⟹ Feed addieren"/>
|
||||
</node>
|
||||
<node CREATED="1789690650447" ID="ID_763848405" MODIFIED="1789690934324" TEXT="Quelle multiplikativ ⟹ logarithmieren und addieren"/>
|
||||
<node CREATED="1789690952586" ID="ID_806764948" MODIFIED="1789690977990" TEXT="sonst delogarithmieren, Feed addieren, re-logarithmieren"/>
|
||||
</node>
|
||||
<node CREATED="1789691026066" ID="ID_1521422421" MODIFIED="1789691072009" TEXT="Ziel ordinal und Quelle additiv(linear) ⟹ Ordinal-Step"/>
|
||||
<node CREATED="1789691081395" ID="ID_1029470467" MODIFIED="1789691128539" TEXT="Ziel nominal und Quelle nominal oder linear ⟹ Feed(codiert) ersetzt Quelle"/>
|
||||
</node>
|
||||
<node CREATED="1789691154922" ID="ID_1884775055" MODIFIED="1789691157587" TEXT="Berechnung">
|
||||
<node CREATED="1789691206195" ID="ID_521077468" MODIFIED="1789691213662" TEXT="Genauigkeit steigern">
|
||||
<node CREATED="1789691368028" ID="ID_1992504549" MODIFIED="1789691686368" TEXT="de/Logarithmieren : stets bestmöglichen Floating-Point">
|
||||
<node CREATED="1789691697643" ID="ID_1724775924" MODIFIED="1789691708345" TEXT="von Integraltypen ⟹ stets double"/>
|
||||
<node CREATED="1789691709035" ID="ID_28970072" MODIFIED="1789691791715" TEXT="ansonsten maximalen floating-point-Typ">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
d.h. wenn beide Seiten float sind, dann ist das wohl auch so beabsichtigt, und wir bleiben in der float-Domäne. Ebenso wenn eine Seite long-double ist, dann alles dort. Sonst double verwenden
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1789691232896" ID="ID_575039816" MODIFIED="1789691803456" TEXT="Konvertierung in den Ziel-Typ stets zuletzt (vor Conform)"/>
|
||||
</node>
|
||||
<node CREATED="1789691159130" ID="ID_1328281700" MODIFIED="1789691168924" TEXT="zuletzt Conform() anwenden"/>
|
||||
<node CREATED="1789691889609" ID="ID_569629897" MODIFIED="1789691899860" TEXT="Formulierung: muß Funktions-Kette bilden"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue