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      public PhysicalEstimatedState(final AbsoluteDate date,
46                                    final RealVector state,
47                                    final RealMatrix covarianceMatrix) {
48          this.date = date;
49          this.state = state;
50          this.covarianceMatrix = covarianceMatrix;
51  
52          final int dim = state.getDimension();
53          if (!covarianceMatrix.isSquare()) {
54              throw new OrekitIllegalArgumentException(OrekitMessages.COVARIANCE_MUST_BE_SQUARE);
55          }
56          if (covarianceMatrix.getRowDimension() != dim) {
57              throw new OrekitIllegalArgumentException(OrekitMessages.INCONSISTENT_STATE_DIMENSIONS,
58                      dim, covarianceMatrix.getRowDimension());
59          }
60      }
61  
62      /** {@inheritDoc} */
63      @Override
64      public AbsoluteDate getDate() {
65          return date;
66      }
67  
68      /** Get the state in "physical" (not normalised) units.
69       * @return the state mean
70       */
71      public RealVector getState() {
72          return state;
73      }
74  
75      /** Get the covariance matrix in "physical" (not normalised) units.
76       * @return the state covariance matrix
77       */
78      public RealMatrix getCovarianceMatrix() {
79          return covarianceMatrix;
80      }
81  }