HansenUtilities.java

  1. /* Copyright 2002-2018 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (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. import org.hipparchus.analysis.polynomials.PolynomialFunction;

  19. /**
  20.  * Utilities class.
  21.  *
  22.  * @author Lucian Barbulescu
  23.  */
  24. public class HansenUtilities {

  25.     /** 1 represented as a polynomial. */
  26.     public static final PolynomialFunction ONE = new PolynomialFunction(new double[] {
  27.         1
  28.     });

  29.     /** 0 represented as a polynomial. */
  30.     public static final PolynomialFunction ZERO = new PolynomialFunction(new double[] {
  31.         0
  32.     });

  33.     /** Private constructor as class is a utility.
  34.      */
  35.     private HansenUtilities() {
  36.     }

  37.     /**
  38.      * Build the identity matrix of order 2.
  39.      *
  40.      * <pre>
  41.      *       / 1   0 \
  42.      *  I₂ = |       |
  43.      *       \ 0   1 /
  44.      * </pre>
  45.      *
  46.      * @return the identity matrix of order 2
  47.      */
  48.     public static final PolynomialFunctionMatrix buildIdentityMatrix2() {
  49.         final PolynomialFunctionMatrix matrix = new PolynomialFunctionMatrix(2);
  50.         matrix.setMatrix(new PolynomialFunction[][] {
  51.             {
  52.                 ONE,  ZERO
  53.             },
  54.             {
  55.                 ZERO, ONE
  56.             }
  57.         });
  58.         return matrix;
  59.     }

  60.     /**
  61.      * Build the empty matrix of order 2.
  62.      *
  63.      * <pre>
  64.      *       / 0   0 \
  65.      *  E₂ = |       |
  66.      *       \ 0   0 /
  67.      * </pre>
  68.      *
  69.      * @return the identity matrix of order 2
  70.      */
  71.     public static final PolynomialFunctionMatrix buildZeroMatrix2() {
  72.         final PolynomialFunctionMatrix matrix = new PolynomialFunctionMatrix(2);
  73.         matrix.setMatrix(new PolynomialFunction[][] {
  74.             {
  75.                 ZERO, ZERO
  76.             },
  77.             {
  78.                 ZERO, ZERO
  79.             }
  80.         });
  81.         return matrix;
  82.     }


  83.     /**
  84.      * Build the identity matrix of order 4.
  85.      *
  86.      * <pre>
  87.      *       / 1  0  0  0 \
  88.      *       |            |
  89.      *       | 0  1  0  0 |
  90.      *  I₄ = |            |
  91.      *       | 0  0  1  0 |
  92.      *       |            |
  93.      *       \ 0  0  0  1 /
  94.      * </pre>
  95.      *
  96.      * @return the identity matrix of order 4
  97.      */
  98.     public static final PolynomialFunctionMatrix buildIdentityMatrix4() {
  99.         final PolynomialFunctionMatrix matrix = new PolynomialFunctionMatrix(4);
  100.         matrix.setMatrix(new PolynomialFunction[][] {
  101.             {
  102.                 ONE,  ZERO, ZERO, ZERO
  103.             },
  104.             {
  105.                 ZERO, ONE,  ZERO, ZERO
  106.             },
  107.             {
  108.                 ZERO, ZERO, ONE,  ZERO
  109.             },
  110.             {
  111.                 ZERO, ZERO, ZERO, ONE
  112.             }
  113.         });
  114.         return matrix;
  115.     }

  116.     /**
  117.      * Build the empty matrix of order 4.
  118.      *
  119.      * <pre>
  120.      *       / 0  0  0  0 \
  121.      *       |            |
  122.      *       | 0  0  0  0 |
  123.      *  E₄ = |            |
  124.      *       | 0  0  0  0 |
  125.      *       |            |
  126.      *       \ 0  0  0  0 /
  127.      * </pre>
  128.      *
  129.      * @return the identity matrix of order 4
  130.      */
  131.     public static final PolynomialFunctionMatrix buildZeroMatrix4() {
  132.         final PolynomialFunctionMatrix matrix = new PolynomialFunctionMatrix(4);
  133.         matrix.setMatrix(new PolynomialFunction[][] {
  134.             {
  135.                 ZERO, ZERO, ZERO, ZERO
  136.             },
  137.             {
  138.                 ZERO, ZERO, ZERO, ZERO
  139.             },
  140.             {
  141.                 ZERO, ZERO, ZERO, ZERO
  142.             },
  143.             {
  144.                 ZERO, ZERO, ZERO, ZERO
  145.             }
  146.         } );
  147.         return matrix;
  148.     }

  149. }