Revisão | bf974ddcd7567cb9e924fd7256034a2e23969f70 (tree) |
---|---|
Hora | 2015-10-21 12:09:35 |
Autor | MirrgieRiana |
Commiter | MirrgieRiana |
add: mirrg.complex.hydrogen
@@ -0,0 +1,18 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<projectDescription> | |
3 | + <name>mirrg.complex.hydrogen</name> | |
4 | + <comment></comment> | |
5 | + <projects> | |
6 | + </projects> | |
7 | + <buildSpec> | |
8 | + <buildCommand> | |
9 | + <name>org.eclipse.jdt.core.javabuilder</name> | |
10 | + <arguments> | |
11 | + </arguments> | |
12 | + </buildCommand> | |
13 | + </buildSpec> | |
14 | + <natures> | |
15 | + <nature>org.springsource.ide.eclipse.gradle.core.nature</nature> | |
16 | + <nature>org.eclipse.jdt.core.javanature</nature> | |
17 | + </natures> | |
18 | +</projectDescription> |
@@ -0,0 +1,90 @@ | ||
1 | +apply plugin: 'java' | |
2 | +apply plugin: 'eclipse' | |
3 | +apply plugin: 'maven' | |
4 | + | |
5 | +/////////////////////////////////// | |
6 | + | |
7 | +project.group = 'mirrg' | |
8 | +project.archivesBaseName = 'mirrg.complex.hydrogen' | |
9 | + | |
10 | +version = '1.0' | |
11 | + | |
12 | +dependencies { | |
13 | + compile group: 'commons-collections', name: 'commons-collections', version: '3.2' | |
14 | + testCompile group: 'junit', name: 'junit', version: '4.+' | |
15 | + compile group: 'org.apache.commons', name: 'commons-math3', version: '3.5' | |
16 | + // compile group: 'mirrg', name: 'mirrg-struct-hydrogen', version: '1.0' | |
17 | +} | |
18 | + | |
19 | +/////////////////////////////////// | |
20 | + | |
21 | +sourceCompatibility = 1.8 | |
22 | +targetCompatibility = 1.8 | |
23 | + | |
24 | +tasks.withType(AbstractCompile)*.options*.encoding = tasks.withType(GroovyCompile)*.groovyOptions*.encoding = 'UTF-8' | |
25 | + | |
26 | +jar { | |
27 | + manifest { | |
28 | + //attributes 'Main-Class' : 'Main' | |
29 | + attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version | |
30 | + } | |
31 | +} | |
32 | + | |
33 | +task sourcesJar(type: Jar, dependsOn:classes) { | |
34 | + classifier = 'sources' | |
35 | + from sourceSets.main.allSource | |
36 | +} | |
37 | + | |
38 | +task javadocJar(type: Jar, dependsOn:javadoc) { | |
39 | + classifier = 'javadoc' | |
40 | + from javadoc.destinationDir | |
41 | +} | |
42 | + | |
43 | +javadoc { | |
44 | + options.charSet = 'UTF-8' | |
45 | + options.encoding = 'UTF-8' | |
46 | +} | |
47 | + | |
48 | +artifacts { | |
49 | + archives sourcesJar | |
50 | + archives javadocJar | |
51 | +} | |
52 | + | |
53 | +repositories { | |
54 | + mavenCentral() | |
55 | + maven { | |
56 | + url '../../maven' | |
57 | + } | |
58 | + | |
59 | + // ★mirrgリポジトリのデフォルトURL | |
60 | + //maven { | |
61 | + // url 'http://hg.pf.osdn.jp/view/t/ta/tacticsrealize/mirrg.struct.hydrogen/raw-file/tip/maven' | |
62 | + //} | |
63 | + | |
64 | +} | |
65 | + | |
66 | +test { | |
67 | + systemProperties 'property': 'value' | |
68 | +} | |
69 | + | |
70 | +uploadArchives { | |
71 | + repositories { | |
72 | + | |
73 | + // ★まとまったJarとしてフォルダ出力する場合 | |
74 | + //flatDir { | |
75 | + // dirs 'repos' | |
76 | + //} | |
77 | + | |
78 | + // ★mavenプロジェクトとして出力する場合 | |
79 | + mavenDeployer { | |
80 | + pom.artifactId = project.archivesBaseName.replace('.', '-') | |
81 | + repository(url: 'file://localhost/' + file('../../maven').getAbsolutePath()) | |
82 | + } | |
83 | + | |
84 | + } | |
85 | +} | |
86 | + | |
87 | +// ★まとまったJarとしてフォルダ出力する場合 | |
88 | +//jar { | |
89 | +// from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } | |
90 | +//} |
@@ -0,0 +1,253 @@ | ||
1 | +package mirrg.complex.hydrogen; | |
2 | + | |
3 | +import org.apache.commons.math3.util.FastMath; | |
4 | + | |
5 | +/** | |
6 | + * 最高速で稼働するためにオーバーヘッドを削減した複素数構造体。 | |
7 | + */ | |
8 | +public final class StructureComplex | |
9 | +{ | |
10 | + | |
11 | + public double re = 0; | |
12 | + | |
13 | + public double im = 0; | |
14 | + | |
15 | + public StructureComplex() | |
16 | + { | |
17 | + | |
18 | + } | |
19 | + | |
20 | + public StructureComplex(double re, double im) | |
21 | + { | |
22 | + this.re = re; | |
23 | + this.im = im; | |
24 | + } | |
25 | + | |
26 | + public static final StructureComplex createInstance(double re, double im) | |
27 | + { | |
28 | + return new StructureComplex(re, im); | |
29 | + } | |
30 | + | |
31 | + public final StructureComplex copy() | |
32 | + { | |
33 | + return new StructureComplex(re, im); | |
34 | + } | |
35 | + | |
36 | + // | |
37 | + | |
38 | + public final double getRe() | |
39 | + { | |
40 | + return re; | |
41 | + } | |
42 | + | |
43 | + public final void setRe(double re) | |
44 | + { | |
45 | + this.re = re; | |
46 | + } | |
47 | + | |
48 | + public final double getIm() | |
49 | + { | |
50 | + return im; | |
51 | + } | |
52 | + | |
53 | + public final void setIm(double im) | |
54 | + { | |
55 | + this.im = im; | |
56 | + } | |
57 | + | |
58 | + public final void set(StructureComplex complex) | |
59 | + { | |
60 | + this.re = complex.re; | |
61 | + this.im = complex.im; | |
62 | + } | |
63 | + | |
64 | + public final void set(double re, double im) | |
65 | + { | |
66 | + this.re = re; | |
67 | + this.im = im; | |
68 | + } | |
69 | + | |
70 | + public final void setPolar(double abs, double arg) | |
71 | + { | |
72 | + this.re = abs * FastMath.cos(arg); | |
73 | + this.im = abs * FastMath.sin(arg); | |
74 | + } | |
75 | + | |
76 | + public final void setAbstract(double abs) | |
77 | + { | |
78 | + mul(abs / getAbstract()); | |
79 | + } | |
80 | + | |
81 | + public final void setArgument(double arg) | |
82 | + { | |
83 | + double arg2 = arg - getArgument(); | |
84 | + mul( | |
85 | + FastMath.cos(arg2), | |
86 | + FastMath.sin(arg2)); | |
87 | + } | |
88 | + | |
89 | + // | |
90 | + | |
91 | + public final void add(StructureComplex a) | |
92 | + { | |
93 | + this.re += a.re; | |
94 | + this.im += a.im; | |
95 | + } | |
96 | + | |
97 | + public final void add(double re, double im) | |
98 | + { | |
99 | + this.re += re; | |
100 | + this.im += im; | |
101 | + } | |
102 | + | |
103 | + public final void add(double re) | |
104 | + { | |
105 | + this.re += re; | |
106 | + } | |
107 | + | |
108 | + // | |
109 | + | |
110 | + public final void sub(StructureComplex a) | |
111 | + { | |
112 | + this.re -= a.re; | |
113 | + this.im -= a.im; | |
114 | + } | |
115 | + | |
116 | + public final void sub(double re, double im) | |
117 | + { | |
118 | + this.re -= re; | |
119 | + this.im -= im; | |
120 | + } | |
121 | + | |
122 | + public final void sub(double re) | |
123 | + { | |
124 | + this.re -= re; | |
125 | + } | |
126 | + | |
127 | + // | |
128 | + | |
129 | + public final void mul(StructureComplex a) | |
130 | + { | |
131 | + mul(a.re, a.im); | |
132 | + } | |
133 | + | |
134 | + /** | |
135 | + * <pre> | |
136 | + * x = this.re; y = this.im; u = real; v = imaginary; | |
137 | + * | |
138 | + * (x + yi) * (u + vi) | |
139 | + * = xu - yv + xvi + yui | |
140 | + * </pre> | |
141 | + */ | |
142 | + public final void mul(double re, double im) | |
143 | + { | |
144 | + set( | |
145 | + this.re * re - this.im * im, | |
146 | + this.re * im + this.im * re); | |
147 | + } | |
148 | + | |
149 | + public final void mul(double re) | |
150 | + { | |
151 | + this.re *= re; | |
152 | + this.im *= re; | |
153 | + } | |
154 | + | |
155 | + // | |
156 | + | |
157 | + public final void div(StructureComplex a) | |
158 | + { | |
159 | + div(a.re, a.im); | |
160 | + } | |
161 | + | |
162 | + /** | |
163 | + * <pre> | |
164 | + * x = this.re; y = this.im; u = real; v = imaginary; | |
165 | + * | |
166 | + * (x + yi) / (u + vi) | |
167 | + * = ((x + yi) / (u + vi)) * ((u - vi) / (u - vi)) | |
168 | + * = ((x + yi) * (u - vi)) / ((u + vi) * (u - vi)) | |
169 | + * = (xu + yv + yui - xvi) / (uu + vv) | |
170 | + * </pre> | |
171 | + */ | |
172 | + public final void div(double re, double im) | |
173 | + { | |
174 | + double down = Math.pow(re, 2) + Math.pow(im, 2); | |
175 | + set( | |
176 | + (this.re * re + this.im * im) / down, | |
177 | + (this.im * re - this.re * im) / down); | |
178 | + } | |
179 | + | |
180 | + public final void div(double re) | |
181 | + { | |
182 | + this.re /= re; | |
183 | + this.im /= re; | |
184 | + } | |
185 | + | |
186 | + // | |
187 | + | |
188 | + /** | |
189 | + * -re - im | |
190 | + */ | |
191 | + public final void neg() | |
192 | + { | |
193 | + re = -re; | |
194 | + im = -im; | |
195 | + } | |
196 | + | |
197 | + /** | |
198 | + * re - im | |
199 | + */ | |
200 | + public final void con() | |
201 | + { | |
202 | + im = -im; | |
203 | + } | |
204 | + | |
205 | + /** | |
206 | + * -re + im | |
207 | + */ | |
208 | + public final void negcon() | |
209 | + { | |
210 | + re = -re; | |
211 | + } | |
212 | + | |
213 | + /** | |
214 | + * <pre> | |
215 | + * x = this.re; y = this.im; | |
216 | + * | |
217 | + * 1 / (x + yi) | |
218 | + * = (1 / (x + yi)) * ((x - yi) / (x - yi)) | |
219 | + * = (x - yi) / ((x + yi) * (x - yi)) | |
220 | + * = (x - yi) / (x^2 + y^2) | |
221 | + * </pre> | |
222 | + */ | |
223 | + public final void inv() | |
224 | + { | |
225 | + double down = Math.pow(re, 2) + Math.pow(im, 2); | |
226 | + set( | |
227 | + re / down, | |
228 | + -im / down); | |
229 | + } | |
230 | + | |
231 | + // | |
232 | + | |
233 | + public final double getAbstract2() | |
234 | + { | |
235 | + return FastMath.pow(re, 2) + FastMath.pow(im, 2); | |
236 | + } | |
237 | + | |
238 | + public final double getAbstract() | |
239 | + { | |
240 | + return FastMath.sqrt(getAbstract2()); | |
241 | + } | |
242 | + | |
243 | + public final double getLogAbstract() | |
244 | + { | |
245 | + return FastMath.log(getAbstract2()) / 2; | |
246 | + } | |
247 | + | |
248 | + public final double getArgument() | |
249 | + { | |
250 | + return FastMath.atan2(im, re); | |
251 | + } | |
252 | + | |
253 | +} |
@@ -0,0 +1,114 @@ | ||
1 | +package mirrg.complex.hydrogen.functions; | |
2 | + | |
3 | +import mirrg.complex.hydrogen.StructureComplex; | |
4 | + | |
5 | +@Deprecated | |
6 | +public class Arithmetic | |
7 | +{ | |
8 | + | |
9 | + @Deprecated | |
10 | + public static final void add(StructureComplex z, StructureComplex a) | |
11 | + { | |
12 | + z.add(a); | |
13 | + } | |
14 | + | |
15 | + @Deprecated | |
16 | + public static final void add(StructureComplex z, double r, double i) | |
17 | + { | |
18 | + z.add(r, i); | |
19 | + } | |
20 | + | |
21 | + @Deprecated | |
22 | + public static final void add(StructureComplex z, double r) | |
23 | + { | |
24 | + z.add(r); | |
25 | + } | |
26 | + | |
27 | + // | |
28 | + | |
29 | + @Deprecated | |
30 | + public static final void sub(StructureComplex z, StructureComplex a) | |
31 | + { | |
32 | + z.sub(a); | |
33 | + } | |
34 | + | |
35 | + @Deprecated | |
36 | + public static final void sub(StructureComplex z, double r, double i) | |
37 | + { | |
38 | + z.sub(r, i); | |
39 | + } | |
40 | + | |
41 | + @Deprecated | |
42 | + public static final void sub(StructureComplex z, double r) | |
43 | + { | |
44 | + z.sub(r); | |
45 | + } | |
46 | + | |
47 | + // | |
48 | + | |
49 | + @Deprecated | |
50 | + public static final void mul(StructureComplex z, StructureComplex a) | |
51 | + { | |
52 | + z.mul(a); | |
53 | + } | |
54 | + | |
55 | + @Deprecated | |
56 | + public static final void mul(StructureComplex z, double r, double i) | |
57 | + { | |
58 | + z.mul(r, i); | |
59 | + } | |
60 | + | |
61 | + @Deprecated | |
62 | + public static final void mul(StructureComplex z, double r) | |
63 | + { | |
64 | + z.mul(r); | |
65 | + } | |
66 | + | |
67 | + // | |
68 | + | |
69 | + @Deprecated | |
70 | + public static final void div(StructureComplex z, StructureComplex a) | |
71 | + { | |
72 | + z.div(a); | |
73 | + } | |
74 | + | |
75 | + @Deprecated | |
76 | + public static final void div(StructureComplex z, double r, double i) | |
77 | + { | |
78 | + z.div(r, i); | |
79 | + } | |
80 | + | |
81 | + @Deprecated | |
82 | + public static final void div(StructureComplex z, double r) | |
83 | + { | |
84 | + z.div(r); | |
85 | + } | |
86 | + | |
87 | + // | |
88 | + | |
89 | + @Deprecated | |
90 | + public static final void neg(StructureComplex z) | |
91 | + { | |
92 | + z.re = -z.re; | |
93 | + z.im = -z.im; | |
94 | + } | |
95 | + | |
96 | + @Deprecated | |
97 | + public static final void con(StructureComplex z) | |
98 | + { | |
99 | + z.im = -z.im; | |
100 | + } | |
101 | + | |
102 | + @Deprecated | |
103 | + public static final void negcon(StructureComplex z) | |
104 | + { | |
105 | + z.re = -z.re; | |
106 | + } | |
107 | + | |
108 | + @Deprecated | |
109 | + public static final void inv(StructureComplex z) | |
110 | + { | |
111 | + z.inv(); | |
112 | + } | |
113 | + | |
114 | +} |
@@ -0,0 +1,187 @@ | ||
1 | +package mirrg.complex.hydrogen.functions; | |
2 | + | |
3 | +import mirrg.complex.hydrogen.StructureComplex; | |
4 | + | |
5 | +import org.apache.commons.math3.util.FastMath; | |
6 | + | |
7 | +public class Exponential | |
8 | +{ | |
9 | + | |
10 | + /** | |
11 | + * <pre> | |
12 | + * a = e^log e a | |
13 | + * | |
14 | + * z^a = (e^log e z)^a | |
15 | + * = e^(a * log e z) | |
16 | + * </pre> | |
17 | + */ | |
18 | + public static final void pow(StructureComplex z, StructureComplex a) | |
19 | + { | |
20 | + log(z); | |
21 | + z.mul(a); | |
22 | + exp(z); | |
23 | + } | |
24 | + | |
25 | + public static final void pow(StructureComplex z, double r, double i) | |
26 | + { | |
27 | + log(z); | |
28 | + z.mul(r, i); | |
29 | + exp(z); | |
30 | + } | |
31 | + | |
32 | + public static final void pow(StructureComplex z, double r) | |
33 | + { | |
34 | + log(z); | |
35 | + z.mul(r); | |
36 | + exp(z); | |
37 | + } | |
38 | + | |
39 | + /** | |
40 | + * <pre> | |
41 | + * x = z.r; y = z.i; | |
42 | + * | |
43 | + * (x + yi)^2 = (x + yi) * (x + yi) | |
44 | + * = xx + xyi + xyi + yiyi | |
45 | + * = xx - yy + 2 * xyi | |
46 | + * </pre> | |
47 | + */ | |
48 | + public static final void pow2(StructureComplex z) | |
49 | + { | |
50 | + z.set( | |
51 | + FastMath.pow(z.re, 2) - FastMath.pow(z.im, 2), | |
52 | + 2 * z.re * z.im); | |
53 | + } | |
54 | + | |
55 | + // | |
56 | + | |
57 | + /** | |
58 | + * <pre> | |
59 | + * a = e^log e a | |
60 | + * | |
61 | + * a^z = (e^log e a)^z | |
62 | + * = e^(z * log e a) | |
63 | + * </pre> | |
64 | + */ | |
65 | + public static final void exp(StructureComplex z, StructureComplex a) | |
66 | + { | |
67 | + z.mul( | |
68 | + a.getLogAbstract(), | |
69 | + a.getArgument()); | |
70 | + exp(z); | |
71 | + } | |
72 | + | |
73 | + public static final void exp(StructureComplex z, double r, double i) | |
74 | + { | |
75 | + z.mul( | |
76 | + FastMath.log(FastMath.pow(r, 2) + FastMath.pow(i, 2)) / 2, | |
77 | + FastMath.atan2(i, r)); | |
78 | + exp(z); | |
79 | + } | |
80 | + | |
81 | + /** | |
82 | + * <pre> | |
83 | + * x = z.r; y = z.i; | |
84 | + * a = e^log e a | |
85 | + * | |
86 | + * r^z = r^(x + yi) | |
87 | + * = r^x * r^yi | |
88 | + * = r^x * ((e^log e r)^yi) | |
89 | + * = r^x * e^(yi * log e r) | |
90 | + * = r^x * e^(yi * log e r) | |
91 | + * = r^x * (cos(y * log e r) + isin(y * log e r)) | |
92 | + * </pre> | |
93 | + */ | |
94 | + public static final void exp(StructureComplex z, double r) | |
95 | + { | |
96 | + double expReal = FastMath.pow(r, z.re); | |
97 | + double a = z.im * FastMath.log(r); | |
98 | + | |
99 | + z.set( | |
100 | + expReal * FastMath.cos(a), | |
101 | + expReal * FastMath.sin(a)); | |
102 | + } | |
103 | + | |
104 | + /** | |
105 | + * <pre> | |
106 | + * x = z.r; y = z.i; | |
107 | + * | |
108 | + * e^z = e^(x + yi) | |
109 | + * = e^x * e^yi | |
110 | + * = e^x * (cos(y) + isin(y)) | |
111 | + * </pre> | |
112 | + */ | |
113 | + public static final void exp(StructureComplex z) | |
114 | + { | |
115 | + double expReal = FastMath.exp(z.re); | |
116 | + | |
117 | + z.set( | |
118 | + expReal * FastMath.cos(z.im), | |
119 | + expReal * FastMath.sin(z.im)); | |
120 | + } | |
121 | + | |
122 | + // | |
123 | + | |
124 | + /** | |
125 | + * <pre> | |
126 | + * log a z = log e z / log e a | |
127 | + * </pre> | |
128 | + */ | |
129 | + public static final void log(StructureComplex z, StructureComplex a) | |
130 | + { | |
131 | + log(z); | |
132 | + z.div( | |
133 | + a.getLogAbstract(), | |
134 | + a.getArgument()); | |
135 | + } | |
136 | + | |
137 | + public static final void log(StructureComplex z, double r, double i) | |
138 | + { | |
139 | + log(z); | |
140 | + z.div( | |
141 | + FastMath.log(FastMath.pow(r, 2) + FastMath.pow(i, 2)) / 2, | |
142 | + FastMath.atan2(i, r)); | |
143 | + } | |
144 | + | |
145 | + public static final void log(StructureComplex z, double r) | |
146 | + { | |
147 | + log(z); | |
148 | + z.div(FastMath.log(r)); | |
149 | + } | |
150 | + | |
151 | + public static final double LOG_E_2 = Math.log(2); | |
152 | + | |
153 | + public static final double LOG_E_5 = Math.log(5); | |
154 | + | |
155 | + public static final double LOG_E_10 = Math.log(10); | |
156 | + | |
157 | + public static final void log2(StructureComplex z) | |
158 | + { | |
159 | + log(z); | |
160 | + z.div(LOG_E_2); | |
161 | + } | |
162 | + | |
163 | + public static final void log5(StructureComplex z) | |
164 | + { | |
165 | + log(z); | |
166 | + z.div(LOG_E_5); | |
167 | + } | |
168 | + | |
169 | + public static final void log10(StructureComplex z) | |
170 | + { | |
171 | + log(z); | |
172 | + z.div(LOG_E_10); | |
173 | + } | |
174 | + | |
175 | + public static final void log(StructureComplex z) | |
176 | + { | |
177 | + z.set( | |
178 | + z.getLogAbstract(), | |
179 | + z.getArgument()); | |
180 | + } | |
181 | + | |
182 | + public static final void ln(StructureComplex z) | |
183 | + { | |
184 | + log(z); | |
185 | + } | |
186 | + | |
187 | +} |
@@ -0,0 +1,87 @@ | ||
1 | +package mirrg.complex.hydrogen.functions; | |
2 | + | |
3 | +import mirrg.complex.hydrogen.StructureComplex; | |
4 | + | |
5 | +public class Sigmoid | |
6 | +{ | |
7 | + | |
8 | + public static final void sigmoid(StructureComplex z, StructureComplex a) | |
9 | + { | |
10 | + z.mul(a); | |
11 | + sigmoid(z); | |
12 | + } | |
13 | + | |
14 | + public static final void sigmoid(StructureComplex z, double r, double i) | |
15 | + { | |
16 | + z.mul(-r, -i); | |
17 | + Exponential.exp(z); | |
18 | + z.add(1); | |
19 | + z.inv(); | |
20 | + } | |
21 | + | |
22 | + /** | |
23 | + * <pre> | |
24 | + * sigmoid(z) = 1 / (1 + e ˆ -rz) | |
25 | + * </pre> | |
26 | + */ | |
27 | + public static final void sigmoid(StructureComplex z, double r) | |
28 | + { | |
29 | + z.mul(-r); | |
30 | + Exponential.exp(z); | |
31 | + z.add(1); | |
32 | + z.inv(); | |
33 | + } | |
34 | + | |
35 | + /** | |
36 | + * <pre> | |
37 | + * sigmoid(z) = 1 / (1 + e ˆ -z) | |
38 | + * </pre> | |
39 | + */ | |
40 | + public static final void sigmoid(StructureComplex z) | |
41 | + { | |
42 | + z.neg(); | |
43 | + Exponential.exp(z); | |
44 | + z.add(1); | |
45 | + z.inv(); | |
46 | + } | |
47 | + | |
48 | + // | |
49 | + | |
50 | + /** | |
51 | + * <pre> | |
52 | + * logit(z) = log e z / (1 - z) | |
53 | + * </pre> | |
54 | + */ | |
55 | + public static final void logit(StructureComplex z, StructureComplex a) | |
56 | + { | |
57 | + double ar = a.re; | |
58 | + double ai = a.im; | |
59 | + | |
60 | + logit(z); | |
61 | + z.div(ar, ai); | |
62 | + } | |
63 | + | |
64 | + public static final void logit(StructureComplex z, double r, double i) | |
65 | + { | |
66 | + logit(z); | |
67 | + z.div(r, i); | |
68 | + } | |
69 | + | |
70 | + /** | |
71 | + * <pre> | |
72 | + * logit(z) = (1 / r) * log e z / (1 - z) | |
73 | + * </pre> | |
74 | + */ | |
75 | + public static final void logit(StructureComplex z, double r) | |
76 | + { | |
77 | + logit(z); | |
78 | + z.div(r); | |
79 | + } | |
80 | + | |
81 | + public static final void logit(StructureComplex z) | |
82 | + { | |
83 | + z.div(1 - z.re, -z.im); | |
84 | + Exponential.ln(z); | |
85 | + } | |
86 | + | |
87 | +} |
@@ -0,0 +1,60 @@ | ||
1 | +package mirrg.complex.hydrogen.functions; | |
2 | + | |
3 | +import mirrg.complex.hydrogen.StructureComplex; | |
4 | + | |
5 | +import org.apache.commons.math3.util.FastMath; | |
6 | + | |
7 | +public class Trigonometry | |
8 | +{ | |
9 | + | |
10 | + public static final void sin(StructureComplex z) | |
11 | + { | |
12 | + z.set( | |
13 | + FastMath.sin(z.re) * FastMath.cosh(z.im), | |
14 | + FastMath.cos(z.re) * FastMath.sinh(z.im)); | |
15 | + } | |
16 | + | |
17 | + public static final void cos(StructureComplex z) | |
18 | + { | |
19 | + z.set( | |
20 | + FastMath.cos(z.re) * FastMath.cosh(z.im), | |
21 | + -FastMath.sin(z.re) * FastMath.sinh(z.im)); | |
22 | + } | |
23 | + | |
24 | + public static final void sinh(StructureComplex z) | |
25 | + { | |
26 | + z.set( | |
27 | + FastMath.sinh(z.re) * FastMath.cos(z.im), | |
28 | + FastMath.cosh(z.re) * FastMath.sin(z.im)); | |
29 | + } | |
30 | + | |
31 | + public static final void cosh(StructureComplex z) | |
32 | + { | |
33 | + z.set( | |
34 | + FastMath.cosh(z.re) * FastMath.cos(z.im), | |
35 | + FastMath.sinh(z.re) * FastMath.sin(z.im)); | |
36 | + } | |
37 | + | |
38 | + public static final void tan(StructureComplex z) | |
39 | + { | |
40 | + double real = 2.0D * z.re; | |
41 | + double imaginary = 2.0D * z.im; | |
42 | + double down = FastMath.cos(real) + FastMath.cosh(imaginary); | |
43 | + | |
44 | + z.set( | |
45 | + FastMath.sin(real) / down, | |
46 | + FastMath.sinh(imaginary) / down); | |
47 | + } | |
48 | + | |
49 | + public static final void tanh(StructureComplex z) | |
50 | + { | |
51 | + double real = 2.0D * z.re; | |
52 | + double imaginary = 2.0D * z.im; | |
53 | + double down = FastMath.cosh(real) + FastMath.cos(imaginary); | |
54 | + | |
55 | + z.set( | |
56 | + FastMath.sinh(real) / down, | |
57 | + FastMath.sin(imaginary) / down); | |
58 | + } | |
59 | + | |
60 | +} |
@@ -0,0 +1,1 @@ | ||
1 | +<some-element/> |
@@ -0,0 +1,6 @@ | ||
1 | +package org.gradle; | |
2 | + | |
3 | +public class PersonTest | |
4 | +{ | |
5 | + | |
6 | +} |
@@ -0,0 +1,1 @@ | ||
1 | +<some-resource/> |