1   /* Copyright 2002-2024 CS GROUP
2    * Licensed to CS GROUP (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.orekit.estimation.sequential;
18  
19  import org.hipparchus.linear.RealMatrix;
20  import org.hipparchus.linear.RealVector;
21  import org.orekit.errors.OrekitIllegalArgumentException;
22  import org.orekit.errors.OrekitMessages;
23  import org.orekit.time.AbsoluteDate;
24  import org.orekit.time.TimeStamped;
25  
26  /** Container for smoothed states (time, mean and covariance) generated by an {@link RtsSmoother}.
27   *
28   * <p>The order of the parameters in the state and covariance are the same as produced by the underlying sequential
29   * (Kalman or unscented) estimator.</p>
30   * @see RtsSmoother
31   * @author Mark Rutten
32   * @since 13.0
33   */
34  public class PhysicalEstimatedState implements TimeStamped {
35  
36      /** Date. */
37      private final AbsoluteDate date;
38  
39      /** State mean. */
40      private final RealVector state;
41  
42      /** State covariance. */
43      private final RealMatrix covarianceMatrix;
44  
45      /**
46       * Constructor.
47       * @param date date
48       * @param state mean state
49       * @param covarianceMatrix covariance matrix
50       */
51      public PhysicalEstimatedState(final AbsoluteDate date,
52                                    final RealVector state,
53                                    final RealMatrix covarianceMatrix) {
54          this.date = date;
55          this.state = state;
56          this.covarianceMatrix = covarianceMatrix;
57  
58          final int dim = state.getDimension();
59          if (!covarianceMatrix.isSquare()) {
60              throw new OrekitIllegalArgumentException(OrekitMessages.COVARIANCE_MUST_BE_SQUARE);
61          }
62          if (covarianceMatrix.getRowDimension() != dim) {
63              throw new OrekitIllegalArgumentException(OrekitMessages.INCONSISTENT_STATE_DIMENSIONS,
64                      dim, covarianceMatrix.getRowDimension());
65          }
66      }
67  
68      /** {@inheritDoc} */
69      @Override
70      public AbsoluteDate getDate() {
71          return date;
72      }
73  
74      /** Get the state in "physical" (not normalised) units.
75       * @return the state mean
76       */
77      public RealVector getState() {
78          return state;
79      }
80  
81      /** Get the covariance matrix in "physical" (not normalised) units.
82       * @return the state covariance matrix
83       */
84      public RealMatrix getCovarianceMatrix() {
85          return covarianceMatrix;
86      }
87  }