tOptimalControlMatricesOfOneState ::
  (Vec.Walker varVec, Vec.Storage varVec a,
   Arith.Constant a, Ord node,
   Ord a,
   Show node,
   Vec.Storage varVec (Maybe (Result a)),
   Vec.FromList varVec,
   Arith.Sum a) =>
  Params.System node a ->
  Params.Optimisation node list sweep vec a ->
  Idx.State ->
  Type.OptimalSolutionOfOneState node a ->
  Map (TopoIdx.Position node) (Sig.PSignal2 Vector varVec a)
getOptimalControlMatricesOfOneState sysParams optParams state =
  Map.map (Sig.map ModUt.nothing2Nan)
  . signCorrectedOptimalPowerMatrices sysParams (Params.dofsPos optParams)
  . Map.map (fmap (\(o, e, i, v) -> (o, e, state, i, v)))


getOptimalControlMatricesOfOneState ::
  (Vec.Walker varVec, Vec.Storage varVec a,
   Arith.Constant a, Ord node,
   Ord a,
   Show node,
   Vec.Storage varVec (Maybe (Result a)),
   Vec.FromList varVec,
   Arith.Sum a) =>
  Params.System node a ->
  Params.Optimisation node list sweep vec a ->
  Idx.State ->
  Type.OptimalSolutionOfOneState node a ->
  Map (TopoIdx.Position node) (Sig.PSignal2 Vector varVec a)
getOptimalControlMatricesOfOneState sysParams optParams state =
  Map.map (Sig.map ModUt.nothing2Nan)
  . signCorrectedOptimalPowerMatrices sysParams (Params.dofsPos optParams)
  . Map.map (fmap (\(o, e, i, v) -> (o, e, state, i, v)))
getOptimalControlMatricesOfOneState sysParams optParams state =
  Map.map (Sig.map ModUt.nothing2Nan)
  . signCorrectedOptimalPowerMatrices sysParams (Params.dofsPos optParams)
  . Map.map (fmap (\(o, e, i, v) -> (o, e, state, i, v)))