1 /* Copyright 2002-2021 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.propagation.semianalytical.dsst.utilities.hansen;
18
19 import org.hipparchus.analysis.polynomials.PolynomialFunction;
20
21 /**
22 * Utilities class.
23 *
24 * @author Lucian Barbulescu
25 */
26 public class HansenUtilities {
27
28 /** 1 represented as a polynomial. */
29 public static final PolynomialFunction ONE = new PolynomialFunction(new double[] {
30 1
31 });
32
33 /** 0 represented as a polynomial. */
34 public static final PolynomialFunction ZERO = new PolynomialFunction(new double[] {
35 0
36 });
37
38 /** Private constructor as class is a utility.
39 */
40 private HansenUtilities() {
41 }
42
43 /**
44 * Build the identity matrix of order 2.
45 *
46 * <pre>
47 * / 1 0 \
48 * I₂ = | |
49 * \ 0 1 /
50 * </pre>
51 *
52 * @return the identity matrix of order 2
53 */
54 public static final PolynomialFunctionMatrix buildIdentityMatrix2() {
55 final PolynomialFunctionMatrix matrix = new PolynomialFunctionMatrix(2);
56 matrix.setMatrix(new PolynomialFunction[][] {
57 {
58 ONE, ZERO
59 },
60 {
61 ZERO, ONE
62 }
63 });
64 return matrix;
65 }
66
67 /**
68 * Build the empty matrix of order 2.
69 *
70 * <pre>
71 * / 0 0 \
72 * E₂ = | |
73 * \ 0 0 /
74 * </pre>
75 *
76 * @return the identity matrix of order 2
77 */
78 public static final PolynomialFunctionMatrix buildZeroMatrix2() {
79 final PolynomialFunctionMatrix matrix = new PolynomialFunctionMatrix(2);
80 matrix.setMatrix(new PolynomialFunction[][] {
81 {
82 ZERO, ZERO
83 },
84 {
85 ZERO, ZERO
86 }
87 });
88 return matrix;
89 }
90
91
92 /**
93 * Build the identity matrix of order 4.
94 *
95 * <pre>
96 * / 1 0 0 0 \
97 * | |
98 * | 0 1 0 0 |
99 * I₄ = | |
100 * | 0 0 1 0 |
101 * | |
102 * \ 0 0 0 1 /
103 * </pre>
104 *
105 * @return the identity matrix of order 4
106 */
107 public static final PolynomialFunctionMatrix buildIdentityMatrix4() {
108 final PolynomialFunctionMatrix matrix = new PolynomialFunctionMatrix(4);
109 matrix.setMatrix(new PolynomialFunction[][] {
110 {
111 ONE, ZERO, ZERO, ZERO
112 },
113 {
114 ZERO, ONE, ZERO, ZERO
115 },
116 {
117 ZERO, ZERO, ONE, ZERO
118 },
119 {
120 ZERO, ZERO, ZERO, ONE
121 }
122 });
123 return matrix;
124 }
125
126 /**
127 * Build the empty matrix of order 4.
128 *
129 * <pre>
130 * / 0 0 0 0 \
131 * | |
132 * | 0 0 0 0 |
133 * E₄ = | |
134 * | 0 0 0 0 |
135 * | |
136 * \ 0 0 0 0 /
137 * </pre>
138 *
139 * @return the identity matrix of order 4
140 */
141 public static final PolynomialFunctionMatrix buildZeroMatrix4() {
142 final PolynomialFunctionMatrix matrix = new PolynomialFunctionMatrix(4);
143 matrix.setMatrix(new PolynomialFunction[][] {
144 {
145 ZERO, ZERO, ZERO, ZERO
146 },
147 {
148 ZERO, ZERO, ZERO, ZERO
149 },
150 {
151 ZERO, ZERO, ZERO, ZERO
152 },
153 {
154 ZERO, ZERO, ZERO, ZERO
155 }
156 } );
157 return matrix;
158 }
159
160 }