1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.propagation.semianalytical.dsst.utilities.hansen;
18
19 import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
20
21
22
23
24
25
26
27
28 public class PolynomialFunctionMatrix {
29
30
31 private int order;
32
33 private PolynomialFunction elements[][];
34
35
36
37
38
39
40
41
42
43
44 PolynomialFunctionMatrix(final int order) {
45 this.order = order;
46 this.elements = new PolynomialFunction[order][order];
47 }
48
49
50
51
52
53
54
55
56
57
58
59 public void setElem(final int line, final int column, final PolynomialFunction value) {
60 elements[line][column] = value;
61 }
62
63
64
65
66
67
68
69
70
71
72 public PolynomialFunction getElem(final int line, final int column) {
73 return elements[line][column];
74 }
75
76
77
78
79
80
81
82
83 public PolynomialFunctionMatrix multiply(final PolynomialFunctionMatrix matrix) {
84 final PolynomialFunctionMatrix result = new PolynomialFunctionMatrix(order);
85 for (int i = 0; i < order; i++) {
86 for (int j = 0; j < order; j++) {
87 PolynomialFunction cc = HansenUtilities.ZERO;
88 for (int k = 0; k < order; k++) {
89 cc = cc.add(matrix.getElem(i, k).multiply(elements[k][j]));
90 }
91 result.setElem(i, j, cc);
92 }
93 }
94 return result;
95 }
96
97
98
99
100
101
102
103 public void setMatrix(final PolynomialFunction[][] polynomials) {
104 elements = polynomials.clone();
105 }
106
107
108
109
110
111
112
113
114
115 public void setMatrixLine(final int line, final PolynomialFunction[] polynomials) {
116 elements[line] = polynomials;
117 }
118
119
120
121
122
123
124
125
126 public PolynomialFunction[] getMatrixLine(final int line) {
127 return elements[line].clone();
128 }
129
130
131
132
133
134
135
136
137 public PolynomialFunctionMatrix add(final PolynomialFunctionMatrix matrix) {
138 final PolynomialFunctionMatrix c = new PolynomialFunctionMatrix(order);
139 for (int i = 0; i < order; i++) {
140 for (int j = 0; j < order; j++) {
141 c.setElem(i, j, elements[i][j].add(matrix.getElem(i, j)));
142 }
143 }
144 return c;
145 }
146 }