mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Compare commits
1620 Commits
v3.5-DEV17
...
v3.6-DEV21
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d17d3c59a3 | ||
|
|
99f73bdba5 | ||
|
|
df08c607d1 | ||
|
|
2b063c91c2 | ||
|
|
6e4dba86f0 | ||
|
|
316e62d27c | ||
|
|
a5043d1b59 | ||
|
|
0ba409a192 | ||
|
|
aed30180f6 | ||
|
|
773e5a21b0 | ||
|
|
0d0cf42918 | ||
|
|
5472b0b50b | ||
|
|
3a07cc52d7 | ||
|
|
380dc47ac7 | ||
|
|
815496a8d1 | ||
|
|
6486e89145 | ||
|
|
d83041282d | ||
|
|
176226545f | ||
|
|
df1d83c357 | ||
|
|
20a7d74c16 | ||
|
|
489c499ba7 | ||
|
|
95e5cb3bc4 | ||
|
|
9a0b6e0bc7 | ||
|
|
44f49c54d6 | ||
|
|
bee7d48ac2 | ||
|
|
d7e1747a2b | ||
|
|
9315b301d7 | ||
|
|
4d5841e4b1 | ||
|
|
e1ac00b860 | ||
|
|
3d07321b2f | ||
|
|
c4204231cc | ||
|
|
f279898bd5 | ||
|
|
6560194db4 | ||
|
|
aaa6bac5ed | ||
|
|
a4e9b52eeb | ||
|
|
ae2df3a271 | ||
|
|
ce920126f5 | ||
|
|
cebf46a99d | ||
|
|
f072a1ad6e | ||
|
|
f77f040ae7 | ||
|
|
07c532a588 | ||
|
|
6572bbb52a | ||
|
|
3e153f03ac | ||
|
|
ac606065aa | ||
|
|
0a03aac7e8 | ||
|
|
79f4bb2815 | ||
|
|
d932811c97 | ||
|
|
1e1ddfaaee | ||
|
|
3e6214624d | ||
|
|
88060faab6 | ||
|
|
6c2a435759 | ||
|
|
c9e01353a0 | ||
|
|
9ff6d6ab97 | ||
|
|
d27327d8c1 | ||
|
|
55e9cdb444 | ||
|
|
46be903027 | ||
|
|
6c960f11c3 | ||
|
|
96c8508da2 | ||
|
|
37c1ec4bd8 | ||
|
|
5540160d3f | ||
|
|
2536bafcb2 | ||
|
|
8de66b8f2b | ||
|
|
2cbf324a26 | ||
|
|
4c7bdc3963 | ||
|
|
133364e597 | ||
|
|
39d19e8c1a | ||
|
|
f0f1b13754 | ||
|
|
de10c10a50 | ||
|
|
5d666c8233 | ||
|
|
696a04e8a0 | ||
|
|
e261794992 | ||
|
|
465ec039a2 | ||
|
|
ea548695b6 | ||
|
|
0b3a883303 | ||
|
|
c474dae4b6 | ||
|
|
cb04baf734 | ||
|
|
e79b474ea8 | ||
|
|
c01b696551 | ||
|
|
5a1bd1a27e | ||
|
|
c15d1bc33b | ||
|
|
a0a9c31641 | ||
|
|
5f78616696 | ||
|
|
4ed2565b2f | ||
|
|
6e77d6bde8 | ||
|
|
df1b5fdcaa | ||
|
|
378cf95784 | ||
|
|
2a8678d416 | ||
|
|
e3fda3cc0d | ||
|
|
a2b95df762 | ||
|
|
3f476a8226 | ||
|
|
92f81ef711 | ||
|
|
e849b4fd81 | ||
|
|
239f66fa6f | ||
|
|
be3cb9d149 | ||
|
|
58617cb165 | ||
|
|
5c33ffb1d4 | ||
|
|
b9b6745da5 | ||
|
|
763235a573 | ||
|
|
e9abe68736 | ||
|
|
cabe078453 | ||
|
|
2be7a2c86e | ||
|
|
0fe28abe5a | ||
|
|
5714a74e88 | ||
|
|
44c6749d14 | ||
|
|
b79166fa59 | ||
|
|
fc9e302aef | ||
|
|
921e81fad8 | ||
|
|
3308372445 | ||
|
|
e6b302dd6c | ||
|
|
e1b8293f01 | ||
|
|
92d1244b68 | ||
|
|
c726325af6 | ||
|
|
209470bf8f | ||
|
|
bc9eaccde2 | ||
|
|
2d6cc255ec | ||
|
|
58f8d9394d | ||
|
|
06914d9446 | ||
|
|
453b05a188 | ||
|
|
ace6760fbb | ||
|
|
da75f0cc38 | ||
|
|
14b287109f | ||
|
|
b44be0897d | ||
|
|
cf31bffed2 | ||
|
|
d84d329a78 | ||
|
|
8d89ba4e67 | ||
|
|
276791edb9 | ||
|
|
2d64166acd | ||
|
|
cbe75fae47 | ||
|
|
537b6677d3 | ||
|
|
980c99cfae | ||
|
|
cdb117486a | ||
|
|
01b0e4767b | ||
|
|
0eb8d63d07 | ||
|
|
d59b7d43f4 | ||
|
|
d392984993 | ||
|
|
c72b81ea84 | ||
|
|
773b076606 | ||
|
|
5dc4ace31d | ||
|
|
0427042709 | ||
|
|
d76701285d | ||
|
|
97ce2989bf | ||
|
|
d8c21e4070 | ||
|
|
0d3a8c911a | ||
|
|
a298715bb5 | ||
|
|
1b18ec7eeb | ||
|
|
33a4cf517d | ||
|
|
105f15e3e0 | ||
|
|
d21a603fa1 | ||
|
|
5d510388cf | ||
|
|
0b7d817c2d | ||
|
|
2b6473da60 | ||
|
|
cefc2cb81c | ||
|
|
b29f72d19c | ||
|
|
75ba4c0e90 | ||
|
|
1d4e93350a | ||
|
|
1120704073 | ||
|
|
41456b5cc1 | ||
|
|
cf745c1200 | ||
|
|
89d99ccecf | ||
|
|
08ff66a7bd | ||
|
|
dfe4da61d8 | ||
|
|
3c5d53a5bb | ||
|
|
9b52cf6a6c | ||
|
|
944f0ba73d | ||
|
|
24203a01ad | ||
|
|
c6c5505610 | ||
|
|
f251e982ae | ||
|
|
d881a2b3be | ||
|
|
4e3a258a1c | ||
|
|
6f79286302 | ||
|
|
ea1aa13a9b | ||
|
|
c25e9f2749 | ||
|
|
5eb519a214 | ||
|
|
61b5fee924 | ||
|
|
ae318a43ba | ||
|
|
759c6593cf | ||
|
|
6f948346a4 | ||
|
|
e098816f2b | ||
|
|
055833eed9 | ||
|
|
f0d839c37b | ||
|
|
c373e65010 | ||
|
|
0d57f88ac2 | ||
|
|
d5b09a4c9c | ||
|
|
afb69d8edb | ||
|
|
603c8cd651 | ||
|
|
983874d599 | ||
|
|
906cffba8e | ||
|
|
af19f31b24 | ||
|
|
47cb560633 | ||
|
|
e24d25ff47 | ||
|
|
373f3b7a35 | ||
|
|
b887f69a1b | ||
|
|
80086ace46 | ||
|
|
53e19a006d | ||
|
|
2d1e36549c | ||
|
|
763458564c | ||
|
|
5f68d2dce0 | ||
|
|
3c639d3377 | ||
|
|
ec11d90160 | ||
|
|
c49fa4f4d5 | ||
|
|
8c01d6291e | ||
|
|
34526f2fe9 | ||
|
|
487ec866f5 | ||
|
|
36df458406 | ||
|
|
1b61f076ca | ||
|
|
cb37db2281 | ||
|
|
1957404d03 | ||
|
|
90acbedabb | ||
|
|
56532be1ea | ||
|
|
bed5f1e820 | ||
|
|
a42ca208b6 | ||
|
|
9ff48f067a | ||
|
|
70fa7c0a45 | ||
|
|
e874714f60 | ||
|
|
71f34634e3 | ||
|
|
afd6552b3b | ||
|
|
8e5a2b42d0 | ||
|
|
bf02c868ea | ||
|
|
25bb4beaa5 | ||
|
|
c187dbe686 | ||
|
|
44fd1885a1 | ||
|
|
197d320bf8 | ||
|
|
d17bba8ce1 | ||
|
|
fe4301a7e2 | ||
|
|
aaf6f282b0 | ||
|
|
f30dd0a9c5 | ||
|
|
d4aebbb441 | ||
|
|
f47c3003a7 | ||
|
|
a7b08c4abf | ||
|
|
a107a0203c | ||
|
|
aaa7889172 | ||
|
|
9e5980f82c | ||
|
|
45345679a6 | ||
|
|
c187d4325b | ||
|
|
7d32bb4446 | ||
|
|
bbc7a03178 | ||
|
|
cec7c4dd52 | ||
|
|
4273480bf4 | ||
|
|
a5252334ef | ||
|
|
e05cf52446 | ||
|
|
1345779cfc | ||
|
|
cfd456c798 | ||
|
|
4af953ee00 | ||
|
|
617ebc3d82 | ||
|
|
3e846a3d20 | ||
|
|
da8341f619 | ||
|
|
d3cafc4aed | ||
|
|
42b37ce017 | ||
|
|
fc9c116fa4 | ||
|
|
a2da081681 | ||
|
|
b6e3ae4c96 | ||
|
|
eb6f111a0d | ||
|
|
f5f38f54e9 | ||
|
|
6ed93a22a1 | ||
|
|
f4dd2f10bd | ||
|
|
2d446cc9c2 | ||
|
|
4c50c1fb53 | ||
|
|
83a50db2cb | ||
|
|
e77096df35 | ||
|
|
f51856a52a | ||
|
|
294bf71f96 | ||
|
|
4ab82e9755 | ||
|
|
b7a56a9dd9 | ||
|
|
cde4ec0194 | ||
|
|
ca191e3163 | ||
|
|
d2a530e19e | ||
|
|
4c62c52fc3 | ||
|
|
b2e90c0af6 | ||
|
|
52c1441e03 | ||
|
|
3d1f8ee5fa | ||
|
|
1023e599a0 | ||
|
|
586ead3638 | ||
|
|
d50e1a8552 | ||
|
|
8c30a6da4a | ||
|
|
a1087c9bb3 | ||
|
|
e363f57a74 | ||
|
|
c61a6d846e | ||
|
|
22ea3399fe | ||
|
|
16dfd234e2 | ||
|
|
4351c68770 | ||
|
|
c10b666b55 | ||
|
|
0dfa8f0e00 | ||
|
|
9264d112ef | ||
|
|
5fdf427f39 | ||
|
|
4c19365e8b | ||
|
|
28cbf3b943 | ||
|
|
410b28f4db | ||
|
|
73e175e0f3 | ||
|
|
8e84ed280d | ||
|
|
0d4c289b9e | ||
|
|
f358f335b0 | ||
|
|
1593576cff | ||
|
|
5066fa990d | ||
|
|
a418b601b1 | ||
|
|
01f1e0e9bd | ||
|
|
aeb0e142cd | ||
|
|
7cacf01e8d | ||
|
|
e95eb7b39d | ||
|
|
fc3de5f84a | ||
|
|
97f58096cb | ||
|
|
2fb044e653 | ||
|
|
de02184079 | ||
|
|
6164dd963f | ||
|
|
8c5b416b56 | ||
|
|
b2da0afb83 | ||
|
|
8b651b50dc | ||
|
|
b69daad663 | ||
|
|
0179c3b3d8 | ||
|
|
894d9e6e23 | ||
|
|
9e4fe431e4 | ||
|
|
c3f7cf1404 | ||
|
|
f1c6394305 | ||
|
|
0f40659052 | ||
|
|
16d5c82f21 | ||
|
|
96b4cacec9 | ||
|
|
1a184f925d | ||
|
|
84f706f370 | ||
|
|
42632c4d8d | ||
|
|
203c505f34 | ||
|
|
5ef8817107 | ||
|
|
46e07a7016 | ||
|
|
35606d321c | ||
|
|
fbd095a2d4 | ||
|
|
79071a2f3b | ||
|
|
80d7eed382 | ||
|
|
a0409e8cea | ||
|
|
6cdd5bbbe7 | ||
|
|
39feb5807c | ||
|
|
99fb4f551e | ||
|
|
6fcabd699a | ||
|
|
bdd6d2c219 | ||
|
|
90e20d79bd | ||
|
|
ebca2b846a | ||
|
|
2a43f11c72 | ||
|
|
6cdb848e9f | ||
|
|
2372b4cdbe | ||
|
|
2eed6f66dc | ||
|
|
3c6bbd5ec6 | ||
|
|
1eae9f4071 | ||
|
|
414cc630fd | ||
|
|
2ada830c5b | ||
|
|
80ba487153 | ||
|
|
9bb1f3434d | ||
|
|
64e83121ca | ||
|
|
97da9f9539 | ||
|
|
c52d260949 | ||
|
|
9a2d71dc5d | ||
|
|
1d9f570ed8 | ||
|
|
6bc48200e7 | ||
|
|
c886158c16 | ||
|
|
c49180460d | ||
|
|
7c90abf675 | ||
|
|
f0fd495a21 | ||
|
|
3f9892d130 | ||
|
|
8150d5b7ce | ||
|
|
edec952b86 | ||
|
|
7d9337fb23 | ||
|
|
7e3f141124 | ||
|
|
750f7fb258 | ||
|
|
08632206c3 | ||
|
|
51eb9e6c96 | ||
|
|
7189c6d759 | ||
|
|
5a27239e01 | ||
|
|
9a62573087 | ||
|
|
e2c6f2ea28 | ||
|
|
7a4be49492 | ||
|
|
11092bf436 | ||
|
|
c52a861a9a | ||
|
|
f01ed7c77c | ||
|
|
fa1e1d00ae | ||
|
|
1dde50f6e5 | ||
|
|
5d18b810a7 | ||
|
|
947393914f | ||
|
|
3bf2f13764 | ||
|
|
1f8bafb334 | ||
|
|
911b9bd966 | ||
|
|
ba5cf3ed1d | ||
|
|
c850a532f6 | ||
|
|
b9039e7767 | ||
|
|
2874bf6bfa | ||
|
|
4b93632b42 | ||
|
|
e885966195 | ||
|
|
1a5b7e1464 | ||
|
|
c98695cd34 | ||
|
|
f767b066df | ||
|
|
169bd9c4e0 | ||
|
|
5bd48dd4f6 | ||
|
|
9b2226d3ba | ||
|
|
b91c8395c0 | ||
|
|
cc27d6be84 | ||
|
|
a1d2fd8f41 | ||
|
|
a33a74923b | ||
|
|
c701c8a510 | ||
|
|
2e4fa9f406 | ||
|
|
9a72ab4269 | ||
|
|
98ff3aaf11 | ||
|
|
83b551deaf | ||
|
|
af94c6f8c5 | ||
|
|
6349e53232 | ||
|
|
eba028475a | ||
|
|
e3d11c27a8 | ||
|
|
0f73c15c0e | ||
|
|
20e0b4aeca | ||
|
|
b313cb4f37 | ||
|
|
64da909243 | ||
|
|
94c723f4a0 | ||
|
|
c16d4c4667 | ||
|
|
3b2aa33c6a | ||
|
|
e6938a38f8 | ||
|
|
5518ac98a8 | ||
|
|
88e6c4cbd2 | ||
|
|
b02a640d6e | ||
|
|
ec195656f7 | ||
|
|
d0dba1d8a1 | ||
|
|
1599546b68 | ||
|
|
709994c3e7 | ||
|
|
c2abdc2a5b | ||
|
|
cd2de5dc3d | ||
|
|
d9df2bb76b | ||
|
|
8ec6d513b8 | ||
|
|
0b5153a6a5 | ||
|
|
93259ce7e0 | ||
|
|
00b498c8b7 | ||
|
|
2162cb1374 | ||
|
|
13c91cf67d | ||
|
|
ac5ae5027b | ||
|
|
e90eaf281f | ||
|
|
5dd950c77b | ||
|
|
9bdbf22f7c | ||
|
|
a27065673c | ||
|
|
028e822aa4 | ||
|
|
fdf6d4e862 | ||
|
|
0e3766a504 | ||
|
|
3bfcfa57aa | ||
|
|
4d205bd742 | ||
|
|
8956f60826 | ||
|
|
0e1bec38aa | ||
|
|
225cf0c9d5 | ||
|
|
ad4d06faa8 | ||
|
|
5eafea682b | ||
|
|
c3145c5f04 | ||
|
|
0dc5fc2f6f | ||
|
|
984d28abf0 | ||
|
|
05e89e5c34 | ||
|
|
32884b1c6a | ||
|
|
e1086afc50 | ||
|
|
21c07be749 | ||
|
|
59f736bb50 | ||
|
|
a81c97c09b | ||
|
|
c72a14a023 | ||
|
|
903861bae9 | ||
|
|
dff682fd88 | ||
|
|
6637a45929 | ||
|
|
837a7c6154 | ||
|
|
e32e233d5f | ||
|
|
b66f65e129 | ||
|
|
9dbfc10e04 | ||
|
|
3be603a9ee | ||
|
|
e4ad4ab1a3 | ||
|
|
bf76bac59d | ||
|
|
c3463860d5 | ||
|
|
2034b8754a | ||
|
|
1c4c83af5e | ||
|
|
5c84f7f789 | ||
|
|
dbecc005b5 | ||
|
|
04b4d945fa | ||
|
|
74f3a213ac | ||
|
|
f3af493aba | ||
|
|
f6bcccb04c | ||
|
|
c1727623a8 | ||
|
|
757a01e876 | ||
|
|
20d8836708 | ||
|
|
775765b853 | ||
|
|
3982267e29 | ||
|
|
fc4b8f7cbc | ||
|
|
7274268f47 | ||
|
|
e1f9005cf5 | ||
|
|
16e00fde90 | ||
|
|
2418d3b95b | ||
|
|
df2d436a02 | ||
|
|
20c975e7df | ||
|
|
7d8c27fd54 | ||
|
|
b0a8c6edfa | ||
|
|
6163ece7d6 | ||
|
|
66fb3b2bde | ||
|
|
14e6fd5393 | ||
|
|
47d79bd872 | ||
|
|
6e8bad3d19 | ||
|
|
1ec634f043 | ||
|
|
2b54f68d50 | ||
|
|
410aaf6a93 | ||
|
|
60600948be | ||
|
|
3450f577d3 | ||
|
|
d55cd20639 | ||
|
|
56ecb3e538 | ||
|
|
365848b79e | ||
|
|
125a92514c | ||
|
|
0881250542 | ||
|
|
0286583d4b | ||
|
|
7cc6733df1 | ||
|
|
4447f8bffd | ||
|
|
ddcd2825a2 | ||
|
|
f24ee9be8a | ||
|
|
5194d09ec3 | ||
|
|
bc13092cd2 | ||
|
|
15b491409a | ||
|
|
92f3a237be | ||
|
|
a6ed25c7e4 | ||
|
|
45a628b4b9 | ||
|
|
b6ee709520 | ||
|
|
77bbca0a16 | ||
|
|
6ca1bd9a9c | ||
|
|
93ff6c36b4 | ||
|
|
6a3734971d | ||
|
|
f8f43eed4c | ||
|
|
8a1842a9ba | ||
|
|
2d3eed0a98 | ||
|
|
df160a10a1 | ||
|
|
a8473441ae | ||
|
|
f18b5470ec | ||
|
|
f51a6a6cb1 | ||
|
|
cc6fa1d02a | ||
|
|
0352e19e34 | ||
|
|
4f64b88f0f | ||
|
|
4348a6279c | ||
|
|
d52fb5a68f | ||
|
|
c179419feb | ||
|
|
b89019264e | ||
|
|
922ebf987b | ||
|
|
ca5504e486 | ||
|
|
369ffd2040 | ||
|
|
f4fcc93693 | ||
|
|
e8b1f69d63 | ||
|
|
6c31805981 | ||
|
|
f2d93cc2dc | ||
|
|
5a0b022188 | ||
|
|
1cb1beb09c | ||
|
|
47e67f4d37 | ||
|
|
5772f6fd2f | ||
|
|
d4a5eaa501 | ||
|
|
881e517b1a | ||
|
|
21415379af | ||
|
|
89b74816f6 | ||
|
|
f3e9ba3573 | ||
|
|
2b68037c72 | ||
|
|
71a81e7f01 | ||
|
|
f261a76b9e | ||
|
|
a94500f1c3 | ||
|
|
2c0ce8f5c5 | ||
|
|
4b4d86f413 | ||
|
|
670698fdef | ||
|
|
73f11db578 | ||
|
|
021ecda647 | ||
|
|
44475a03fb | ||
|
|
7ee6ef43c1 | ||
|
|
caaae923ad | ||
|
|
8627f26b2c | ||
|
|
f415dc38b0 | ||
|
|
3f92810240 | ||
|
|
fc00d28873 | ||
|
|
7daf2fa63e | ||
|
|
eec8d6616c | ||
|
|
9bd6cff3e3 | ||
|
|
d3c04e27fa | ||
|
|
fd0a5955ef | ||
|
|
4029c3a9aa | ||
|
|
c1edbcb00a | ||
|
|
fcc9660b64 | ||
|
|
532b29b9d1 | ||
|
|
c973328779 | ||
|
|
76d459a895 | ||
|
|
b6eabc63d1 | ||
|
|
e7aaebcd00 | ||
|
|
7d06cd5ad1 | ||
|
|
cc11f1fa2d | ||
|
|
4cd24bc09a | ||
|
|
a4dbfa69d3 | ||
|
|
d042ec591e | ||
|
|
211b9b23cd | ||
|
|
d6c16dd9de | ||
|
|
e1db9c832f | ||
|
|
05ee4f40da | ||
|
|
a0add0bdc9 | ||
|
|
a9ddef9667 | ||
|
|
d69fa7986f | ||
|
|
3ff380ce0f | ||
|
|
c0bed13cfa | ||
|
|
794efdaf06 | ||
|
|
5e54c994b7 | ||
|
|
0a1b0846ce | ||
|
|
28645ff7b0 | ||
|
|
ff433dcf76 | ||
|
|
429b5de44c | ||
|
|
0fab9b901a | ||
|
|
2e228ef52b | ||
|
|
13b80dfda6 | ||
|
|
09dea59996 | ||
|
|
4ae3d47d10 | ||
|
|
3aca25c681 | ||
|
|
0caa399e06 | ||
|
|
8fe784c8d2 | ||
|
|
ed33157945 | ||
|
|
75c3039358 | ||
|
|
d5fffcc8fa | ||
|
|
a853ce9e9d | ||
|
|
d399d1ce4c | ||
|
|
a82e1467b5 | ||
|
|
c6dd6a1f64 | ||
|
|
adc9fc84cd | ||
|
|
df268b7e6f | ||
|
|
95d0e330b0 | ||
|
|
0398bcdea3 | ||
|
|
0ed1ad86a7 | ||
|
|
521b507b18 | ||
|
|
ecc8c9b593 | ||
|
|
613ddbda81 | ||
|
|
2735d8969a | ||
|
|
7a0ed0792b | ||
|
|
1167cdd582 | ||
|
|
d8f68a93f0 | ||
|
|
368da6d075 | ||
|
|
0f2dae05bb | ||
|
|
33d5c1fe2b | ||
|
|
b97eca37ff | ||
|
|
29fcc6aafe | ||
|
|
562cde58f4 | ||
|
|
7e77dd552a | ||
|
|
e5b756b060 | ||
|
|
8c4758cc7a | ||
|
|
856de3e1e5 | ||
|
|
c31d5c703f | ||
|
|
4b3c36464e | ||
|
|
7eeb4f9179 | ||
|
|
ccc6345606 | ||
|
|
b051f30a7a | ||
|
|
c7515e040b | ||
|
|
587c631b82 | ||
|
|
28b242815b | ||
|
|
feacfefbf4 | ||
|
|
42fa49c50f | ||
|
|
f0315ccca5 | ||
|
|
c082ec50e9 | ||
|
|
39660ecc37 | ||
|
|
685c176eca | ||
|
|
77cf334f8a | ||
|
|
18922e1316 | ||
|
|
b3f35597d3 | ||
|
|
22c2cdd5d7 | ||
|
|
ecd6b13a26 | ||
|
|
f3e3209f32 | ||
|
|
c9bca752cc | ||
|
|
102b5dff15 | ||
|
|
eaf54b692e | ||
|
|
3c1adf90ef | ||
|
|
43150e7c17 | ||
|
|
4d1ef200bf | ||
|
|
afa5d01a31 | ||
|
|
52dc384447 | ||
|
|
bda728696f | ||
|
|
b24869e1a8 | ||
|
|
d32152f6dc | ||
|
|
8ee52edeee | ||
|
|
74c8fddb1a | ||
|
|
9282bd783e | ||
|
|
ce89389451 | ||
|
|
d36b39d31e | ||
|
|
987e79024f | ||
|
|
63ebd5fc7c | ||
|
|
3fab386fb2 | ||
|
|
fc02b8a38b | ||
|
|
71690f32a7 | ||
|
|
d3ba4b0f1e | ||
|
|
2a08c4c2b2 | ||
|
|
e2e9fe63cf | ||
|
|
917bbab173 | ||
|
|
a4727c8a46 | ||
|
|
323a97fb40 | ||
|
|
d7603b7fa6 | ||
|
|
95eca909c1 | ||
|
|
4912f3731d | ||
|
|
95365b647c | ||
|
|
0f5f44053f | ||
|
|
3f9774b2c2 | ||
|
|
cc462f49a3 | ||
|
|
207e20a369 | ||
|
|
1231f59b1a | ||
|
|
7f81ac76a9 | ||
|
|
48fbdbd542 | ||
|
|
7e0fcf32f9 | ||
|
|
3559395c83 | ||
|
|
0125e2aadf | ||
|
|
cc0108d48f | ||
|
|
2b58c20cc9 | ||
|
|
ef97cc84a0 | ||
|
|
b1c9f7071b | ||
|
|
87d1af5b13 | ||
|
|
694be2d111 | ||
|
|
c0869f5caf | ||
|
|
3461af38d5 | ||
|
|
1e9f8ee174 | ||
|
|
1740fd488b | ||
|
|
5ec95681f2 | ||
|
|
0676ce1d89 | ||
|
|
ab2c1048d1 | ||
|
|
66d1d47b1d | ||
|
|
96285c874c | ||
|
|
85fb985d2f | ||
|
|
44eded59b7 | ||
|
|
4ab6bd9809 | ||
|
|
c0893c052a | ||
|
|
98e224b10b | ||
|
|
70bef43ccd | ||
|
|
495dff77ca | ||
|
|
35a37ff846 | ||
|
|
9e7f843d43 | ||
|
|
b17c337979 | ||
|
|
40983afa7b | ||
|
|
b8a6fd40e3 | ||
|
|
67801f4ce7 | ||
|
|
4fd07e7688 | ||
|
|
20b00ea33b | ||
|
|
a7debe567b | ||
|
|
0f1224bb35 | ||
|
|
d913e75402 | ||
|
|
95c1d822a7 | ||
|
|
10ae17868d | ||
|
|
c0b057a48d | ||
|
|
876ce83c96 | ||
|
|
85cbbc3840 | ||
|
|
ce955e01a5 | ||
|
|
e83c9e8bb3 | ||
|
|
6ce905509f | ||
|
|
ec24536f65 | ||
|
|
c81576e311 | ||
|
|
73be187b15 | ||
|
|
85bdb48ab7 | ||
|
|
40195ab0ce | ||
|
|
0ecfa0e67e | ||
|
|
21d1e071bf | ||
|
|
f4d954c3ee | ||
|
|
426c28b961 | ||
|
|
da3e8212cf | ||
|
|
cee6f0329a | ||
|
|
37ebd06564 | ||
|
|
5ad1f1624d | ||
|
|
bbc0a1f0ea | ||
|
|
0da3142f6b | ||
|
|
16a5cb0c6f | ||
|
|
ad3024ac7f | ||
|
|
0035530f29 | ||
|
|
03acacbd7d | ||
|
|
635eccd001 | ||
|
|
6659262ae2 | ||
|
|
78e74ddaa9 | ||
|
|
78b94c9d8f | ||
|
|
fae2b935e1 | ||
|
|
5ecc2470aa | ||
|
|
0495cb786d | ||
|
|
706b79f8fc | ||
|
|
022d403f97 | ||
|
|
fe05d635e6 | ||
|
|
902c18078e | ||
|
|
6fb3baae95 | ||
|
|
6d3811f981 | ||
|
|
279919a747 | ||
|
|
2efe686c14 | ||
|
|
4c9f237c20 | ||
|
|
d755a3a892 | ||
|
|
226d704f1d | ||
|
|
b60bb0e6db | ||
|
|
0c3d748424 | ||
|
|
ab4601cc33 | ||
|
|
70e31235ed | ||
|
|
127166a0e9 | ||
|
|
48670ff566 | ||
|
|
1b3792d4a8 | ||
|
|
3cae9815c4 | ||
|
|
54dc089705 | ||
|
|
8f33ebdd3d | ||
|
|
125ecbb4bb | ||
|
|
d88a94fa7d | ||
|
|
b4eb1191fd | ||
|
|
d1e2f38e07 | ||
|
|
67384872d0 | ||
|
|
9018ad7a28 | ||
|
|
46514538b5 | ||
|
|
cf5d0d1f29 | ||
|
|
8ea4524630 | ||
|
|
2ef1f407b5 | ||
|
|
a0ed8d020f | ||
|
|
071cb35d15 | ||
|
|
2c0eb835d4 | ||
|
|
6e5fb42171 | ||
|
|
40d03c4402 | ||
|
|
e64b6fb557 | ||
|
|
8a94666e91 | ||
|
|
1bf8f43f0a | ||
|
|
835f7cff92 | ||
|
|
8c775e5d2f | ||
|
|
16fc7a192b | ||
|
|
432926f4b9 | ||
|
|
5c47bdb633 | ||
|
|
e90ba2e567 | ||
|
|
fca5d9eb20 | ||
|
|
2914f16e89 | ||
|
|
878b281ffc | ||
|
|
a92833f919 | ||
|
|
ba2213bb73 | ||
|
|
2c20561caa | ||
|
|
17541b373d | ||
|
|
c6691bf2d7 | ||
|
|
151c98d8cc | ||
|
|
21bf52c786 | ||
|
|
c42f06f727 | ||
|
|
46107635c2 | ||
|
|
435e8e9bd5 | ||
|
|
9df093cff6 | ||
|
|
a35e09fd0a | ||
|
|
cd9f130b4b | ||
|
|
a5b9409789 | ||
|
|
7cce47526f | ||
|
|
49bc592a56 | ||
|
|
3f177cae9e | ||
|
|
721cd2646b | ||
|
|
24fad147d0 | ||
|
|
db2de2be1f | ||
|
|
744f6c79d4 | ||
|
|
3728615c09 | ||
|
|
9e16d1dbf0 | ||
|
|
f385831d5e | ||
|
|
0887acdc89 | ||
|
|
8d6ea4fa72 | ||
|
|
4b53b24669 | ||
|
|
9524d56966 | ||
|
|
29d28c93f4 | ||
|
|
edb2340b35 | ||
|
|
5ee004f355 | ||
|
|
6eea504796 | ||
|
|
4eae552846 | ||
|
|
26723b2755 | ||
|
|
b0d3e08ef9 | ||
|
|
f0482bf00c | ||
|
|
9f1187390f | ||
|
|
a3e6ab8e09 | ||
|
|
e06c93ca0e | ||
|
|
edb53806d8 | ||
|
|
145d5ccae6 | ||
|
|
a2a94b3b41 | ||
|
|
5fa59d1cf8 | ||
|
|
c0889179da | ||
|
|
bc6ca7fee1 | ||
|
|
96b36aef0d | ||
|
|
03e8da2c92 | ||
|
|
5420d92cc1 | ||
|
|
d1e0e13ce1 | ||
|
|
c978d6eb80 | ||
|
|
5df46eebc7 | ||
|
|
2cb9bc113e | ||
|
|
0009c280a8 | ||
|
|
715dc15133 | ||
|
|
657bb70d23 | ||
|
|
feac0e86db | ||
|
|
c39b01279a | ||
|
|
9fec594d41 | ||
|
|
14ee925645 | ||
|
|
c2f3f2b8e2 | ||
|
|
b818486aac | ||
|
|
afdc860676 | ||
|
|
1e2ef61b89 | ||
|
|
0aa24acd3d | ||
|
|
43ab7d4afc | ||
|
|
5bd4404279 | ||
|
|
4ed6927626 | ||
|
|
fa9a59d60c | ||
|
|
c13b24251e | ||
|
|
b3a4b4a84e | ||
|
|
cc633a7802 | ||
|
|
2b291f28b7 | ||
|
|
2017d9162f | ||
|
|
6210d0a28d | ||
|
|
fa7684a88d | ||
|
|
675cbcbe58 | ||
|
|
54b756b0ec | ||
|
|
01490a64d1 | ||
|
|
5db9440adb | ||
|
|
6ca8e49a52 | ||
|
|
7606697512 | ||
|
|
5da74f1136 | ||
|
|
45e73f7d34 | ||
|
|
5383430b19 | ||
|
|
5cb0ed5b35 | ||
|
|
43cabb2567 | ||
|
|
5a4411f359 | ||
|
|
b4e82bb323 | ||
|
|
9536ed343b | ||
|
|
575a2b1c0b | ||
|
|
893f2a9b28 | ||
|
|
94eef9b6e0 | ||
|
|
f5bcea85f0 | ||
|
|
bef37ea49c | ||
|
|
32ae63a2b5 | ||
|
|
921765f9ef | ||
|
|
8e46c5d2b6 | ||
|
|
91d0ac1639 | ||
|
|
03516fb0cd | ||
|
|
bf9b42d517 | ||
|
|
64ad946a1c | ||
|
|
df4e1f2fd7 | ||
|
|
cc1ebdd827 | ||
|
|
ab18468a98 | ||
|
|
5c4f72da6c | ||
|
|
5cf76dd95c | ||
|
|
a6875c583a | ||
|
|
a68cc8d179 | ||
|
|
26b5218ff3 | ||
|
|
a3dc4bca2d | ||
|
|
b236c76976 | ||
|
|
5a93a2c62f | ||
|
|
43ed80d547 | ||
|
|
5bdad6199e | ||
|
|
77547bfe55 | ||
|
|
beac898601 | ||
|
|
f9694775d3 | ||
|
|
d01fdf55a7 | ||
|
|
a065d480cd | ||
|
|
0b0f99889e | ||
|
|
8b8ddccb5b | ||
|
|
322a2c5265 | ||
|
|
eff123e0e2 | ||
|
|
c284885f8b | ||
|
|
bb6d2552c0 | ||
|
|
1f4d6d1648 | ||
|
|
be43cde4e1 | ||
|
|
29db9ebde2 | ||
|
|
6f50bc74e3 | ||
|
|
b47ddd13d5 | ||
|
|
411e85843c | ||
|
|
1dfdf952dd | ||
|
|
7330e4326e | ||
|
|
a9bbe5dc5a | ||
|
|
3e99394d39 | ||
|
|
a3d1c624e4 | ||
|
|
f6559cd181 | ||
|
|
223cd82cdc | ||
|
|
600a9cfb43 | ||
|
|
1a5978ac36 | ||
|
|
1d6d66f960 | ||
|
|
937b70e596 | ||
|
|
39b01c2649 | ||
|
|
e68afa6aea | ||
|
|
ff0a75bbc6 | ||
|
|
895d0d1cb6 | ||
|
|
ea8f11ac86 | ||
|
|
85f471bd68 | ||
|
|
4b8f9cc8f0 | ||
|
|
fc20b9c4d8 | ||
|
|
84fbfc464c | ||
|
|
3987833102 | ||
|
|
2babb9f9de | ||
|
|
ee1d2b0ea6 | ||
|
|
e1ddeffd7f | ||
|
|
f83a367796 | ||
|
|
dd755386d3 | ||
|
|
b66a668669 | ||
|
|
e8a41b1228 | ||
|
|
7b659e69d8 | ||
|
|
236f782e66 | ||
|
|
a6b7993fa5 | ||
|
|
457a92a067 | ||
|
|
1e1dceef73 | ||
|
|
3a57fdb8a8 | ||
|
|
35db3a6f03 | ||
|
|
494422399f | ||
|
|
1dbe3c9be8 | ||
|
|
f334097f30 | ||
|
|
27e044f763 | ||
|
|
330b5cbe71 | ||
|
|
385d5234de | ||
|
|
6e175dfb91 | ||
|
|
70f465f914 | ||
|
|
a8ca30ccd7 | ||
|
|
44026a1838 | ||
|
|
8820817d0f | ||
|
|
08a704ec1b | ||
|
|
fbb6f68f81 | ||
|
|
eec18940ae | ||
|
|
d2c2085741 | ||
|
|
9c9d1e52e9 | ||
|
|
23049b4277 | ||
|
|
794e097f8f | ||
|
|
c02714ecc8 | ||
|
|
9a0f291057 | ||
|
|
91c9d2d770 | ||
|
|
3421523768 | ||
|
|
f7e318e959 | ||
|
|
75146af6fe | ||
|
|
3f4b7a64e3 | ||
|
|
7cb72490a8 | ||
|
|
09acc4700e | ||
|
|
439a7f6e12 | ||
|
|
3316f41502 | ||
|
|
c45bd52edd | ||
|
|
20d6d80ded | ||
|
|
523be2bc0a | ||
|
|
d27b4a639b | ||
|
|
73e5d0bd4d | ||
|
|
04d4403844 | ||
|
|
9796d9044f | ||
|
|
8c995a5339 | ||
|
|
4ca3cbcffe | ||
|
|
bff9cfe1d0 | ||
|
|
72ac997a84 | ||
|
|
7409c719b3 | ||
|
|
fa9d32dbf0 | ||
|
|
c5d57af45f | ||
|
|
0e08a7b8bc | ||
|
|
2987e110a2 | ||
|
|
d698dbd942 | ||
|
|
b743440246 | ||
|
|
b30497692a | ||
|
|
27c15f9d20 | ||
|
|
00aea878bd | ||
|
|
c00efb94e5 | ||
|
|
93ec3246cf | ||
|
|
8facce909a | ||
|
|
44d17a606b | ||
|
|
15e70f9e9d | ||
|
|
009d77aa22 | ||
|
|
ff0b32989f | ||
|
|
fc9fb7ba24 | ||
|
|
4083be3744 | ||
|
|
b8c2bd35b7 | ||
|
|
d20291031a | ||
|
|
a1f3a98f79 | ||
|
|
72bc73ceac | ||
|
|
41ac0dc1cd | ||
|
|
e1949c59f1 | ||
|
|
f817692659 | ||
|
|
cefb1b3f12 | ||
|
|
f77cf6d934 | ||
|
|
7e788aa50c | ||
|
|
cce26607ea | ||
|
|
74349879b7 | ||
|
|
81bf4a0b48 | ||
|
|
cea2c09ea6 | ||
|
|
5b6c1f5a5b | ||
|
|
f8d530db4c | ||
|
|
8e0c303759 | ||
|
|
c299a7237e | ||
|
|
681f87a432 | ||
|
|
d2a8951c93 | ||
|
|
95901aa1e2 | ||
|
|
cae7e0b6b6 | ||
|
|
9fb21af373 | ||
|
|
e2ff21e244 | ||
|
|
1c762c1d00 | ||
|
|
5b28c67fdf | ||
|
|
c9600248c6 | ||
|
|
629a5d9446 | ||
|
|
d93404fe77 | ||
|
|
30e0cec696 | ||
|
|
030a1bee02 | ||
|
|
7d2d7627ad | ||
|
|
1402f6ad6a | ||
|
|
356069339f | ||
|
|
68b42549e8 | ||
|
|
095344156c | ||
|
|
a4c78a769a | ||
|
|
20ffbb39f5 | ||
|
|
8836252cdf | ||
|
|
ba8946d8bc | ||
|
|
82aff2f40a | ||
|
|
cd9b03e484 | ||
|
|
63019965b7 | ||
|
|
9138a2890e | ||
|
|
04b6bab3e5 | ||
|
|
c0cf875f1b | ||
|
|
80e99d1159 | ||
|
|
3b33e65a6d | ||
|
|
867e86e185 | ||
|
|
4886a8dee1 | ||
|
|
e8fe5906c8 | ||
|
|
046840513f | ||
|
|
543c4a6dab | ||
|
|
021bbeb2fa | ||
|
|
993eec8946 | ||
|
|
fa4ce91b80 | ||
|
|
b5c9651357 | ||
|
|
60dbc5d2e6 | ||
|
|
b374ceb4dc | ||
|
|
5105669402 | ||
|
|
dff632f7fd | ||
|
|
1042f0f5b8 | ||
|
|
89068ede1e | ||
|
|
5a66c1342a | ||
|
|
fb83864f83 | ||
|
|
1148e3aa69 | ||
|
|
05a8c49053 | ||
|
|
1841faa596 | ||
|
|
a2fe09a65e | ||
|
|
68c5ded23c | ||
|
|
9b9b6f13fe | ||
|
|
25f13f4683 | ||
|
|
5022dba8f3 | ||
|
|
9871d1e53f | ||
|
|
a205e7bb73 | ||
|
|
5cc2e057c8 | ||
|
|
0fe714566a | ||
|
|
2aa4779df9 | ||
|
|
c9581079da | ||
|
|
971cd4df4b | ||
|
|
cdfff8f4ed | ||
|
|
ae3320d2ec | ||
|
|
a89607e8b5 | ||
|
|
efb1a648f6 | ||
|
|
46abc66484 | ||
|
|
b128bee62d | ||
|
|
807ea685d6 | ||
|
|
9bb0aebe46 | ||
|
|
49bc27b020 | ||
|
|
1ad52086e6 | ||
|
|
d4afe27f4e | ||
|
|
ef22b59064 | ||
|
|
679a9bd7c3 | ||
|
|
61dc7f59f8 | ||
|
|
8299011181 | ||
|
|
7cf678307e | ||
|
|
e91b4e998e | ||
|
|
ad46bf9b32 | ||
|
|
39e37073ad | ||
|
|
d1f255f73d | ||
|
|
ca9b5b27bb | ||
|
|
4eca780a57 | ||
|
|
cc22129ae6 | ||
|
|
3633a1e73e | ||
|
|
101b82597b | ||
|
|
feed0c7635 | ||
|
|
914531edf7 | ||
|
|
f681597a32 | ||
|
|
f7d2431e81 | ||
|
|
7073fb0d09 | ||
|
|
a64c6f06d6 | ||
|
|
d817541708 | ||
|
|
0b4d46666d | ||
|
|
1a5034514c | ||
|
|
ea5c07db0e | ||
|
|
0c668c0d0b | ||
|
|
aae62438d3 | ||
|
|
d51080ef42 | ||
|
|
3f8446b9cf | ||
|
|
5ed9890149 | ||
|
|
f6ebdeab8d | ||
|
|
ee5e93be43 | ||
|
|
a7844fb6ad | ||
|
|
5f3486ebe5 | ||
|
|
f60e28e801 | ||
|
|
5bec0878a3 | ||
|
|
83d4490031 | ||
|
|
6749574600 | ||
|
|
44ea4d4dc3 | ||
|
|
a854b9db24 | ||
|
|
edb0444b9f | ||
|
|
b5ed04b7c1 | ||
|
|
c5802596dc | ||
|
|
acad616d12 | ||
|
|
47cb7c91ef | ||
|
|
7a3d4f45e9 | ||
|
|
aead637786 | ||
|
|
af8e59eea4 | ||
|
|
9e8aa07521 | ||
|
|
50f77a3391 | ||
|
|
9fb73099a9 | ||
|
|
5c5b4e1856 | ||
|
|
4c870c7825 | ||
|
|
2787870c2c | ||
|
|
e032358e69 | ||
|
|
2707e3b402 | ||
|
|
3f95d11b98 | ||
|
|
aebc5dc388 | ||
|
|
6f59d09cb2 | ||
|
|
e264405302 | ||
|
|
475288d427 | ||
|
|
5ce7b3b054 | ||
|
|
f7f2ca1d65 | ||
|
|
2068221324 | ||
|
|
3c822fcc61 | ||
|
|
672a16d6fd | ||
|
|
61cf324fa7 | ||
|
|
1a8f4bd177 | ||
|
|
1b2ef12383 | ||
|
|
322b774387 | ||
|
|
332184fa92 | ||
|
|
3a31f5d131 | ||
|
|
e87d3b9dec | ||
|
|
143c10d9c0 | ||
|
|
74fe950fc2 | ||
|
|
dd4ff86da7 | ||
|
|
6e91261502 | ||
|
|
1191b8bd51 | ||
|
|
9588c9c00b | ||
|
|
2a6083071f | ||
|
|
9e5242a782 | ||
|
|
bb4a8606a6 | ||
|
|
1721064184 | ||
|
|
8b2473d715 | ||
|
|
ee966c0a76 | ||
|
|
6979d665d7 | ||
|
|
95fd240577 | ||
|
|
8a64b65ebb | ||
|
|
4f19f75ed1 | ||
|
|
39269cb5ca | ||
|
|
9208bfa617 | ||
|
|
5046fe689c | ||
|
|
c66a9d15f6 | ||
|
|
3384114bdc | ||
|
|
34c402a3d2 | ||
|
|
d9b12d63f7 | ||
|
|
7ff5a970df | ||
|
|
22ce1dc041 | ||
|
|
e07c8494f1 | ||
|
|
73366fd582 | ||
|
|
9cedf54cd5 | ||
|
|
5455714a47 | ||
|
|
3aab662642 | ||
|
|
778fa11b7b | ||
|
|
a1635f075c | ||
|
|
d4cb586850 | ||
|
|
c79565cbdd | ||
|
|
54b161261e | ||
|
|
beb5b376b8 | ||
|
|
1a7839d051 | ||
|
|
4437e94c9a | ||
|
|
061df5fc8d | ||
|
|
649d3ee014 | ||
|
|
a45fe546f9 | ||
|
|
0953c0d3dc | ||
|
|
bbe8056c45 | ||
|
|
4667bce7da | ||
|
|
600c416f06 | ||
|
|
5b4e754d0a | ||
|
|
55ec3973c3 | ||
|
|
e0a4330d30 | ||
|
|
28e5ef66d0 | ||
|
|
a86b0e9b74 | ||
|
|
555ec8116c | ||
|
|
e75cc607f1 | ||
|
|
cdd99da9c9 | ||
|
|
9e21ececff | ||
|
|
aad45092ae | ||
|
|
c8523a2716 | ||
|
|
4bda57919c | ||
|
|
2b64b663e1 | ||
|
|
3e417f8912 | ||
|
|
f5055aa0e3 | ||
|
|
73ef4ff03f | ||
|
|
ba9bab3993 | ||
|
|
b4a6690d6b | ||
|
|
973e38b782 | ||
|
|
191ca89cef | ||
|
|
b274aee402 | ||
|
|
5c9a233e96 | ||
|
|
efabcf84e3 | ||
|
|
3902405feb | ||
|
|
434c15ad50 | ||
|
|
e1da05d00f | ||
|
|
119b889cb4 | ||
|
|
ead2650f15 | ||
|
|
c9d3088aa1 | ||
|
|
17dbb48fc4 | ||
|
|
cba2d1122d | ||
|
|
bdf88cae98 | ||
|
|
4e3b8d0548 | ||
|
|
1e53e857aa | ||
|
|
d7613e9cc1 | ||
|
|
cf64c25d61 | ||
|
|
ce4d3eb108 | ||
|
|
5a065ca07c | ||
|
|
5ea8903edc | ||
|
|
ab3ce3b242 | ||
|
|
cf9de7354d | ||
|
|
1f094f5712 | ||
|
|
eb363c3fab | ||
|
|
8f0fef686b | ||
|
|
db6eec5029 | ||
|
|
55e9c5ed45 | ||
|
|
8b10ebc96e | ||
|
|
72a78e36ce | ||
|
|
43d264e3cb | ||
|
|
9751876703 | ||
|
|
1cc8f15dba | ||
|
|
8a9b775ff7 | ||
|
|
2c690b2ff0 | ||
|
|
be22ebfbac | ||
|
|
5e43ec9368 | ||
|
|
c667f96510 | ||
|
|
11a3c9afe0 | ||
|
|
52b63b61ef | ||
|
|
d0e0a1b449 | ||
|
|
0f7990a894 | ||
|
|
982d357a7b | ||
|
|
ea8df0e3ec | ||
|
|
8f4f979d7a | ||
|
|
d9349150f6 | ||
|
|
352c10e734 | ||
|
|
698ea4eb0b | ||
|
|
db2ebb63fa | ||
|
|
efc61b16b1 | ||
|
|
9e483826be | ||
|
|
dccc7c183c | ||
|
|
1d4fd41404 | ||
|
|
8f2c0d10bd | ||
|
|
b0c6a5b3b1 | ||
|
|
a6a16124db | ||
|
|
7482b35ca9 | ||
|
|
050a26d638 | ||
|
|
4af583917a | ||
|
|
9436806879 | ||
|
|
094307f6f8 | ||
|
|
b84ddb5127 | ||
|
|
f8af6334fb | ||
|
|
6e6db666c5 | ||
|
|
3aefdf1813 | ||
|
|
12c81c2888 | ||
|
|
48c9e060d3 | ||
|
|
54ca96ffd9 | ||
|
|
b17c62c314 | ||
|
|
900d59c795 | ||
|
|
12545a4f3f | ||
|
|
bebbd220d7 | ||
|
|
cac45a7f60 | ||
|
|
2f38661276 | ||
|
|
84e6cc5769 | ||
|
|
12b91b2998 | ||
|
|
0860fe771f | ||
|
|
07b18e6d5c | ||
|
|
afff2c92bc | ||
|
|
ecd5b1568d | ||
|
|
701b6b721e | ||
|
|
ac3dce897c | ||
|
|
0a3846b447 | ||
|
|
40819711bc | ||
|
|
ef0c97c405 | ||
|
|
48d0d05c6f | ||
|
|
e1fbe54b09 | ||
|
|
4022821b82 | ||
|
|
e6770edfc3 | ||
|
|
ed18178d73 | ||
|
|
80e535e48e | ||
|
|
de9c467a84 | ||
|
|
7e23285e94 | ||
|
|
f1819ecd00 | ||
|
|
f49b58c4c0 | ||
|
|
a2ace2e008 | ||
|
|
95ce30a9a5 | ||
|
|
96a32697b7 | ||
|
|
fd16a3e156 | ||
|
|
357ad396cb | ||
|
|
254fcc969e | ||
|
|
5fd4370f8d | ||
|
|
22921af218 | ||
|
|
bcdf49a7be | ||
|
|
2af9db0f66 | ||
|
|
a57766fdcd | ||
|
|
85cad4d2e0 | ||
|
|
0e906347f2 | ||
|
|
3af7569a00 | ||
|
|
f018dbd528 | ||
|
|
6bed8fc55d | ||
|
|
e075008689 | ||
|
|
0c18f2a2be | ||
|
|
c21ad85f5f | ||
|
|
92820c7239 | ||
|
|
b0a3a8b807 | ||
|
|
d0f2a928df | ||
|
|
39e84a04b7 | ||
|
|
5641f977dc | ||
|
|
3c648216f5 | ||
|
|
8c8402b8e6 | ||
|
|
f8e1a6c4d4 | ||
|
|
c4fb6340a5 | ||
|
|
7bc826895f | ||
|
|
70cf92a110 | ||
|
|
8357b4c959 | ||
|
|
5aac5fd7da | ||
|
|
34726ce7b8 | ||
|
|
f789238000 | ||
|
|
390a088749 | ||
|
|
90f30c0965 | ||
|
|
8aa1288a44 | ||
|
|
39520043c1 | ||
|
|
71c3dbd2ae | ||
|
|
57f6dedcc5 | ||
|
|
dfdd0e0a18 | ||
|
|
615dec8a6a | ||
|
|
a7e17e378c | ||
|
|
f180242c53 | ||
|
|
49d78e6c7b | ||
|
|
d4504f46cd | ||
|
|
f6576150dc | ||
|
|
4a3e27c36b | ||
|
|
1dc00b8bd3 | ||
|
|
f19cb68108 | ||
|
|
ef68066f7f | ||
|
|
6ede8cc527 | ||
|
|
eae009e734 | ||
|
|
4399f1e183 | ||
|
|
e914090e02 | ||
|
|
5a5685d434 | ||
|
|
c12d149620 | ||
|
|
1c18df171d | ||
|
|
a9ba3d80be | ||
|
|
2e21157a0d | ||
|
|
2140b854dd | ||
|
|
4575881110 | ||
|
|
88098f216d | ||
|
|
09f71f7451 | ||
|
|
15acadbf44 | ||
|
|
b7356b4309 | ||
|
|
729d8aa0ac | ||
|
|
0e77cb7536 | ||
|
|
47f439d1bc | ||
|
|
752fdebbce | ||
|
|
baf71b79ad | ||
|
|
d4154ca105 | ||
|
|
b50c034f4e | ||
|
|
6d78bd165c | ||
|
|
f215e2b433 | ||
|
|
710cddf664 | ||
|
|
be5df09024 | ||
|
|
0d94e0200e | ||
|
|
954570fe16 | ||
|
|
8e5e95bfe4 | ||
|
|
56335c13ef | ||
|
|
d34147d975 | ||
|
|
5ac6813846 | ||
|
|
4ce070f4c9 | ||
|
|
29f734405b | ||
|
|
b99e8f54f8 | ||
|
|
d734f1c485 | ||
|
|
a82c3b93a6 | ||
|
|
8e3a170d94 | ||
|
|
a78ea56090 | ||
|
|
3714525538 | ||
|
|
5d9b42a57d | ||
|
|
62c79ce9a5 | ||
|
|
8a3db53a90 | ||
|
|
0c4ffcf93f | ||
|
|
b293d5374b | ||
|
|
301194000f | ||
|
|
d9d5ed752b | ||
|
|
dcf248f167 | ||
|
|
46e7cd017e | ||
|
|
15361f6f1d | ||
|
|
9d00f78e4c | ||
|
|
9e193c7e9f | ||
|
|
90a18303c4 | ||
|
|
6df60d819b | ||
|
|
410c850556 | ||
|
|
6ee8b22563 | ||
|
|
b1d83dd3fa | ||
|
|
ced9eba360 | ||
|
|
6b1f3f41aa | ||
|
|
b65dfc90ac | ||
|
|
08107f349d | ||
|
|
d58309686d | ||
|
|
7db994606b | ||
|
|
a7f91fd6ec | ||
|
|
068dcf0fb2 | ||
|
|
80029cbdcc | ||
|
|
6314033b93 | ||
|
|
b1e0a567fb | ||
|
|
2d845d03d1 | ||
|
|
e4ca3f8069 | ||
|
|
2ccf4239eb | ||
|
|
a7d45944f1 | ||
|
|
ff56385727 | ||
|
|
5b12503824 | ||
|
|
5e28aa58de | ||
|
|
bb06f898f4 | ||
|
|
caaae569a8 | ||
|
|
3dd20804e9 | ||
|
|
a9a88e6103 | ||
|
|
cc2f56c7a3 | ||
|
|
73ab008fa5 | ||
|
|
3304e6c72e | ||
|
|
9599060768 | ||
|
|
6495fe8505 | ||
|
|
e79c6626a2 | ||
|
|
a30fcbda4e | ||
|
|
aaf35a620f | ||
|
|
0a8d803233 | ||
|
|
5d94ce2167 | ||
|
|
fe1313bac1 | ||
|
|
6b7d1b794c | ||
|
|
a147165a45 | ||
|
|
f47607d725 | ||
|
|
bbfc4e44fe | ||
|
|
33b86235e9 | ||
|
|
1aa1ab41d1 | ||
|
|
be73ab9749 | ||
|
|
ae6d00103e | ||
|
|
147d3b83d9 | ||
|
|
eae7f1d9ed | ||
|
|
9a48237543 | ||
|
|
d7579beed1 | ||
|
|
a3e23fd6de | ||
|
|
5fb1c00cf9 | ||
|
|
da6db1eb6b | ||
|
|
2352b4f0c9 | ||
|
|
6727c4636e | ||
|
|
a15bcfc102 | ||
|
|
dd112d6d81 | ||
|
|
7eb926b33a | ||
|
|
a7981ff302 | ||
|
|
92880c112e | ||
|
|
8e336caaab | ||
|
|
0d8485a75a | ||
|
|
3597287aeb | ||
|
|
80e786c4c0 | ||
|
|
b3680c0dd1 | ||
|
|
e01b110c54 | ||
|
|
385b56ee47 | ||
|
|
76eaecab5a | ||
|
|
2a5fcfe5db | ||
|
|
c343b93dd7 | ||
|
|
99f6ac48a9 | ||
|
|
3a534e1ff4 | ||
|
|
655a7c4f21 | ||
|
|
99d90dea32 | ||
|
|
a0cbf55a97 | ||
|
|
db3d119f7d | ||
|
|
6d9731e1ed | ||
|
|
53e6b9887f | ||
|
|
85f7ad124b | ||
|
|
29558420b6 | ||
|
|
acafb668dc | ||
|
|
124308225b | ||
|
|
00144effd8 | ||
|
|
18c43fcebd | ||
|
|
ac04d20edd | ||
|
|
f573b5c48f | ||
|
|
14e27e9486 | ||
|
|
843180fa98 | ||
|
|
ab82ea004f | ||
|
|
27696e5486 | ||
|
|
0662a41ebb | ||
|
|
f0b2d37da2 | ||
|
|
e3f48beae4 | ||
|
|
bb3c33bc16 | ||
|
|
b0d676cef6 | ||
|
|
82c06b4b29 | ||
|
|
1874ddaaeb | ||
|
|
0a2ac3aa6b | ||
|
|
7f6e3efbdf | ||
|
|
744dab6fd7 | ||
|
|
e51ba52218 | ||
|
|
bc2c0fbf41 | ||
|
|
b282299d25 | ||
|
|
a5ee8e3689 | ||
|
|
819031b38b | ||
|
|
1202d234fb | ||
|
|
ce4edaa0f8 | ||
|
|
f9ffdb423a | ||
|
|
77e99c12fd | ||
|
|
83340aa148 | ||
|
|
b984c340ba | ||
|
|
6237096871 | ||
|
|
96f34aabb2 | ||
|
|
83bbe93b7d | ||
|
|
8b79278777 | ||
|
|
83d87d5499 | ||
|
|
646c3ca1ad | ||
|
|
fd2f54dea9 | ||
|
|
c7d4f33ce6 | ||
|
|
e26a672755 | ||
|
|
fd090e6104 | ||
|
|
316983e7da | ||
|
|
dfc27ffa82 | ||
|
|
5e6a6e85a9 | ||
|
|
69ac33fe66 | ||
|
|
8f6cb27385 | ||
|
|
8e4b36e855 | ||
|
|
91828692b8 | ||
|
|
a771b9629a | ||
|
|
7bb78f5eb0 | ||
|
|
f2afbdc0f8 | ||
|
|
0ff2a3088c | ||
|
|
038860a4ec | ||
|
|
0232238326 | ||
|
|
58a49b6576 | ||
|
|
c68765f5e4 | ||
|
|
167165ca15 | ||
|
|
684b44598d | ||
|
|
a634ea04a5 | ||
|
|
c62d80dcd6 | ||
|
|
c7068929ee | ||
|
|
f38d4b1498 | ||
|
|
dc0b0c6237 | ||
|
|
5cb3f07437 | ||
|
|
36b16a558f | ||
|
|
98f54da285 | ||
|
|
871a188944 | ||
|
|
43c73bd3d4 | ||
|
|
955b42689b | ||
|
|
a313378cba | ||
|
|
5733d821bf | ||
|
|
71bc82be7a | ||
|
|
6c3d2f1ce7 | ||
|
|
7d9aab2e41 | ||
|
|
45ddb5a14c | ||
|
|
737e779968 | ||
|
|
0178aa1693 | ||
|
|
1f28da4f99 | ||
|
|
aa86f54eea | ||
|
|
a2292fdae3 | ||
|
|
fb14081f0f | ||
|
|
0fd5e3afd7 | ||
|
|
24b739a7c9 | ||
|
|
8b63dcffa4 | ||
|
|
dab0698932 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -13,6 +13,7 @@ Makefile
|
||||
*.prl
|
||||
*.swp
|
||||
*.user
|
||||
*.AppImage
|
||||
|
||||
# osx noise
|
||||
.DS_Store
|
||||
@@ -49,4 +50,6 @@ qwt/src/Makefile.Debug
|
||||
qwt/textengines/mathml/debug/
|
||||
qwt/textengines/mathml/release/
|
||||
build.pro.user
|
||||
build.pro.user.*
|
||||
doc/contrib/WASP Packet Protocol.pdf
|
||||
|
||||
|
||||
172
.travis.yml
172
.travis.yml
@@ -1,15 +1,21 @@
|
||||
branches:
|
||||
- master
|
||||
language:
|
||||
- objective-c
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
only:
|
||||
- master
|
||||
- /^[vV]\d+\.\d+(\.\d+)?(-\S*)?$/
|
||||
|
||||
language: cpp
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/Library/Caches/Homebrew
|
||||
- qwt
|
||||
- D2XX
|
||||
- site-packages
|
||||
- VLC
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- BRANCH=master QT=qt5 QT_PATH=qt5 QT_VER=5.5.1 WEBKIT=1
|
||||
- BRANCH=master QT=qt5 QT_PATH=qt5 WEBKIT=0
|
||||
global:
|
||||
- BRANCH=master
|
||||
- secure: iqYW7f3//ZkMVzeCEarYn0S0DqKjFU9juBh0KF6WTlUsKX902Jtsk7dFoJlNDYBf63HLgV+wW2Hc6MxI9sGiUkom0gY9/To/aeGIJFGEX2sLm/e0Ok3qN521FA0Q/OiCFsD0RC6J+yrHxzI+rf8Z1rujceUsz2KgsrfAjYYv+BY=
|
||||
- secure: C6f58PXwvvHeVOjCLbyDRjgyF0tk+bXjCNUDur8VJLhJEGNdnrt+rH+d3azYaX0n348ZnQZ14as4M4rHjN1A/3DRbdUdOS7PQZrkj/n363ck1tvYOG/tzYqkEcVoQyjIJ7ZoTuBXDQry/VJmLxQjM0glTa2upNFHMOMwqZNkF+I=
|
||||
- secure: mgf181ok4rJTHxAdSaeIb/OzUx7PQc6UjJYfhJQcZDjN1Nou+Um6OHpnooMHeEq0CdGuLSiv2xVmuQnRjI5MfG5re/a3l39hSzi9tPLWi1y7uOLCtQFooJw3H+LhiKZcgAtEnkTmEhUCEu5uZ7cp4lWhrQZWCR5mCDNtJrGHjiw=
|
||||
@@ -24,125 +30,31 @@ env:
|
||||
- secure: QXyyyutxesRVae/WFi75dxlNw2qTyWc6WQ3vmRER9BFhlrNtt8lmE+M6ghMDOhxigzSXWxHcG9r66BLOw4DML7AXg4f3NIAIYuYQrpfsWQ1TKGC/vVvIPDlNBKL62zSOoNowjup1HfZpB575wl4JkmHjoMPDfQ4yM/JVR+MKmIM=
|
||||
- secure: lefpL3SB8yN0Vn1R2e0hAFpJgFnu4rJ/vn7DucSKQvJ61K7t3LrUHFXElDQGFZMbytx4OJDeYsJtrccrIHjcsSAEIyW8TTcwn5/JopnyeQ3ukV5AYpEoQusym09XKru9E7awqvnZrXz6mdoIum5JP7+H116mPN4vsvz5nkNWxeg=
|
||||
- secure: RAGPq/thN9x6STNueDbeJWGUN75OLNcUVUkLHI/eZwPrkMaiQPfxIaJ+8eO2PszDcBojw3eYVhzbRvLnLiXmHL3buwD6oXMTyYnxGzCZ61DeDQ2cQa8ynKmRim5JL3viKMqtdyasXVoGf/u0GqMsgaLcqN6e/vXuXMGu6kkUPEQ=
|
||||
before_install:
|
||||
## try early just to check, can delete later
|
||||
- date
|
||||
- brew update
|
||||
- sh travis/install-qt.sh
|
||||
##- brew install $QT
|
||||
- brew install libical
|
||||
- brew install libusb libusb-compat
|
||||
- brew install srmio
|
||||
- brew install libsamplerate
|
||||
- brew tap homebrew/science
|
||||
- brew install r
|
||||
- brew install lmfit
|
||||
## Disable KML for now
|
||||
##- brew install --HEAD travis/libkml.rb
|
||||
- sudo chmod -R +w /usr/local
|
||||
- curl -O http://www.ftdichip.com/Drivers/D2XX/MacOSX/D2XX1.2.2.dmg
|
||||
- git clone --depth 1 https://github.com/sintegrial/qwtplot3d.git qwtplot3d
|
||||
- cd qwtplot3d
|
||||
- CC=clang CXX=clang++ /usr/local/opt/$QT_PATH/bin/qmake -makefile -recursive QMAKE_CXXFLAGS_WARN_ON+="-Wno-unused-private-field -Wno-c++11-narrowing"
|
||||
- CC=clang CXX=clang++ make -j2
|
||||
- cd ..
|
||||
- git clone --branch 0.98 https://github.com/kypeli/kQOAuth.git kQOAuth-0.98
|
||||
- cd kQOAuth-0.98
|
||||
- CC=clang CXX=clang++ /usr/local/opt/$QT_PATH/bin/qmake -makefile -recursive QMAKE_CXXFLAGS_WARN_ON+="-Wno-unused-private-field -Wno-c++11-narrowing"
|
||||
- CC=clang CXX=clang++ make -j2 qmake_all
|
||||
- CC=clang CXX=clang++ sudo make install
|
||||
- cd ..
|
||||
- hdiutil mount D2XX1.2.2.dmg
|
||||
before_script:
|
||||
- mkdir D2XX
|
||||
- cp /Volumes/release/D2XX/Object/10.5-10.7/x86_64/libftd2xx.1.2.2.dylib D2XX
|
||||
- sudo cp /Volumes/release/D2XX/Object/10.5-10.7/x86_64/libftd2xx.1.2.2.dylib /usr/local/lib
|
||||
- cp /Volumes/release/D2XX/bin/*.h D2XX
|
||||
- sed -i "" "s|libftd2xx.dylib|@executable_path/../Frameworks/libftd2xx.1.2.2.dylib|"
|
||||
src/FileIO/D2XX.cpp
|
||||
- cp qwt/qwtconfig.pri.in qwt/qwtconfig.pri
|
||||
- cp src/gcconfig.pri.in src/gcconfig.pri
|
||||
- /usr/local/opt/$QT_PATH/bin/lupdate src/src.pro
|
||||
- if [[ "$WEBKIT" == "0" ]]; then echo DEFINES += NOWEBKIT >> src/gcconfig.pri; fi
|
||||
- sed -i "" "s|#\(CONFIG += release.*\)|\1 static |" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(QMAKE_LRELEASE\).*|\1 += /usr/local/opt/$QT_PATH/bin/lrelease|"
|
||||
src/gcconfig.pri
|
||||
- sed -i "" "s|#\(QMAKE_CXXFLAGS\).*|\1_RELEASE += -mmacosx-version-min=10.7 -arch
|
||||
x86_64|" src/gcconfig.pri
|
||||
- sed -i "" "s|^#CloudDB|CloudDB|" src/gcconfig.pri
|
||||
- sed -i "" "s|^#LIBZ|LIBZ|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(SRMIO_INSTALL =.*\)|\1 /usr/local|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(D2XX_INCLUDE =.*\)|\1 ../D2XX|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(D2XX_LIBS =.*\)|\1 -L../D2XX -lftd2xx.1.2.2|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(KQOAUTH_INSTALL =.*\)|\1 /usr/local|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(KQOAUTH_INCLUDE =.*\)|\1 \$\$[QT_INSTALL_LIBS]/kqoauth.framework/Headers|"
|
||||
src/gcconfig.pri
|
||||
- sed -i "" "s|#\(KQOAUTH_LIBS =.*\)|\1 -F\$\$[QT_INSTALL_LIBS] -framework kqoauth|"
|
||||
src/gcconfig.pri
|
||||
- sed -i "" "s|#\(QWT3D_INSTALL =.*\)|\1 ../qwtplot3d|" src/gcconfig.pri
|
||||
## Disable KML for now
|
||||
#- sed -i "" "s|#\(KML_INSTALL =\).*|\1 /usr/local|" src/gcconfig.pri
|
||||
#- sed -i "" "s|#\(KML_LIBS =.*\)|\1 -L/usr/local/lib -lkmlxsd -lkmlregionator -lkmldom -lkmlconvenience -lkmlengine -lkmlbase -lexpect|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(ICAL_INSTALL =.*\)|\1 /usr/local|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(ICAL_LIBS =.*\)|\1 -L/usr/local/lib -lical|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(LIBUSB_INSTALL =\).*|\1 /usr/local|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(LIBUSB_LIBS =.*\)|\1 -L/usr/local/lib -lusb -lusb-1.0|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(SAMPLERATE_INSTALL =\).*|\1 /usr/local|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(SAMPLERATE_LIBS =\).*|\1 -L/usr/local/lib -lsamplerate|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(LMFIT_INSTALL =\).*|\1 /usr/local|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(DEFINES += GC_HAVE_LION*\)|\1|" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(HTPATH = ../httpserver.*\)|\1 |" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(DEFINES += GC_WANT_ROBOT.*\)|\1 |" src/gcconfig.pri
|
||||
- sed -i "" "s|\(DEFINES += GC_VIDEO_NONE.*\)|#\1 |" src/gcconfig.pri
|
||||
- sed -i "" "s|#\(DEFINES += GC_VIDEO_QUICKTIME.*\)|\1 |" src/gcconfig.pri
|
||||
##Issues with c++11 and stdlib on travis and dependencies (e.g. plot3d)
|
||||
- sed -i "" "s|#\(DEFINES += GC_WANT_R.*\)|\1 |" src/gcconfig.pri
|
||||
- echo "QMAKE_CFLAGS_RELEASE += -mmacosx-version-min=10.7 -arch x86_64" >> src/gcconfig.pri
|
||||
- sed -i "" "s/__GC_GOOGLE_CALENDAR_CLIENT_SECRET__/"$GC_GOOGLE_CALENDAR_CLIENT_SECRET"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_STRAVA_CLIENT_SECRET__/"$GC_STRAVA_CLIENT_SECRET"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_DROPBOX_CLIENT_SECRET__/"$GC_DROPBOX_CLIENT_SECRET"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_CYCLINGANALYTICS_CLIENT_SECRET__/"$GC_CYCLINGANALYTICS_CLIENT_SECRET"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_TWITTER_CONSUMER_SECRET__/"$GC_TWITTER_CONSUMER_SECRET"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_DROPBOX_CLIENT_ID__/"$GC_DROPBOX_CLIENT_ID"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_MAPQUESTAPI_KEY__/"$GC_MAPQUESTAPI_KEY"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_CLOUD_DB_BASIC_AUTH__/"$GC_CLOUD_DB_BASIC_AUTH"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_CLOUD_DB_APP_NAME__/"$GC_CLOUD_DB_APP_NAME"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_GOOGLE_DRIVE_CLIENT_ID__/"$GC_GOOGLE_DRIVE_CLIENT_ID"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_GOOGLE_DRIVE_CLIENT_SECRET__/"$GC_GOOGLE_DRIVE_CLIENT_SECRET"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_GOOGLE_DRIVE_API_KEY__/"$GC_GOOGLE_DRIVE_API_KEY"/" src/Core/Secrets.h
|
||||
- sed -i "" "s/__GC_TODAYSPLAN_CLIENT_SECRET__/"$GC_TODAYSPLAN_CLIENT_SECRET"/" src/Core/Secrets.h
|
||||
- cat src/gcconfig.pri
|
||||
script:
|
||||
- CC=clang CXX=clang++ /usr/local/opt/$QT_PATH/bin/qmake -makefile -recursive QMAKE_CXXFLAGS_WARN_ON+="-Wno-unused-private-field -Wno-c++11-narrowing"
|
||||
- CC=clang CXX=clang++ make qmake_all
|
||||
- CC=clang CXX=clang++ make -j4 sub-qwt --silent
|
||||
- CC=clang CXX=clang++ make -j4 sub-src
|
||||
after_success:
|
||||
- cd src
|
||||
- echo "Checking GoldenCheetah.app can execute"
|
||||
- GoldenCheetah.app/Contents/MacOS/GoldenCheetah --help
|
||||
- echo "About to create dmg file and fix up"
|
||||
- /usr/local/opt/$QT_PATH/bin/macdeployqt GoldenCheetah.app -verbose=2 -dmg
|
||||
- python ../travis/macdeployqtfix.py GoldenCheetah.app /usr/local/opt/$QT_PATH
|
||||
- echo "Cleaning up installed QT libraries from $QT"
|
||||
- brew remove $QT
|
||||
- echo "Renaming dmg file to branch and build number ready for deploy"
|
||||
- export FINAL_NAME=dev-prerelease-branch-master-build-${TRAVIS_BUILD_NUMBER}.dmg
|
||||
- mv GoldenCheetah.dmg $FINAL_NAME
|
||||
- ls -l $FINAL_NAME
|
||||
- echo "Mounting dmg file and testing it can execute"
|
||||
- hdiutil mount $FINAL_NAME
|
||||
- cd /Volumes/GoldenCheetah
|
||||
- GoldenCheetah.app/Contents/MacOS/GoldenCheetah --help
|
||||
- echo "Make sure we are back in the Travis build directory"
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: KlfkRM8oGP02y5LhbdxetnhqUG3YzVylvyhT8BTYjdoJtkJr7YXYpdhj9byZ9aiy1gSWI/g7A1X6/P8/McqRtgt4dEYr4Zg8QO7Y7QdTpgNQEwu8ZrkyyG/7b/rSkfFHDjrOAHslLVXuBNwWgi8YW1aTn0rY2AqDbOri7u6tt9Q=
|
||||
file: src/$FINAL_NAME
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
repo: GoldenCheetah/GoldenCheetah
|
||||
- secure: Lydms45scczE9gZvkWze2fXVbEInKW48DOCIRJWziEzxKkvXUE7WPy74fLvfvL+0JW0LH/ZLZ9EbgHcJAYYs8CBrfAeOOtnyo2DZ0ouEO13RmomSZneEKSpJxRtErcPIu+B0LzcEGyAgf7bxPVevEte50CK0pZJ7z7bHMhU23pY=
|
||||
- secure: cc0pAJjkmFNw2bO3zVACmtyHTwINAHALrtUxi+nRD+FhOO9KxuxuuwvcKCZKfp9EUOjz5PrYWKV1ZH/zt/jMix8A4Gyue2mWX8WYih7aTmJBcJWsFNTCybnClreKBCh18kHdWWhkmhk8EMINDvlqxzJZGpcNO04gxhL9wuLLrNQ=
|
||||
- secure: em0xXIm69rMHsHXYQiizeJB7dEFBkX33PsWDHwBNrX6lFBued23eL96KJC4RVbk6A+AHFtXFATrreZ14D5JH/E/37CXhe3X2R93WqiPUSH0s7NI4fFA1BroKUNAlqO4bMqDBidtNmwMPaLTXjaOnOZyvbAG7z+QV3TKC8tOeZDU=
|
||||
- secure: VFaSERlgsjzjiDQhKw8XFvQrjdvFzHHL7V3NQg+RfELHoT6I1pAGFdl/+lRBIVOiVkbQ6XnpBA28nlf0QydPHElRZdqmh0azQV/bkUXD4ffPE8q0iSqeqhAZ+5L05K5K+Gby/y8TZE4FX6e/7trFL7oq+h9x0gq5RQO8rAcTV84=
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- os: osx
|
||||
osx_image: xcode11.3
|
||||
compiler: clang
|
||||
- os: linux
|
||||
dist: bionic
|
||||
compiler: gcc
|
||||
|
||||
before_install:
|
||||
- travis/$TRAVIS_OS_NAME/before_install.sh
|
||||
|
||||
before_script:
|
||||
- travis/$TRAVIS_OS_NAME/before_script.sh
|
||||
|
||||
script:
|
||||
- travis/$TRAVIS_OS_NAME/script.sh
|
||||
|
||||
before_cache:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cleanup; fi
|
||||
|
||||
after_success:
|
||||
- travis/$TRAVIS_OS_NAME/after_success.sh
|
||||
|
||||
49
CONTRIBUTING.md
Normal file
49
CONTRIBUTING.md
Normal file
@@ -0,0 +1,49 @@
|
||||
## How to get help
|
||||
|
||||
#### **Do you have questions about how to use GoldenCheetah?**
|
||||
|
||||
* Ask any question about how to use GoldenCheetah on [golden-cheetah-users mailing list](https://groups.google.com/forum/#!forum/golden-cheetah-users), ideally after watching the corresponding [tutorials](https://www.goldencheetah.org/#section-tutorials) and/or reading the relevant parts of the [documentation](https://github.com/GoldenCheetah/GoldenCheetah/wiki).
|
||||
|
||||
#### **Do you have questions about the source code?**
|
||||
|
||||
* Ask any question about how to build GoldenCheetah or anything related to the source code in the [golden-cheetah-developers mailing list](https://groups.google.com/forum/#!forum/golden-cheetah-developers), please see the [GoldenCheetah Developers Guide](https://github.com/GoldenCheetah/GoldenCheetah/wiki/Developers-guide) for addtional information.
|
||||
|
||||
## How to contribute to GoldenCheetah
|
||||
|
||||
#### **Did you find a bug?**
|
||||
|
||||
* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/GoldenCheetah/GoldenCheetah/issues).
|
||||
|
||||
* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/GoldenCheetah/GoldenCheetah/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and **steps to reproduce the problem** or a **test file** demonstrating the expected behavior that is not occurring.
|
||||
|
||||
#### **Did you write a patch that fixes a bug?**
|
||||
|
||||
* Open a new GitHub pull request with the patch.
|
||||
|
||||
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
|
||||
|
||||
* See [GoldenCheetah Guidelines for submitting a patch](https://github.com/GoldenCheetah/GoldenCheetah/wiki/Guidelines-for-submitting-a-patch) for additional information.
|
||||
|
||||
#### **Did you fix whitespace, format code, or make a purely cosmetic patch?**
|
||||
|
||||
Changes that are cosmetic in nature and do not add anything substantial to the stability or functionality of GoldenCheetah will generally not be accepted.
|
||||
|
||||
#### **Do you intend to add a new feature or change an existing one?**
|
||||
|
||||
* Suggest your change in the [golden-cheetah-developers mailing list](https://groups.google.com/forum/#!forum/golden-cheetah-developers) and start writing code.
|
||||
|
||||
* Do not open an issue on GitHub until you have collected positive feedback about the change. GitHub issues are primarily intended for bug reports and fixes.
|
||||
|
||||
#### **Do you want to contribute to GoldenCheetah translations?**
|
||||
|
||||
* Translators are very welcome, please see [GoldenCheetah Guidelines for translators](https://github.com/GoldenCheetah/GoldenCheetah/wiki/Guidelines-for-translators)
|
||||
|
||||
#### **Do you want to contribute to GoldenCheetah documentation?**
|
||||
|
||||
* The [GoldenCheetah wiki](https://github.com/GoldenCheetah/GoldenCheetah/wiki) is open to user's contributions. feel free to add what you consider relevant to make other's users experience smoother.
|
||||
|
||||
GoldenCheetah is a volunteer effort. Contributions are welcome!
|
||||
|
||||
Thanks!
|
||||
|
||||
GoldenCheetah Team
|
||||
873
COPYING
873
COPYING
@@ -1,622 +1,281 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
NO WARRANTY
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
@@ -628,15 +287,15 @@ free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
@@ -644,32 +303,38 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
||||
|
||||
377
INSTALL-LINUX
377
INSTALL-LINUX
@@ -4,57 +4,88 @@
|
||||
|
||||
Mark Liversedge
|
||||
John Ehrlinger
|
||||
Ale Martinez
|
||||
|
||||
Jan 2015
|
||||
Version 1.2
|
||||
Mar 2021
|
||||
Version 3.6
|
||||
|
||||
A walkthrough of building GoldenCheetah from scratch on Ubuntu linux. This walkthrough
|
||||
should be largely the same for any Linux distro.
|
||||
A walkthrough of building GoldenCheetah from scratch on Ubuntu linux 18.04
|
||||
This walkthrough should be largely the same for any Debian derivative Linux
|
||||
distro, and very similar for others using their correspoing package manager.
|
||||
|
||||
CONTENTS
|
||||
|
||||
1. BASIC INSTALLATION WITH MANDATORY DEPENDENCIES
|
||||
- QT
|
||||
- git
|
||||
- flex
|
||||
- bison
|
||||
- QT
|
||||
- OpenGL
|
||||
- gsl
|
||||
|
||||
2. ADDING OPTIONAL DEPENDENCIES WHEN BUILDING VERSION 2
|
||||
2. ADDING OPTIONAL DEPENDENCIES
|
||||
- FTDI D2XX
|
||||
- SRMIO
|
||||
- liboauth
|
||||
- QwtPlot3d
|
||||
- libkml
|
||||
|
||||
3. ADDING OPTIONAL DEPENDENCIES WHEN BUILDING VERSION 3
|
||||
- checking out the release 3 branch & building with MANDATORY dependencies
|
||||
- flex
|
||||
- bison
|
||||
- libical - Diary window and CalDAV support (google/mobileme calendar integration)
|
||||
- libvlc - Video playback in training mode
|
||||
- libical - Diary window and CalDAV support (external calendar integration)
|
||||
- libusb - If you want support for using USB2 sticks in Train View
|
||||
- R - If you want R charts
|
||||
- Python - If you want Python charts, scripts and data processors
|
||||
|
||||
1. BASIC INSTALLATION WITH MANDATORY DEPENDENCIES
|
||||
=================================================
|
||||
|
||||
Installed Ubuntu 11.04 from CD image amd-64.iso. You will not need to do this if you
|
||||
already have a Linux distribution installed. Left this step in to highlight the
|
||||
Linux distribution the commands below were executed on.
|
||||
Install the Linux distribution of choice on amd64 platform (Ubuntu 18.04 is used
|
||||
for this document). You will not need to do this if you already have a Linux
|
||||
distribution installed. Left this step in to highlight the Linux distribution
|
||||
the commands below were executed on.
|
||||
|
||||
login and open a terminal to get a shell prompt
|
||||
|
||||
Download MANDATORY DEPENDENCIES (browser)
|
||||
-----------------------------------------
|
||||
Download and install the Qt 4.8 SDK from http://qt-project.org/
|
||||
Once that is completed test qmake is ok with: qmake --version (should report 4.7.0 or higher)
|
||||
Install Qt
|
||||
----------
|
||||
Download and install the Qt SDK from http://qt-project.org/
|
||||
You can use a browser to download and run the interactive installer, be sure to
|
||||
select version 5.14.2 or higher including at least the following modules:
|
||||
- Desktop gcc 64-bit
|
||||
- Qt Charts
|
||||
- Qt WebEngine
|
||||
Once this step is completed add the bin directory to PATH and test qmake is ok:
|
||||
$ qmake --version
|
||||
|
||||
Install git with:
|
||||
Install git
|
||||
-----------
|
||||
$ sudo apt-get install git
|
||||
Said Y to prompt about all git files installed (git-gui et al)
|
||||
|
||||
Install FLEX and BISON
|
||||
----------------------
|
||||
|
||||
You will need flex v2.5.9 or later
|
||||
$ sudo apt-get install bison
|
||||
$ sudo apt-get install flex
|
||||
|
||||
Install Mesa OpenGL utility library
|
||||
-----------------------------------
|
||||
sudo apt-get install libglu1-mesa-dev
|
||||
|
||||
Install GSL development libraries
|
||||
---------------------------------
|
||||
sudo apt-get -qq install libgsl-dev
|
||||
|
||||
Get latest GOLDEN CHEETAH source files
|
||||
--------------------------------------
|
||||
$ mkdir -p ~/Projects
|
||||
$ cd ~/Projects
|
||||
$ git clone git://github.com/GoldenCheetah/GoldenCheetah.git
|
||||
$ cd GoldenCheetah
|
||||
|
||||
Configure MANDATORY DEPENDENCIES
|
||||
--------------------------------
|
||||
$ cd qwt
|
||||
$ cp qwtconfig.pri.in qwtconfig.pri
|
||||
$ cd ../src
|
||||
$ cp gcconfig.pri.in gcconfig.pri
|
||||
$ vi gcconfig.pri
|
||||
|
||||
Ensure you have the following lines (which are now also in gcconfig.pri.in which has
|
||||
@@ -68,33 +99,17 @@ win32 {
|
||||
QMAKE_DEL_FILE = rm -f
|
||||
}
|
||||
|
||||
Build!
|
||||
------
|
||||
$ make clean
|
||||
$ qmake
|
||||
$ make
|
||||
To compile translation you need the QT tool lrelease
|
||||
If it is not found using the defaults in src/src.pro then set the full path and
|
||||
filename in gcconfig.pri, s.t.
|
||||
QMAKE_LRELEASE = /usr/bin/lrelease
|
||||
|
||||
You will now have a release3 binary but with none of the release3 dependencies compiled in.
|
||||
Get latest GOLDEN CHEETAH source files
|
||||
--------------------------------------
|
||||
$ mkdir -p ~/Projects/Live
|
||||
$ cd ~/Projects/Live
|
||||
$ git clone git://github.com/GoldenCheetah/GoldenCheetah.git
|
||||
$ cd GoldenCheetah
|
||||
If your QT build includes its own local compress libs then you should comment the line below in gcconfig.pri,
|
||||
otherwise you will need to have the compress libraries installed separately.
|
||||
LIBZ_LIBS = -lz
|
||||
|
||||
Configure MANDATORY DEPENDENCIES
|
||||
--------------------------------
|
||||
$ cd qwt
|
||||
$ cp qwtconfig.pri.in qwtconfig.pri
|
||||
$ cd ../src
|
||||
$ cp gcconfig.pri.in gcconfig.pri
|
||||
$ vi gcconfig.pri
|
||||
|
||||
Comment out the D2XX_INCLUDE and SRMIO_INSTALL lines for now (put # in first character of the line
|
||||
to comment out), we will install that in a moment, if we need to.
|
||||
|
||||
If you are building for your local host you may find that you get better performance if
|
||||
compiling with gcc -O3 (tree vectorization can have a significat impact) [or -Ofast]
|
||||
compiling with gcc -O3 (tree vectorization can have a significat impact)
|
||||
[or -Ofast]
|
||||
|
||||
If so you might like to uncomment:
|
||||
|
||||
@@ -105,32 +120,42 @@ Save and exit
|
||||
$ cd ..
|
||||
|
||||
BUILD WITH BASIC CONFIGURATION
|
||||
------------------------------
|
||||
$ qmake -recursive
|
||||
$ make
|
||||
|
||||
Congratulations you have now build a basic GoldenCheetah and can run this safely. See below for
|
||||
optional dependencies you can install to support other features.
|
||||
When build first time you get number of error messages on .qm files missing:
|
||||
"RCC: Error in 'Resources/application.qrc': Cannot find file 'translations/gc_fr.qm'"
|
||||
You can ignore these messages for your build. The .qm files will be created
|
||||
during the build at a later point in time via the "lrelease" command you
|
||||
configured in gcconfig.pri
|
||||
|
||||
ADDING OPTIONAL DEPENDENCIES WHEN BUILDING VERSION 2
|
||||
====================================================
|
||||
Congratulations you have now build a basic GoldenCheetah and can run this
|
||||
safely. See below for optional dependencies you can install to support
|
||||
other features.
|
||||
|
||||
|
||||
2. ADDING OPTIONAL DEPENDENCIES
|
||||
===============================
|
||||
|
||||
D2XX - For Powertap downloads via USB
|
||||
-------------------------------------
|
||||
|
||||
Download the FTDI drivers from http://www.ftdichip.com/Drivers/D2XX.htm (e.g. I used Linux
|
||||
64-bit drivers from http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx1.0.4.tar.gz)
|
||||
Download the FTDI drivers from http://www.ftdichip.com/Drivers/D2XX.htm and
|
||||
extract:
|
||||
|
||||
Extract into your home directory (I put mine into ~/Projects/ with archive manager which
|
||||
created a sub-directory ~/Projects/libftd2xx1.0.4
|
||||
$ cd ~/Projects
|
||||
$ wget http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-x86_64-1.3.6.tgz
|
||||
$ tar xf libftd2xx-x86_64-1.3.6.tgz
|
||||
|
||||
$ cd src
|
||||
$ cd ~/Projects/GoldenCheetah/src
|
||||
$ vi gcconfig.pri
|
||||
|
||||
Uncomment the D2XX_INCLUDE entry and make it match (my home is /home/markl)
|
||||
D2XX_INCLUDE = /home/markl/libftd2xx1.0.4
|
||||
D2XX_INCLUDE = /home/markl/Projects/libftd2xx-x86_64-1.3.6
|
||||
|
||||
Make clean is needed if you have previouslt built, since source files examine #defines before
|
||||
including this feature. You can skip it if you know why ;)
|
||||
Make clean is needed if you have previouslt built, since source files examine
|
||||
#defines before including this feature. You can skip it if you know why ;)
|
||||
$ make clean
|
||||
$ qmake
|
||||
$ make
|
||||
@@ -155,122 +180,30 @@ $ make
|
||||
$ sudo make install
|
||||
|
||||
Lets go config GC and build with SRMIO
|
||||
$ cd ~/Projects/Live/GoldenCheetah/src
|
||||
$ cd ~/Projects/GoldenCheetah/src
|
||||
$ vi gcconfig.pri
|
||||
|
||||
Uncomment the SRMIO_INSTALL and replace with the target used from srmio install:
|
||||
SRMIO_INSTALL = /usr/local/
|
||||
|
||||
At the bottom of gcconfig.pri you will see the include directory should reference from
|
||||
the base install location (/usr/local) make sure it says:
|
||||
At the bottom of gcconfig.pri you will see the include directory should
|
||||
reference from the base install location (/usr/local) make sure it says:
|
||||
|
||||
SRMIO_INCLUDE = $${SRMIO_INSTALL}/include
|
||||
SRMIO_LIB = $${SRMIO_INSTALL}/lib/libsrmio.a
|
||||
|
||||
Make clean is needed if you have previouslt built, since source files examine #defines before
|
||||
including this feature. You can skip it if you know why ;)
|
||||
Make clean is needed if you have previouslt built, since source files examine
|
||||
#defines before including this feature. You can skip it if you know why ;)
|
||||
$ make clean
|
||||
$ qmake
|
||||
$ make
|
||||
|
||||
You now have SRM support built in.
|
||||
|
||||
OAUTH/CRYPT - For Tweet my ride (twitter) support
|
||||
-------------------------------------------------
|
||||
|
||||
You should be able to install liboauth and dependencies
|
||||
directly with:
|
||||
$ sudo apt-get install liboauth-dev
|
||||
|
||||
If this does not work then:
|
||||
|
||||
Download the source from: http://sourceforge.net/projects/liboauth/files/liboauth-0.9.4.tar.gz/download and
|
||||
unpack it into ~/Projects/liboauth-0.9.4 using archive manager
|
||||
|
||||
$ cd ~/Projects/liboauth-0.9.4
|
||||
|
||||
You may find that libcurl is not installed (which liboauth depends upon) so download it
|
||||
from http://curl.haxx.se/download/curl-7.21.6.tar.gz and unpack it into ~/Projects/curl-7.21.6
|
||||
using archive manager to drag and drop into your Projects folder
|
||||
|
||||
$ cd ~/Projects/curl-7.21.6
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
You should now have libcurl and friends installed in /usr/local
|
||||
|
||||
You may find that liboauth also requires the openssl libs installed, these are available
|
||||
pre-packaged thankfully so:
|
||||
$ sudo apt-get install libssl-dev
|
||||
|
||||
This will also install zlibg which liboauth also desires.
|
||||
|
||||
$ cd ~/Projects/liboauth-0.9.4
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
Now we have liboauth and libcurl in /usr/local and libssl in /usr/lib, so we can go back to
|
||||
GoldenCheetah and update the gcconfig.pri to point at the right places:
|
||||
|
||||
$ cd ~/Projects/Live/GoldenCheetah/src
|
||||
$ vi gcconfig.pri
|
||||
|
||||
Make sure the following are set:
|
||||
LIBOAUTH_INSTALL = /usr/local
|
||||
LIBCRYPTO_INSTALL = -lcrypto
|
||||
LIBCURL_INSTALL=-lcurl
|
||||
|
||||
Make clean is needed if you have previously built, since source files examine #defines before
|
||||
including this feature. You can skip it if you know why ;)
|
||||
$ make clean
|
||||
$ qmake
|
||||
$ make
|
||||
|
||||
You can now tweet your rides and amaze your friends, or alternatively tweet your rides but
|
||||
omit to mention average power to hide your weaknesses.
|
||||
|
||||
LIBQWTPLOT3D - For 3D plot
|
||||
--------------------------
|
||||
|
||||
Download the tarball from http://qwtplot3d.svn.sourceforge.net/viewvc/qwtplot3d/branches/maintain_0_2_x/qwtplot3d/?view=tar
|
||||
and unarchive it into your Projects directory using archive manager. There is no version number it just creates a
|
||||
subdirectory called qwtplot3d
|
||||
|
||||
You will need to install libgl and extensions, this can be done with;
|
||||
$ sudo apt-get install libgl1-mesa-dev
|
||||
$ sudo apt-get install libglu-dev
|
||||
|
||||
On Ubuntu 12.10 I also ran
|
||||
$ sudo apt-get install freeglut3 freeglut3-dev
|
||||
|
||||
$ cd ~/Projects/qwtplot3d
|
||||
Edit the qwtplot3d.pri and add
|
||||
CONFIG += staticlib
|
||||
|
||||
You will find that on modern Linuxes you also need to fix include/qwt3d_global.h by adding the line:
|
||||
#include <GL/glu.h>
|
||||
|
||||
then build
|
||||
$ qmake
|
||||
$ make
|
||||
|
||||
Then to let gc know where the qwtplot3d libs are you need to edit gcconfig.pri;
|
||||
$ cd ~/Projects/Live/GoldenCheetah/src
|
||||
$ vi gcconfig.pri
|
||||
|
||||
And uncomment the following line and set the install directory to where you build
|
||||
QWT3D_INSTALL = ~/Projects/qwtplot3d
|
||||
|
||||
|
||||
|
||||
LIBKML - For export to Google Earth
|
||||
-----------------------------------
|
||||
|
||||
You will need Google Earth 5.2 or later and therefore libkml that supports this. Unfortunately at the time of writing
|
||||
the officially packaged libkml is too old, so you will need to install from source, which means you will need to have
|
||||
subversion installed and expat. You may be able to use the currently packaged libkml with
|
||||
You will need Google Earth 5.2 or later and therefore libkml that supports this.
|
||||
|
||||
$ sudo apt-get install libkml-dev
|
||||
|
||||
@@ -279,7 +212,8 @@ if this does not work you will need to build from source:
|
||||
$ sudo apt-get install subversion
|
||||
$ sudo apt-get install expat libexpat1 libexpat1-dev
|
||||
|
||||
Once svn is installed you can grab the libkml source and configure build etc:
|
||||
Once svn is installed you can grab the libkml source, configure, build and
|
||||
install:
|
||||
$ cd ~/Projects
|
||||
$ svn checkout http://libkml.googlecode.com/svn/trunk/ libkml
|
||||
$ cd libkml
|
||||
@@ -296,55 +230,32 @@ if this does not work you will need to build from source:
|
||||
- examples/{engine,gpx,gx,hellonet,helloworld,regionator,xsd}/Makefile
|
||||
- and look for the flag -pedantic and remove it. I got this on Linux 64bit builds ymmv.
|
||||
|
||||
Once libkml is installed and built:
|
||||
Once libkml is installed:
|
||||
|
||||
$ cd ~/Projects/Live/GoldenCheetah/src
|
||||
$ cd ~/Projects/GoldenCheetah/src
|
||||
$ vi gcconfig.pri
|
||||
|
||||
Ensure KML_INSTALL=/usr/local
|
||||
|
||||
Make clean is needed if you have previously built, since source files examine #defines before
|
||||
including this feature. You can skip it if you know why ;)
|
||||
Make clean is needed if you have previously built, since source files examine
|
||||
#defines before including this feature. You can skip it if you know why ;)
|
||||
$ make clean
|
||||
$ qmake
|
||||
$ make
|
||||
|
||||
You can now export rides to Google Earth kml format.
|
||||
|
||||
ADDING OPTIONAL DEPENDENCIES WHEN BUILDING VERSION 3
|
||||
====================================================
|
||||
|
||||
|
||||
NOTE: When you run version 3 it will refresh ride metrics and CP files -- this only occurs the
|
||||
first time it runs (and will refresh only rides that change after that). I find it is best
|
||||
to import ride files once your build where you want it. i.e. don't import until you have
|
||||
got all your dependencies sorted.
|
||||
|
||||
NOTE: To reduce the dependencies on 'dormant' code there are a number of new pieces of source
|
||||
that are included in the release3 tree. Notably; qtsoap from qt-solutions, since they
|
||||
work but are likely to be archived and deprecated. If and when that happens we may well
|
||||
adopt whatever classes Trolltech introduce.
|
||||
|
||||
|
||||
LIBICAL - Diary integration with Google or MobileMe calendars
|
||||
-------------------------------------------------------------
|
||||
|
||||
$ cd ~/Projects/Live/GoldenCheetah/src
|
||||
|
||||
$ sudo apt-get install libical-dev
|
||||
|
||||
$ cd ~/Projects/GoldenCheetah/src
|
||||
$ vi gcconfig.pri
|
||||
|
||||
ICAL_INSTALL=/usr/include
|
||||
ICAL_LIBS=-lical
|
||||
|
||||
Since the src.pro wants ICAL installed in a different place we need to hack it, *** this will
|
||||
be fixed shortly ***
|
||||
|
||||
$ vi src.pro
|
||||
|
||||
Comment out the ICAL_LIBS entry:
|
||||
|
||||
#ICAL_LIBS = $${ICAL_INSTALL}/lib/libical.a
|
||||
ICAL_INSTALL = /usr
|
||||
ICAL_INCLUDE = /usr/include
|
||||
ICAL_LIBS = -lical
|
||||
|
||||
$ make clean
|
||||
$ qmake
|
||||
@@ -352,21 +263,89 @@ $ make
|
||||
|
||||
You should now have diary functions.
|
||||
|
||||
NOTE: That upload to MobileMe and Google requires a functioning https lib in QT. Depending
|
||||
upon the version installed this might not be the case and will need to be built and
|
||||
configured -- this is beyond the scope of this walkthough. Sorry.
|
||||
LIBVLC - Video playback in Realtime
|
||||
-----------------------------------
|
||||
|
||||
LIBVLC - Video playback in Realtime (Experimental)
|
||||
--------------------------------------------------
|
||||
You will need libvlc 3.0.8 or higher for better performance:
|
||||
|
||||
You will need libvlc 1.1.9 or higher (1.1.8 is ok but will segv on exit)
|
||||
$ sudo apt-get install libvlc-dev
|
||||
sudo add-apt-repository ppa:jonathonf/vlc-3
|
||||
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
|
||||
sudo apt-get update
|
||||
sudo apt-get install vlc libvlc-dev libvlccore-dev
|
||||
|
||||
$ cd ~/Projects/GoldenCheetah/src
|
||||
$ vi gcconfig.pri
|
||||
|
||||
Comment out VLC_INSTALL and it should read:
|
||||
|
||||
VLC_INSTALL = /usr/include/vlc/
|
||||
VLC_INSTALL = /usr
|
||||
|
||||
$ make clean
|
||||
$ qmake
|
||||
$ make
|
||||
|
||||
LIBUSB - for using USB2 sticks in Train View on Linux or Windows
|
||||
----------------------------------------------------------------
|
||||
$ sudo apt-get install libusb-1.0-0-dev libudev-dev
|
||||
|
||||
$ cd ~/Projects/GoldenCheetah/src
|
||||
$ vi gcconfig.pri
|
||||
|
||||
Uncomment or add the following lines:
|
||||
|
||||
LIBUSB_USE_V_1 = true # don't use on Windows
|
||||
LIBUSB_INSTALL = /usr/local
|
||||
|
||||
$ make clean
|
||||
$ qmake
|
||||
$ make
|
||||
|
||||
R Embedding
|
||||
-----------
|
||||
|
||||
Install R 4.0
|
||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
|
||||
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/"
|
||||
sudo apt-get update
|
||||
sudo apt-get install r-base-dev
|
||||
R --version
|
||||
|
||||
$ cd ~/Projects/GoldenCheetah/src
|
||||
$ vi gcconfig.pri
|
||||
|
||||
Uncomment or add the following line:
|
||||
DEFINES += GC_WANT_R
|
||||
|
||||
$ make clean
|
||||
$ qmake
|
||||
$ make
|
||||
|
||||
Python Embedding
|
||||
----------------
|
||||
|
||||
Install Python 3.7
|
||||
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
||||
sudo apt-get update
|
||||
sudo apt-get install python3.7-dev
|
||||
python3.7 --version
|
||||
|
||||
Install SIP 4.19.8:
|
||||
cd ~/Projects
|
||||
wget https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.8/sip-4.19.8.tar.gz
|
||||
tar xf sip-4.19.8.tar.gz
|
||||
cd sip-4.19.8
|
||||
python3.7 configure.py
|
||||
make
|
||||
sudo make install
|
||||
|
||||
$ cd ~/Projects/GoldenCheetah/src
|
||||
$ vi gcconfig.pri
|
||||
|
||||
Uncomment or add the following lines:
|
||||
DEFINES += GC_WANT_PYTHON
|
||||
PYTHONINCLUDES = -I/usr/include/python3.7/
|
||||
PYTHONLIBS = -L/usr/lib/python3.7/config-3.7m-x86_64-linux-gnu -lpython3.7m
|
||||
|
||||
$ make clean
|
||||
$ qmake
|
||||
|
||||
52
INSTALL-MAC
52
INSTALL-MAC
@@ -1,3 +1,12 @@
|
||||
Update Note: to build GoldenCheetah v3.6 we are using the Homebrew Package
|
||||
Manager to install dependencies, including Qt and GSL, on Travis-ci
|
||||
macOS High Sierra build environment.
|
||||
You can check the travis/osx folder for the complete and updated build scripts,
|
||||
the minimum Qt version known to work is 5.13 with Qt WebEngine and Qt Charts.
|
||||
GSL - GNU Scientific Library is a mandatory dependency starting with v3.6
|
||||
|
||||
Ale Martinez - May, 2020
|
||||
|
||||
+++++++++++++++++++++++
|
||||
MAC OSX BUILD WALKTHROUGH
|
||||
+++++++++++++++++++++++
|
||||
@@ -20,8 +29,6 @@ CONTENTS
|
||||
2. ADDING OPTIONAL DEPENDENCIES
|
||||
- FTDI D2XX
|
||||
- SRMIO
|
||||
- kQOAuth
|
||||
- QwtPlot3d
|
||||
- libkml
|
||||
- libusb
|
||||
- libical
|
||||
@@ -210,6 +217,11 @@ $ cd .. #this should put you in the top level dir containing this file
|
||||
$ qmake -recursive
|
||||
$ make
|
||||
|
||||
When build first time you get number of error messages on .qm files missing:
|
||||
"RCC: Error in 'Resources/application.qrc': Cannot find file 'translations/gc_fr.qm'"
|
||||
You can ignore these messages for your build. The .qm files will be created during the
|
||||
build at a later point in time via the "lrelease" command you configured in gcconfig.pri)
|
||||
|
||||
If make fails to find a Makefile then qmake is configured, by default, to create
|
||||
an xcode project file. You will need to change the qmake command above to tell it
|
||||
to create a makefile with the following:
|
||||
@@ -223,12 +235,21 @@ $ open src/GoldenCheetah.app
|
||||
|
||||
And you're up and running.
|
||||
|
||||
Now, if you would like to use XCode to debug the project, you can generate
|
||||
the necessary project file.
|
||||
$ qmake --recursive -spec macx-xcode
|
||||
|
||||
This will create a project as: build.xcodeproj Please be sure to build via
|
||||
the standard method before checkin to prevent build errors. If the build
|
||||
fails to launch with "couldn't be opened because you don't have permission
|
||||
to view it" Then a work around would be to open the project and attach
|
||||
the debugger.
|
||||
$ open src/GoldenCheetah.app
|
||||
|
||||
2. ADDING OPTIONAL DEPENDENCIES
|
||||
===============================
|
||||
|
||||
- SRMIO
|
||||
- kQOAuth
|
||||
- QwtPlot3d
|
||||
- libkml
|
||||
- libusb
|
||||
- libical
|
||||
@@ -244,24 +265,7 @@ should be taken into account.
|
||||
SRMIO (git)
|
||||
./configure CFLAGS="-isysroot /Developer/SDKs/MacOSX10.7.sdk -arch x86_64" CPPFLAGS=-I/usr/local/D2XX/ --disable-dependency-tracking
|
||||
|
||||
2.2 kQOAuth - For OAuth Authentication
|
||||
--------------------------------------
|
||||
|
||||
kQOauth (0.98)
|
||||
|
||||
qmake
|
||||
|
||||
|
||||
2.3 QwtPlot3d - For 3d plot support
|
||||
-----------------------------------
|
||||
|
||||
qwtplot3d (maintain_0_2_x)
|
||||
|
||||
Add the following to qwtplot3d.pro:
|
||||
CONFIG += x86_64 static
|
||||
QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.7.sdk
|
||||
|
||||
2.4 libkml - For export to Google Earth
|
||||
2.2 libkml - For export to Google Earth
|
||||
---------------------------------------
|
||||
|
||||
expat (2.0.1)
|
||||
@@ -273,7 +277,7 @@ libkml (pulled down from the svn repo)
|
||||
|
||||
note: the added CXXFLAGS helped clear the -Werror flag that stopped compilation.
|
||||
|
||||
2.5 libusb - For Garmin USB2 stick support
|
||||
2.3 libusb - For Garmin USB2 stick support
|
||||
------------------------------------------
|
||||
|
||||
libusb (0.1.12)
|
||||
@@ -290,7 +294,7 @@ make install
|
||||
|
||||
note: that the sed line updates some commands in libtool. not sure why the arch clags are not getting passed.
|
||||
|
||||
2.6 libical
|
||||
2.4 libical
|
||||
-----------
|
||||
|
||||
libical (0.46)
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
Update Note: to build GoldenCheetah v3.6 we are using Microsoft Visual C++ 2017,
|
||||
included in Microsoft Visual Studio 2019, with pre-installed Qt and GSL
|
||||
insalled with vcpkg, on AppVeyor continuous integration platform.
|
||||
You can check the appveyor.yml for the complete and updated build script,
|
||||
the minimum Qt version known to work is 5.13 with Qt WebEngine and Qt Charts.
|
||||
GSL - GNU Scientific Library is a mandatory dependency starting with v3.6
|
||||
|
||||
Ale Martinez - May, 2020
|
||||
+++++++++++++++++++++++
|
||||
WIN32 BUILD WALKTHROUGH
|
||||
+++++++++++++++++++++++
|
||||
@@ -7,6 +14,7 @@
|
||||
|
||||
February 2017
|
||||
|
||||
|
||||
This instruction will guide you through a standard build of GoldenCheetah (without external
|
||||
dependencies or API based services included).
|
||||
|
||||
@@ -157,12 +165,6 @@ Info: I plan to provide a pre-compiled set of the dependencies for the Windows v
|
||||
The version currently used is: "CDM v2.10.00 WHQL Certified" - while there are more recent
|
||||
version available for download.
|
||||
|
||||
- Qt Oauth library - kQoAuth
|
||||
-- Is part of the official build as a .dll - build is done with Qt - the build uses Release 0.98
|
||||
|
||||
- Qt 3D plotting - qwtplot3d
|
||||
-- Is part of the official build as a static lib - build is done with Qt - the build uses Release 0.3.0
|
||||
|
||||
- Google Earth .kml files (export)
|
||||
-- Is part of the official build as a static lib - build is done with MSVC2015 - the build uses Release 1.2
|
||||
(path of source code has changed to https://github.com/google/libkml)
|
||||
@@ -185,7 +187,7 @@ Info: I plan to provide a pre-compiled set of the dependencies for the Windows v
|
||||
|
||||
Building with integration to external services (via APIs)
|
||||
|
||||
As of today a number of integrations with external services like Twitter, Strava, Cyclinganalytics,
|
||||
As of today a number of integrations with external services like Strava, Cyclinganalytics,
|
||||
Google Calendar, Dropbox, Today's Plan, Google Drive, CloudDB) exist in the official GoldenCheetah
|
||||
builds. The permission to use API's of such services requires a dedicated registration (in this case
|
||||
for "GoldenCheetah" as the consumer of the services) where in return the GoldenCheetah team get's
|
||||
@@ -205,10 +207,3 @@ to contribute is to provide a pull-request.
|
||||
|
||||
Cheers.
|
||||
Joern
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
10
ISSUE_TEMPLATE.md
Normal file
10
ISSUE_TEMPLATE.md
Normal file
@@ -0,0 +1,10 @@
|
||||
Issue tracker is **only** for Bugs and Features, please don't open issues for questions or technical support. Before to open a new issue please read the contributing guidelines (link below).
|
||||
|
||||
If you have questions, please read the FAQs and User's/Developer's Guide:
|
||||
* FAQs - https://github.com/GoldenCheetah/GoldenCheetah/wiki/FAQ
|
||||
* User's Guide - https://github.com/GoldenCheetah/GoldenCheetah/wiki/UG_Main-Page_Users-Guide
|
||||
* Developer's Guide - https://github.com/GoldenCheetah/GoldenCheetah/wiki/Developers-guide
|
||||
|
||||
If you need help or technical support please use the forums:
|
||||
* Users - https://groups.google.com/forum/#!forum/golden-cheetah-users
|
||||
* Developers - https://groups.google.com/forum/#!forum/golden-cheetah-developers
|
||||
22
README.md
22
README.md
@@ -1,19 +1,31 @@
|
||||
<img src="src/Resources/images/gc.png" height="25%" width="25%">
|
||||
|
||||
# GoldenCheetah
|
||||
|
||||
## About
|
||||
|
||||
GoldenCheetah is a desktop application for cyclists and triathletes and coaches, providing a rich set of tools and models to analyse, track and predict performance, optimise aerodynamics and train indoors.
|
||||
|
||||
GoldenCheetah integrates with most popular cloud services like Strava and Todays Plan, imports data from bike computers, imports downloads from any website like TrainingPeaks and Garmin and will also connect to smart trainers using ANT+ and Bluetooth.
|
||||
|
||||
GoldenCheetah is free for everyone to use and modify, released under the GPL v2 open source license with pre-built binaries for Mac, Windows and Linux.
|
||||
|
||||
## Installing
|
||||
|
||||
Golden Cheetah install and build instructions are documented
|
||||
for each platform;
|
||||
|
||||
INSTALL-WIN32 For building on Microsoft Windows
|
||||
|
||||
INSTALL-LINUX For building on Ubuntu Linux
|
||||
INSTALL-LINUX For building on Linux
|
||||
|
||||
INSTALL-MAC For building on Apple OS X
|
||||
|
||||
|
||||
OSX: [](https://travis-ci.org/GoldenCheetah/GoldenCheetah)
|
||||
macOS and Linux: [](https://travis-ci.org/GoldenCheetah/GoldenCheetah)
|
||||
|
||||
Windows: [](https://ci.appveyor.com/project/Joern-R/goldencheetah-knhd8)
|
||||
|
||||
[](https://scan.coverity.com/projects/goldencheetah-goldencheetah)
|
||||
|
||||
Alternatively official builds are available from http://www.goldencheetah.org
|
||||
|
||||
whilst latest developer builds are available from https://github.com/GoldenCheetah/GoldenCheetah/releases
|
||||
Official release builds, snapshots and development builds are all available from http://www.goldencheetah.org
|
||||
|
||||
219
appveyor.yml
219
appveyor.yml
@@ -1,32 +1,213 @@
|
||||
version: ci.{build}
|
||||
image: Visual Studio 2015
|
||||
image: Visual Studio 2019
|
||||
clone_depth: 1
|
||||
|
||||
environment:
|
||||
GC_GOOGLE_CALENDAR_CLIENT_SECRET:
|
||||
secure: hwjHTrSAMEbKd9PA+5x/zI4x5Uk4KQm1hdfZzkwiu8k=
|
||||
GC_GOOGLE_DRIVE_CLIENT_ID:
|
||||
secure: mNqG+pqpMl21ZFVvAMKvhm2rfOdv42fFpnLwfrvX5QqpWVcHEeBuUFeJeUAZfTR0GQGfWfPOEmhb9CG0W1ZJ05TIyb+kTLrWF7iijCiVR6s=
|
||||
GC_GOOGLE_DRIVE_CLIENT_SECRET:
|
||||
secure: T+BaB/L7x4dPPf592e0kfw4sTlAslUXl10irJqiUjpY=
|
||||
GC_GOOGLE_DRIVE_API_KEY:
|
||||
secure: oxTAhK/kiLUsXdYvITAgzSqeB5FRcL+XANFuAYpoW5P/xBb7XaLbNnL2gyrmzQeG
|
||||
GC_CLOUD_OPENDATA_SECRET:
|
||||
secure: 6fPhBiHKvJeOMqXdHGqpkPS+NpUDMczEXjedx8GcjbHr82ISX+gwSuXfOUDLq/S9
|
||||
GC_WITHINGS_CONSUMER_SECRET:
|
||||
secure: 86xAkdoQB8mLXq964/lGCp3ElTSF4k3a27R3UUXt3618guWLyBfsEK5Q0+XSOI3Q38w80CTpmNdwejoISv8Ilg==
|
||||
GC_NOKIA_CLIENT_SECRET:
|
||||
secure: pvPWraDplrKeRNamt5MKga8fzDmI2+zgFx+y3lsQE6gmBadZU2xkTIc/xCaP7UPv2erNCmKivfMOh2NIcRmqvIHynDoifNVy2P61KyG5v3E=
|
||||
GC_DROPBOX_CLIENT_SECRET:
|
||||
secure: 7pCVnVEKKmSU4SZN6IFqUw==
|
||||
GC_STRAVA_CLIENT_SECRET:
|
||||
secure: n3cMS1yy709xhSnTeWABMsoAIkJzy5euh3Pw4ehv0BzszJKoWkypF0cyW8RXSm3M
|
||||
GC_TODAYSPLAN_CLIENT_SECRET:
|
||||
secure: 7PnFB8cfahFT6LyP64eB7N1vkbwVaULpB2ORmEkn+J75zNB1xxGClFNXSHZ7kXhB
|
||||
GC_CYCLINGANALYTICS_CLIENT_SECRET:
|
||||
secure: UY+m3YypNNLUzKyGdrLw8xdCvxuQWRZi9EHS3j1ubLC4qyRL7iEVW6ubumfdh6gT
|
||||
GC_CLOUD_DB_BASIC_AUTH:
|
||||
secure: OEBetrOnXjsY7wN8hYqmMj6482oDORmAmCq8PI7mfnfiWE6Z4jB676JvgdNlP98q
|
||||
GC_CLOUD_DB_APP_NAME:
|
||||
secure: bpkyuw/BsJw0OrpuBqQwZ46CHbhkbmcjcMttVtfJoZU=
|
||||
GC_POLARFLOW_CLIENT_SECRET:
|
||||
secure: h2JdlC1i4QOmwpkz+Xxbrw==
|
||||
GC_SPORTTRACKS_CLIENT_SECRET:
|
||||
secure: n6a8nJgqMyg+VsVeoIIR8TFzxyDFVi2w/ggetQk5agY=
|
||||
|
||||
init:
|
||||
# Setup QT 5.8.0 - 64Bit
|
||||
|
||||
- set QTDIR=C:\Qt\5.8\msvc2015_64
|
||||
# Setup QT 5.14 - 64Bit
|
||||
- set QTDIR=C:\Qt\5.14\msvc2017_64
|
||||
- set PATH=%QTDIR%\bin;%PATH%
|
||||
- qmake --version
|
||||
|
||||
# Setup MSVC - VS 2015
|
||||
# Setup MSVC - VS 2019
|
||||
- call c:\"Program Files (x86)"\"Microsoft Visual Studio"\2019\Community\VC\Auxiliary\Build\vcvarsall.bat amd64
|
||||
|
||||
- CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
# Setup NSIS
|
||||
- set PATH=%PATH%;C:\"Program Files (x86)"\NSIS
|
||||
|
||||
# Get the libraries
|
||||
|
||||
- ps: Start-FileDownload 'https://github.com/Joern-R/gc-ci-libs/releases/download/0.0.2/gc-ci-libs.zip' -Filename 'c:/gc-ci-libs.zip'
|
||||
- 7z x c:/gc-ci-libs.zip -oC:\libs
|
||||
cache:
|
||||
- gc-ci-libs.zip -> appveyor.yml
|
||||
- jom_1_1_3.zip
|
||||
- sip-4.19.8.zip
|
||||
- C:\R
|
||||
- C:\Python -> src\Python\requirements.txt
|
||||
- c:\tools\vcpkg\installed\
|
||||
- qwt
|
||||
|
||||
install:
|
||||
# choco install winflexbison
|
||||
# Get the libraries
|
||||
- if not exist gc-ci-libs.zip appveyor DownloadFile "https://github.com/GoldenCheetah/WindowsSDK/releases/download/v0.1.1/gc-ci-libs.zip"
|
||||
- 7z x -y gc-ci-libs.zip -oC:\libs
|
||||
# GSL
|
||||
- vcpkg install gsl:x64-windows
|
||||
|
||||
# Get config
|
||||
- copy qwt\qwtconfig.pri.in qwt\qwtconfig.pri
|
||||
- copy c:\libs\gcconfig64-Release.appveyor.pri src\gcconfig.pri
|
||||
|
||||
build_script:
|
||||
- qmake.exe build.pro -r -spec win32-msvc2015
|
||||
- nmake
|
||||
# Get jom
|
||||
- if not exist jom_1_1_3.zip appveyor DownloadFile "https://download.qt.io/official_releases/jom/jom_1_1_3.zip"
|
||||
- 7z x -y jom_1_1_3.zip -oc:\jom\
|
||||
- set PATH=%PATH%;c:\jom\;
|
||||
|
||||
#notifications:
|
||||
#- provider: GitHubPullRequest
|
||||
# on_build_success: true
|
||||
# on_build_failure: true
|
||||
# on_build_status_changed: true
|
||||
# Get R and add to config
|
||||
- ps: >-
|
||||
if (-not (Test-Path 'C:\R')) {
|
||||
$rurl = $(ConvertFrom-JSON $(Invoke-WebRequest https://rversions.r-pkg.org/r-release-win).Content).URL
|
||||
Start-FileDownload $rurl "R-win.exe"
|
||||
Start-Process -FilePath .\R-win.exe -ArgumentList "/VERYSILENT /DIR=C:\R" -NoNewWindow -Wait
|
||||
}
|
||||
- set PATH=%PATH%;c:\R\bin\;
|
||||
- R --version
|
||||
- echo DEFINES+=GC_WANT_R >> src\gcconfig.pri
|
||||
|
||||
# Get Python embeddable and install packages
|
||||
- ps: >-
|
||||
if (-not (Test-Path 'C:\Python')) {
|
||||
Start-FileDownload "https://www.python.org/ftp/python/3.7.9/python-3.7.9-embed-amd64.zip" Python.zip
|
||||
7z x Python.zip -oC:\Python\
|
||||
echo python37.zip . '' 'import site' | Out-File C:\Python\python37._pth -Encoding ascii
|
||||
mkdir C:\Python\lib\site-packages
|
||||
c:\python37-x64\python -m pip install --upgrade pip
|
||||
c:\python37-x64\python -m pip install -r src\Python\requirements.txt -t C:\Python\lib\site-packages
|
||||
}
|
||||
|
||||
# Get SIP and and install on Python
|
||||
- c:\python37-x64\python --version
|
||||
- if not exist sip-4.19.8.zip appveyor DownloadFile "https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.8/sip-4.19.8.zip"
|
||||
- 7z x sip-4.19.8.zip
|
||||
- cd sip-4.19.8
|
||||
- c:\python37-x64\python configure.py
|
||||
- jom -j4
|
||||
- nmake install
|
||||
- cd ..
|
||||
|
||||
# Add Python (avoiding colision between GC Context.h and Python context.h)
|
||||
- echo DEFINES+=GC_WANT_PYTHON >> src\gcconfig.pri
|
||||
- echo PYTHONINCLUDES=-ICore -I\"c:\python37-x64\include\" >> src\gcconfig.pri
|
||||
- echo PYTHONLIBS=-L\"c:\python37-x64\libs\" -lpython37 >> src\gcconfig.pri
|
||||
|
||||
# GSL
|
||||
- echo GSL_INCLUDES=c:\tools\vcpkg\installed\x64-windows\include >> src\gcconfig.pri
|
||||
- echo GSL_LIBS=-Lc:\tools\vcpkg\installed\x64-windows\lib -lgsl -lgslcblas >> src\gcconfig.pri
|
||||
|
||||
before_build:
|
||||
# Define GC version string, only for tagged builds
|
||||
- if %APPVEYOR_REPO_TAG%==true echo DEFINES+=GC_VERSION=VERSION_STRING >> src\gcconfig.pri
|
||||
|
||||
# Enable CloudDB
|
||||
- echo CloudDB=active >> src\gcconfig.pri
|
||||
|
||||
# Add Train Robot
|
||||
- echo DEFINES+=GC_WANT_ROBOT >> src\gcconfig.pri
|
||||
|
||||
# Add debug console
|
||||
#- echo CONFIG+=console >> src\gcconfig.pri
|
||||
|
||||
# Patch Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_GOOGLE_CALENDAR_CLIENT_SECRET__', $env:GC_GOOGLE_CALENDAR_CLIENT_SECRET | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_GOOGLE_DRIVE_CLIENT_ID__', $env:GC_GOOGLE_DRIVE_CLIENT_ID | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_GOOGLE_DRIVE_CLIENT_SECRET__', $env:GC_GOOGLE_DRIVE_CLIENT_SECRET | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_GOOGLE_DRIVE_API_KEY__', $env:GC_GOOGLE_DRIVE_API_KEY | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace 'OPENDATA_DISABLE', 'OPENDATA_ENABLE' | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_CLOUD_OPENDATA_SECRET__', $env:GC_CLOUD_OPENDATA_SECRET | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_WITHINGS_CONSUMER_SECRET__', $env:GC_WITHINGS_CONSUMER_SECRET | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_NOKIA_CLIENT_SECRET__', $env:GC_NOKIA_CLIENT_SECRET | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_DROPBOX_CLIENT_SECRET__', $env:GC_DROPBOX_CLIENT_SECRET | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_STRAVA_CLIENT_SECRET__', $env:GC_STRAVA_CLIENT_SECRET | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_TODAYSPLAN_CLIENT_SECRET__', $env:GC_TODAYSPLAN_CLIENT_SECRET | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_CYCLINGANALYTICS_CLIENT_SECRET__', $env:GC_CYCLINGANALYTICS_CLIENT_SECRET | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_CLOUD_DB_BASIC_AUTH__', $env:GC_CLOUD_DB_BASIC_AUTH | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_CLOUD_DB_APP_NAME__', $env:GC_CLOUD_DB_APP_NAME | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_POLARFLOW_CLIENT_SECRET__', $env:GC_POLARFLOW_CLIENT_SECRET | Set-Content src\Core\Secrets.h
|
||||
- ps: (Get-Content src\Core\Secrets.h) -replace '__GC_SPORTTRACKS_CLIENT_SECRET__', $env:GC_SPORTTRACKS_CLIENT_SECRET | Set-Content src\Core\Secrets.h
|
||||
|
||||
build_script:
|
||||
- qmake.exe build.pro -r -spec win32-msvc
|
||||
- cd qwt\
|
||||
- jom -j1
|
||||
- cd ..
|
||||
- jom -j4
|
||||
|
||||
after_build:
|
||||
- cd src\release
|
||||
|
||||
# copy dependencies
|
||||
- windeployqt --release GoldenCheetah.exe
|
||||
- copy c:\libs\10_Precompiled_DLL\usbexpress_3.5.1\USBXpress\USBXpress_API\Host\x64\SiUSBXp.dll
|
||||
- copy c:\libs\10_Precompiled_DLL\libsamplerate64\lib\libsamplerate-0.dll
|
||||
- copy c:\libs\10_Precompiled_DLL\VLC\win64\lib\libvlc*.dll
|
||||
- xcopy /s /i /e /q c:\libs\10_Precompiled_DLL\VLC\win64\plugins plugins
|
||||
- copy c:\OpenSSL-v111-Win64\bin\lib*.dll
|
||||
- copy c:\OpenSSL-v111-Win64\license.txt "OpenSSL License.txt"
|
||||
- xcopy /s /i /e /q C:\Python .
|
||||
- copy C:\Python\LICENSE.txt "PYTHON LICENSE.txt"
|
||||
- copy c:\tools\vcpkg\installed\x64-windows\bin\gsl*.dll
|
||||
|
||||
# ReadMe, license and icon files
|
||||
- copy ..\Resources\win32\ReadMe.txt
|
||||
- echo GoldenCheetah is licensed under the GNU General Public License v2 > license.txt
|
||||
- echo. >> license.txt
|
||||
- type ..\..\COPYING >> license.txt
|
||||
- copy ..\Resources\win32\gc.ico
|
||||
|
||||
# Installer script
|
||||
- copy ..\Resources\win32\GC3.6-Dev-Master-W64-QT5.14.2.nsi
|
||||
|
||||
# Build the installer
|
||||
- makensis GC3.6-Dev-Master-W64-QT5.14.2.nsi
|
||||
- move GoldenCheetah_v3.6-DEV_64bit_Windows.exe ..\..\GoldenCheetah_v3.6-DEV_x64.exe
|
||||
- cd ..\..
|
||||
- ps: Set-AppveyorBuildVariable -Name 'PUBLISH_BINARIES' -Value false
|
||||
- ps: if ($env:APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED -Match "\[publish binaries\]") { Set-AppveyorBuildVariable -Name 'PUBLISH_BINARIES' -Value true }
|
||||
|
||||
test_script:
|
||||
# minimum test
|
||||
- src\release\GoldenCheetah --version 2>GCversionWindows.txt
|
||||
- git log -1 >> GCversionWindows.txt
|
||||
- ps: CertUtil -hashfile GoldenCheetah_v3.6-DEV_x64.exe sha256 | Select-Object -First 2 | Add-Content GCversionWindows.txt
|
||||
- type GCversionWindows.txt
|
||||
|
||||
artifacts:
|
||||
- path: GoldenCheetah_v3.6-DEV_x64.exe
|
||||
name: GCinstaller
|
||||
- path: GCversionWindows.txt
|
||||
name: GCversionWindows
|
||||
|
||||
deploy:
|
||||
# deploy continuous builds to s3
|
||||
- provider: S3
|
||||
access_key_id:
|
||||
secure: RoEkfKfOnF7JHOiLZX5qfZM08X+bu4oaDzzSKgdooNM=
|
||||
secret_access_key:
|
||||
secure: GPAArawatirYwgpHJBthdrbvyFU5bBzPOdK7VYYPiG2YHYi/DNJZ5Q5qGK1A440p
|
||||
bucket: goldencheetah-binaries
|
||||
region: us-east-1
|
||||
remove_files: true
|
||||
set_public: true
|
||||
folder: Windows
|
||||
artifact: GCinstaller, GCversionWindows
|
||||
on:
|
||||
PUBLISH_BINARIES: true
|
||||
APPVEYOR_REPO_NAME: "GoldenCheetah/GoldenCheetah"
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = qwt
|
||||
unix:!macx {
|
||||
SUBDIRS += kqoauth
|
||||
}
|
||||
SUBDIRS += src
|
||||
CONFIG += ordered
|
||||
|
||||
4613
contrib/boost/GeometricTools_BSplineCurve.h
Normal file
4613
contrib/boost/GeometricTools_BSplineCurve.h
Normal file
File diff suppressed because it is too large
Load Diff
75
contrib/levmar/Axb.c
Normal file
75
contrib/levmar/Axb.c
Normal file
@@ -0,0 +1,75 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Solution of linear systems involved in the Levenberg - Marquardt
|
||||
// minimization algorithm
|
||||
// Copyright (C) 2004 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/********************************************************************************
|
||||
* LAPACK-based implementations for various linear system solvers. The same core
|
||||
* code is used with appropriate #defines to derive single and double precision
|
||||
* solver versions, see also Axb_core.c
|
||||
********************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "levmar.h"
|
||||
#include "misc.h"
|
||||
|
||||
#if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC)
|
||||
#error At least one of LM_DBL_PREC, LM_SNGL_PREC should be defined!
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LM_DBL_PREC
|
||||
/* double precision definitions */
|
||||
#define LM_REAL double
|
||||
#define LM_PREFIX d
|
||||
#define LM_CNST(x) (x)
|
||||
#ifndef HAVE_LAPACK
|
||||
#include <float.h>
|
||||
#define LM_REAL_EPSILON DBL_EPSILON
|
||||
#endif
|
||||
|
||||
#include "Axb_core.c"
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_CNST
|
||||
#undef LM_REAL_EPSILON
|
||||
#endif /* LM_DBL_PREC */
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
/* single precision (float) definitions */
|
||||
#define LM_REAL float
|
||||
#define LM_PREFIX s
|
||||
#define __SUBCNST(x) x##F
|
||||
#define LM_CNST(x) __SUBCNST(x) // force substitution
|
||||
#ifndef HAVE_LAPACK
|
||||
#define LM_REAL_EPSILON FLT_EPSILON
|
||||
#endif
|
||||
|
||||
#include "Axb_core.c"
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef __SUBCNST
|
||||
#undef LM_CNST
|
||||
#undef LM_REAL_EPSILON
|
||||
#endif /* LM_SNGL_PREC */
|
||||
1282
contrib/levmar/Axb_core.c
Normal file
1282
contrib/levmar/Axb_core.c
Normal file
File diff suppressed because it is too large
Load Diff
49
contrib/levmar/compiler.h
Normal file
49
contrib/levmar/compiler.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2004 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _COMPILER_H_
|
||||
#define _COMPILER_H_
|
||||
|
||||
/* note: intel's icc defines both __ICC & __INTEL_COMPILER.
|
||||
* Also, some compilers other than gcc define __GNUC__,
|
||||
* therefore gcc should be checked last
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#define inline __inline // MSVC
|
||||
#elif !defined(__ICC) && !defined(__INTEL_COMPILER) && !defined(__GNUC__)
|
||||
#define inline // other than MSVC, ICC, GCC: define empty
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define LM_FINITE _finite // MSVC
|
||||
#elif defined(__ICC) || defined(__INTEL_COMPILER) || defined(__GNUC__)
|
||||
#define LM_FINITE finite // ICC, GCC
|
||||
#else
|
||||
#define LM_FINITE finite // other than MSVC, ICC, GCC, let's hope this will work
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define LM_ISINF(x) (!_finite(x) && !_isnan(x)) // MSVC
|
||||
#elif defined(__ICC) || defined(__INTEL_COMPILER) || defined(__GNUC__)
|
||||
#define LM_ISINF(x) isinf(x) // ICC, GCC
|
||||
#else
|
||||
#define LM_ISINF(x) isinf(x) // other than MSVC, ICC, GCC, let's hope this will work
|
||||
#endif
|
||||
|
||||
#endif /* _COMPILER_H_ */
|
||||
398
contrib/levmar/levmar.h
Normal file
398
contrib/levmar/levmar.h
Normal file
@@ -0,0 +1,398 @@
|
||||
/*
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Prototypes and definitions for the Levenberg - Marquardt minimization algorithm
|
||||
// Copyright (C) 2004 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
*/
|
||||
|
||||
#ifndef _LEVMAR_H_
|
||||
#define _LEVMAR_H_
|
||||
|
||||
/************************************* Start of configuration options *************************************/
|
||||
/* Note that when compiling with CMake, this configuration section is automatically generated
|
||||
* based on the user's input, see levmar.h.in
|
||||
*/
|
||||
|
||||
/* specifies whether to use LAPACK or not. Using LAPACK is strongly recommended */
|
||||
//#define HAVE_LAPACK
|
||||
|
||||
/* specifies whether the PLASMA parallel library for multicore CPUs is available */
|
||||
/* #undef HAVE_PLASMA */
|
||||
|
||||
/* to avoid the overhead of repeated mallocs(), routines in Axb.c can be instructed to
|
||||
* retain working memory between calls. Such a choice, however, renders these routines
|
||||
* non-reentrant and is not safe in a shared memory multiprocessing environment.
|
||||
* Bellow, an attempt is made to issue a warning if this option is turned on and OpenMP
|
||||
* is being used (note that this will work only if omp.h is included before levmar.h)
|
||||
*/
|
||||
#define LINSOLVERS_RETAIN_MEMORY
|
||||
#if (defined(_OPENMP))
|
||||
# ifdef LINSOLVERS_RETAIN_MEMORY
|
||||
# ifdef _MSC_VER
|
||||
# pragma message("LINSOLVERS_RETAIN_MEMORY is not safe in a multithreaded environment and should be turned off!")
|
||||
# else
|
||||
# warning LINSOLVERS_RETAIN_MEMORY is not safe in a multithreaded environment and should be turned off!
|
||||
# endif /* _MSC_VER */
|
||||
# endif /* LINSOLVERS_RETAIN_MEMORY */
|
||||
#endif /* _OPENMP */
|
||||
|
||||
/* specifies whether double precision routines will be compiled or not */
|
||||
#define LM_DBL_PREC
|
||||
/* specifies whether single precision routines will be compiled or not */
|
||||
#define LM_SNGL_PREC
|
||||
|
||||
/****************** End of configuration options, no changes necessary beyond this point ******************/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* work arrays size for ?levmar_der and ?levmar_dif functions.
|
||||
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
|
||||
*/
|
||||
#define LM_DER_WORKSZ(npar, nmeas) (2*(nmeas) + 4*(npar) + (nmeas)*(npar) + (npar)*(npar))
|
||||
#define LM_DIF_WORKSZ(npar, nmeas) (4*(nmeas) + 4*(npar) + (nmeas)*(npar) + (npar)*(npar))
|
||||
|
||||
/* work arrays size for ?levmar_bc_der and ?levmar_bc_dif functions.
|
||||
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
|
||||
*/
|
||||
#define LM_BC_DER_WORKSZ(npar, nmeas) (2*(nmeas) + 4*(npar) + (nmeas)*(npar) + (npar)*(npar))
|
||||
#define LM_BC_DIF_WORKSZ(npar, nmeas) LM_BC_DER_WORKSZ((npar), (nmeas)) /* LEVMAR_BC_DIF currently implemented using LEVMAR_BC_DER()! */
|
||||
|
||||
/* work arrays size for ?levmar_lec_der and ?levmar_lec_dif functions.
|
||||
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
|
||||
*/
|
||||
#define LM_LEC_DER_WORKSZ(npar, nmeas, nconstr) LM_DER_WORKSZ((npar)-(nconstr), (nmeas))
|
||||
#define LM_LEC_DIF_WORKSZ(npar, nmeas, nconstr) LM_DIF_WORKSZ((npar)-(nconstr), (nmeas))
|
||||
|
||||
/* work arrays size for ?levmar_blec_der and ?levmar_blec_dif functions.
|
||||
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
|
||||
*/
|
||||
#define LM_BLEC_DER_WORKSZ(npar, nmeas, nconstr) LM_LEC_DER_WORKSZ((npar), (nmeas)+(npar), (nconstr))
|
||||
#define LM_BLEC_DIF_WORKSZ(npar, nmeas, nconstr) LM_LEC_DIF_WORKSZ((npar), (nmeas)+(npar), (nconstr))
|
||||
|
||||
/* work arrays size for ?levmar_bleic_der and ?levmar_bleic_dif functions.
|
||||
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
|
||||
*/
|
||||
#define LM_BLEIC_DER_WORKSZ(npar, nmeas, nconstr1, nconstr2) LM_BLEC_DER_WORKSZ((npar)+(nconstr2), (nmeas)+(nconstr2), (nconstr1)+(nconstr2))
|
||||
#define LM_BLEIC_DIF_WORKSZ(npar, nmeas, nconstr1, nconstr2) LM_BLEC_DIF_WORKSZ((npar)+(nconstr2), (nmeas)+(nconstr2), (nconstr1)+(nconstr2))
|
||||
|
||||
#define LM_OPTS_SZ 5 /* max(4, 5) */
|
||||
#define LM_INFO_SZ 10
|
||||
#define LM_ERROR -1
|
||||
#define LM_INIT_MU 1E-03
|
||||
#define LM_STOP_THRESH 1E-17
|
||||
#define LM_DIFF_DELTA 1E-06
|
||||
#define LM_VERSION "2.6 (November 2011)"
|
||||
|
||||
#ifdef LM_DBL_PREC
|
||||
/* double precision LM, with & without Jacobian */
|
||||
/* unconstrained minimization */
|
||||
extern int dlevmar_der(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
void (*jacf)(double *p, double *j, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, int itmax, double *opts,
|
||||
double *info, double *work, double *covar, void *adata);
|
||||
|
||||
extern int dlevmar_dif(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, int itmax, double *opts,
|
||||
double *info, double *work, double *covar, void *adata);
|
||||
|
||||
/* box-constrained minimization */
|
||||
extern int dlevmar_bc_der(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
void (*jacf)(double *p, double *j, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *lb, double *ub, double *dscl,
|
||||
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
|
||||
|
||||
extern int dlevmar_bc_dif(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *lb, double *ub, double *dscl,
|
||||
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
|
||||
|
||||
#ifdef HAVE_LAPACK
|
||||
/* linear equation constrained minimization */
|
||||
extern int dlevmar_lec_der(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
void (*jacf)(double *p, double *j, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *A, double *b, int k,
|
||||
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
|
||||
|
||||
extern int dlevmar_lec_dif(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *A, double *b, int k,
|
||||
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
|
||||
|
||||
/* box & linear equation constrained minimization */
|
||||
extern int dlevmar_blec_der(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
void (*jacf)(double *p, double *j, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *lb, double *ub, double *A, double *b, int k, double *wghts,
|
||||
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
|
||||
|
||||
extern int dlevmar_blec_dif(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *lb, double *ub, double *A, double *b, int k, double *wghts,
|
||||
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
|
||||
|
||||
/* box, linear equations & inequalities constrained minimization */
|
||||
extern int dlevmar_bleic_der(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
void (*jacf)(double *p, double *j, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *lb, double *ub,
|
||||
double *A, double *b, int k1, double *C, double *d, int k2,
|
||||
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
|
||||
|
||||
extern int dlevmar_bleic_dif(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *lb, double *ub,
|
||||
double *A, double *b, int k1, double *C, double *d, int k2,
|
||||
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
|
||||
|
||||
/* box & linear inequality constraints */
|
||||
extern int dlevmar_blic_der(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
void (*jacf)(double *p, double *j, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *lb, double *ub, double *C, double *d, int k2,
|
||||
int itmax, double opts[4], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
|
||||
|
||||
extern int dlevmar_blic_dif(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *lb, double *ub, double *C, double *d, int k2,
|
||||
int itmax, double opts[5], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
|
||||
|
||||
/* linear equation & inequality constraints */
|
||||
extern int dlevmar_leic_der(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
void (*jacf)(double *p, double *j, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *A, double *b, int k1, double *C, double *d, int k2,
|
||||
int itmax, double opts[4], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
|
||||
|
||||
extern int dlevmar_leic_dif(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *A, double *b, int k1, double *C, double *d, int k2,
|
||||
int itmax, double opts[5], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
|
||||
|
||||
/* linear inequality constraints */
|
||||
extern int dlevmar_lic_der(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
void (*jacf)(double *p, double *j, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *C, double *d, int k2,
|
||||
int itmax, double opts[4], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
|
||||
|
||||
extern int dlevmar_lic_dif(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
double *p, double *x, int m, int n, double *C, double *d, int k2,
|
||||
int itmax, double opts[5], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
#endif /* LM_DBL_PREC */
|
||||
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
/* single precision LM, with & without Jacobian */
|
||||
/* unconstrained minimization */
|
||||
extern int slevmar_der(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
void (*jacf)(float *p, float *j, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, int itmax, float *opts,
|
||||
float *info, float *work, float *covar, void *adata);
|
||||
|
||||
extern int slevmar_dif(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, int itmax, float *opts,
|
||||
float *info, float *work, float *covar, void *adata);
|
||||
|
||||
/* box-constrained minimization */
|
||||
extern int slevmar_bc_der(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
void (*jacf)(float *p, float *j, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *lb, float *ub, float *dscl,
|
||||
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
|
||||
|
||||
extern int slevmar_bc_dif(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *lb, float *ub, float *dscl,
|
||||
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
|
||||
|
||||
#ifdef HAVE_LAPACK
|
||||
/* linear equation constrained minimization */
|
||||
extern int slevmar_lec_der(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
void (*jacf)(float *p, float *j, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *A, float *b, int k,
|
||||
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
|
||||
|
||||
extern int slevmar_lec_dif(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *A, float *b, int k,
|
||||
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
|
||||
|
||||
/* box & linear equation constrained minimization */
|
||||
extern int slevmar_blec_der(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
void (*jacf)(float *p, float *j, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *lb, float *ub, float *A, float *b, int k, float *wghts,
|
||||
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
|
||||
|
||||
extern int slevmar_blec_dif(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *lb, float *ub, float *A, float *b, int k, float *wghts,
|
||||
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
|
||||
|
||||
/* box, linear equations & inequalities constrained minimization */
|
||||
extern int slevmar_bleic_der(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
void (*jacf)(float *p, float *j, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *lb, float *ub,
|
||||
float *A, float *b, int k1, float *C, float *d, int k2,
|
||||
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
|
||||
|
||||
extern int slevmar_bleic_dif(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *lb, float *ub,
|
||||
float *A, float *b, int k1, float *C, float *d, int k2,
|
||||
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
|
||||
|
||||
/* box & linear inequality constraints */
|
||||
extern int slevmar_blic_der(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
void (*jacf)(float *p, float *j, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *lb, float *ub, float *C, float *d, int k2,
|
||||
int itmax, float opts[4], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
|
||||
|
||||
extern int slevmar_blic_dif(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *lb, float *ub, float *C, float *d, int k2,
|
||||
int itmax, float opts[5], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
|
||||
|
||||
/* linear equality & inequality constraints */
|
||||
extern int slevmar_leic_der(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
void (*jacf)(float *p, float *j, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *A, float *b, int k1, float *C, float *d, int k2,
|
||||
int itmax, float opts[4], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
|
||||
|
||||
extern int slevmar_leic_dif(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *A, float *b, int k1, float *C, float *d, int k2,
|
||||
int itmax, float opts[5], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
|
||||
|
||||
/* linear inequality constraints */
|
||||
extern int slevmar_lic_der(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
void (*jacf)(float *p, float *j, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *C, float *d, int k2,
|
||||
int itmax, float opts[4], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
|
||||
|
||||
extern int slevmar_lic_dif(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, float *C, float *d, int k2,
|
||||
int itmax, float opts[5], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
#endif /* LM_SNGL_PREC */
|
||||
|
||||
/* linear system solvers */
|
||||
#ifdef HAVE_LAPACK
|
||||
|
||||
#ifdef LM_DBL_PREC
|
||||
extern int dAx_eq_b_QR(double *A, double *B, double *x, int m);
|
||||
extern int dAx_eq_b_QRLS(double *A, double *B, double *x, int m, int n);
|
||||
extern int dAx_eq_b_Chol(double *A, double *B, double *x, int m);
|
||||
extern int dAx_eq_b_LU(double *A, double *B, double *x, int m);
|
||||
extern int dAx_eq_b_SVD(double *A, double *B, double *x, int m);
|
||||
extern int dAx_eq_b_BK(double *A, double *B, double *x, int m);
|
||||
#endif /* LM_DBL_PREC */
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
extern int sAx_eq_b_QR(float *A, float *B, float *x, int m);
|
||||
extern int sAx_eq_b_QRLS(float *A, float *B, float *x, int m, int n);
|
||||
extern int sAx_eq_b_Chol(float *A, float *B, float *x, int m);
|
||||
extern int sAx_eq_b_LU(float *A, float *B, float *x, int m);
|
||||
extern int sAx_eq_b_SVD(float *A, float *B, float *x, int m);
|
||||
extern int sAx_eq_b_BK(float *A, float *B, float *x, int m);
|
||||
#endif /* LM_SNGL_PREC */
|
||||
|
||||
#else /* no LAPACK */
|
||||
|
||||
#ifdef LM_DBL_PREC
|
||||
extern int dAx_eq_b_LU_noLapack(double *A, double *B, double *x, int n);
|
||||
#endif /* LM_DBL_PREC */
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
extern int sAx_eq_b_LU_noLapack(float *A, float *B, float *x, int n);
|
||||
#endif /* LM_SNGL_PREC */
|
||||
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
#ifdef HAVE_PLASMA
|
||||
#ifdef LM_DBL_PREC
|
||||
extern int dAx_eq_b_PLASMA_Chol(double *A, double *B, double *x, int m);
|
||||
#endif
|
||||
#ifdef LM_SNGL_PREC
|
||||
extern int sAx_eq_b_PLASMA_Chol(float *A, float *B, float *x, int m);
|
||||
#endif
|
||||
extern void levmar_PLASMA_setnbcores(int cores);
|
||||
#endif /* HAVE_PLASMA */
|
||||
|
||||
/* Jacobian verification, double & single precision */
|
||||
#ifdef LM_DBL_PREC
|
||||
extern void dlevmar_chkjac(
|
||||
void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
void (*jacf)(double *p, double *j, int m, int n, void *adata),
|
||||
double *p, int m, int n, void *adata, double *err);
|
||||
#endif /* LM_DBL_PREC */
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
extern void slevmar_chkjac(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
void (*jacf)(float *p, float *j, int m, int n, void *adata),
|
||||
float *p, int m, int n, void *adata, float *err);
|
||||
#endif /* LM_SNGL_PREC */
|
||||
|
||||
/* miscellaneous: standard deviation, coefficient of determination (R2),
|
||||
* Pearson's correlation coefficient for best-fit parameters
|
||||
*/
|
||||
#ifdef LM_DBL_PREC
|
||||
extern double dlevmar_stddev( double *covar, int m, int i);
|
||||
extern double dlevmar_corcoef(double *covar, int m, int i, int j);
|
||||
extern double dlevmar_R2(void (*func)(double *p, double *hx, int m, int n, void *adata), double *p, double *x, int m, int n, void *adata);
|
||||
|
||||
#endif /* LM_DBL_PREC */
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
extern float slevmar_stddev( float *covar, int m, int i);
|
||||
extern float slevmar_corcoef(float *covar, int m, int i, int j);
|
||||
extern float slevmar_R2(void (*func)(float *p, float *hx, int m, int n, void *adata), float *p, float *x, int m, int n, void *adata);
|
||||
|
||||
extern void slevmar_locscale(
|
||||
void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
float *p, float *x, int m, int n, void *adata,
|
||||
int howto, float locscl[2], float **residptr);
|
||||
|
||||
extern int slevmar_outlid(float *r, int n, float thresh, float ls[2], char *outlmap);
|
||||
|
||||
#endif /* LM_SNGL_PREC */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LEVMAR_H_ */
|
||||
83
contrib/levmar/lm.c
Normal file
83
contrib/levmar/lm.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2004 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/********************************************************************************
|
||||
* Levenberg-Marquardt nonlinear minimization. The same core code is used with
|
||||
* appropriate #defines to derive single and double precision versions, see
|
||||
* also lm_core.c
|
||||
********************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "levmar.h"
|
||||
#include "compiler.h"
|
||||
#include "misc.h"
|
||||
|
||||
#define EPSILON 1E-12
|
||||
#define ONE_THIRD 0.3333333334 /* 1.0/3.0 */
|
||||
|
||||
#if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC)
|
||||
#error At least one of LM_DBL_PREC, LM_SNGL_PREC should be defined!
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
/* single precision (float) definitions */
|
||||
#define LM_REAL float
|
||||
#define LM_PREFIX s
|
||||
|
||||
#define LM_REAL_MAX FLT_MAX
|
||||
#define LM_REAL_MIN -FLT_MAX
|
||||
#define LM_REAL_EPSILON FLT_EPSILON
|
||||
#define __SUBCNST(x) x##F
|
||||
#define LM_CNST(x) __SUBCNST(x) // force substitution
|
||||
|
||||
#include "lm_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_REAL_MAX
|
||||
#undef LM_REAL_EPSILON
|
||||
#undef LM_REAL_MIN
|
||||
#undef __SUBCNST
|
||||
#undef LM_CNST
|
||||
#endif /* LM_SNGL_PREC */
|
||||
|
||||
#ifdef LM_DBL_PREC
|
||||
/* double precision definitions */
|
||||
#define LM_REAL double
|
||||
#define LM_PREFIX d
|
||||
|
||||
#define LM_REAL_MAX DBL_MAX
|
||||
#define LM_REAL_MIN -DBL_MAX
|
||||
#define LM_REAL_EPSILON DBL_EPSILON
|
||||
#define LM_CNST(x) (x)
|
||||
|
||||
#include "lm_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_REAL_MAX
|
||||
#undef LM_REAL_EPSILON
|
||||
#undef LM_REAL_MIN
|
||||
#undef LM_CNST
|
||||
#endif /* LM_DBL_PREC */
|
||||
11
contrib/levmar/lm.h
Normal file
11
contrib/levmar/lm.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef _DEPR_LM_H_
|
||||
#define _DEPR_LM_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("lm.h is deprecated, please use levmar.h instead!")
|
||||
#else
|
||||
#error lm.h is deprecated, please use levmar.h instead!
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#endif /* _DEPR_LM_H_ */
|
||||
|
||||
858
contrib/levmar/lm_core.c
Normal file
858
contrib/levmar/lm_core.c
Normal file
@@ -0,0 +1,858 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2004 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef LM_REAL // not included by lm.c
|
||||
#error This file should not be compiled directly!
|
||||
#endif
|
||||
|
||||
|
||||
/* precision-specific definitions */
|
||||
#define LEVMAR_DER LM_ADD_PREFIX(levmar_der)
|
||||
#define LEVMAR_DIF LM_ADD_PREFIX(levmar_dif)
|
||||
#define LEVMAR_FDIF_FORW_JAC_APPROX LM_ADD_PREFIX(levmar_fdif_forw_jac_approx)
|
||||
#define LEVMAR_FDIF_CENT_JAC_APPROX LM_ADD_PREFIX(levmar_fdif_cent_jac_approx)
|
||||
#define LEVMAR_TRANS_MAT_MAT_MULT LM_ADD_PREFIX(levmar_trans_mat_mat_mult)
|
||||
#define LEVMAR_L2NRMXMY LM_ADD_PREFIX(levmar_L2nrmxmy)
|
||||
#define LEVMAR_COVAR LM_ADD_PREFIX(levmar_covar)
|
||||
|
||||
#ifdef HAVE_LAPACK
|
||||
#define AX_EQ_B_LU LM_ADD_PREFIX(Ax_eq_b_LU)
|
||||
#define AX_EQ_B_CHOL LM_ADD_PREFIX(Ax_eq_b_Chol)
|
||||
#define AX_EQ_B_QR LM_ADD_PREFIX(Ax_eq_b_QR)
|
||||
#define AX_EQ_B_QRLS LM_ADD_PREFIX(Ax_eq_b_QRLS)
|
||||
#define AX_EQ_B_SVD LM_ADD_PREFIX(Ax_eq_b_SVD)
|
||||
#define AX_EQ_B_BK LM_ADD_PREFIX(Ax_eq_b_BK)
|
||||
#else
|
||||
#define AX_EQ_B_LU LM_ADD_PREFIX(Ax_eq_b_LU_noLapack)
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
#ifdef HAVE_PLASMA
|
||||
#define AX_EQ_B_PLASMA_CHOL LM_ADD_PREFIX(Ax_eq_b_PLASMA_Chol)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function seeks the parameter vector p that best describes the measurements vector x.
|
||||
* More precisely, given a vector function func : R^m --> R^n with n>=m,
|
||||
* it finds p s.t. func(p) ~= x, i.e. the squared second order (i.e. L2) norm of
|
||||
* e=x-func(p) is minimized.
|
||||
*
|
||||
* This function requires an analytic Jacobian. In case the latter is unavailable,
|
||||
* use LEVMAR_DIF() bellow
|
||||
*
|
||||
* Returns the number of iterations (>=0) if successful, LM_ERROR if failed
|
||||
*
|
||||
* For more details, see K. Madsen, H.B. Nielsen and O. Tingleff's lecture notes on
|
||||
* non-linear least squares at http://www.imm.dtu.dk/pubdb/views/edoc_download.php/3215/pdf/imm3215.pdf
|
||||
*/
|
||||
|
||||
int LEVMAR_DER(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata), /* functional relation describing measurements. A p \in R^m yields a \hat{x} \in R^n */
|
||||
void (*jacf)(LM_REAL *p, LM_REAL *j, int m, int n, void *adata), /* function to evaluate the Jacobian \part x / \part p */
|
||||
LM_REAL *p, /* I/O: initial parameter estimates. On output has the estimated solution */
|
||||
LM_REAL *x, /* I: measurement vector. NULL implies a zero vector */
|
||||
int m, /* I: parameter vector dimension (i.e. #unknowns) */
|
||||
int n, /* I: measurement vector dimension */
|
||||
int itmax, /* I: maximum number of iterations */
|
||||
LM_REAL opts[4], /* I: minim. options [\mu, \epsilon1, \epsilon2, \epsilon3]. Respectively the scale factor for initial \mu,
|
||||
* stopping thresholds for ||J^T e||_inf, ||Dp||_2 and ||e||_2. Set to NULL for defaults to be used
|
||||
*/
|
||||
LM_REAL info[LM_INFO_SZ],
|
||||
/* O: information regarding the minimization. Set to NULL if don't care
|
||||
* info[0]= ||e||_2 at initial p.
|
||||
* info[1-4]=[ ||e||_2, ||J^T e||_inf, ||Dp||_2, mu/max[J^T J]_ii ], all computed at estimated p.
|
||||
* info[5]= # iterations,
|
||||
* info[6]=reason for terminating: 1 - stopped by small gradient J^T e
|
||||
* 2 - stopped by small Dp
|
||||
* 3 - stopped by itmax
|
||||
* 4 - singular matrix. Restart from current p with increased mu
|
||||
* 5 - no further error reduction is possible. Restart with increased mu
|
||||
* 6 - stopped by small ||e||_2
|
||||
* 7 - stopped by invalid (i.e. NaN or Inf) "func" values. This is a user error
|
||||
* info[7]= # function evaluations
|
||||
* info[8]= # Jacobian evaluations
|
||||
* info[9]= # linear systems solved, i.e. # attempts for reducing error
|
||||
*/
|
||||
LM_REAL *work, /* working memory at least LM_DER_WORKSZ() reals large, allocated if NULL */
|
||||
LM_REAL *covar, /* O: Covariance matrix corresponding to LS solution; mxm. Set to NULL if not needed. */
|
||||
void *adata) /* pointer to possibly additional data, passed uninterpreted to func & jacf.
|
||||
* Set to NULL if not needed
|
||||
*/
|
||||
{
|
||||
register int i, j, k, l;
|
||||
int worksz, freework=0, issolved;
|
||||
/* temp work arrays */
|
||||
LM_REAL *e, /* nx1 */
|
||||
*hx, /* \hat{x}_i, nx1 */
|
||||
*jacTe, /* J^T e_i mx1 */
|
||||
*jac, /* nxm */
|
||||
*jacTjac, /* mxm */
|
||||
*Dp, /* mx1 */
|
||||
*diag_jacTjac, /* diagonal of J^T J, mx1 */
|
||||
*pDp; /* p + Dp, mx1 */
|
||||
|
||||
register LM_REAL mu, /* damping constant */
|
||||
tmp; /* mainly used in matrix & vector multiplications */
|
||||
LM_REAL p_eL2, jacTe_inf, pDp_eL2; /* ||e(p)||_2, ||J^T e||_inf, ||e(p+Dp)||_2 */
|
||||
LM_REAL p_L2, Dp_L2=LM_REAL_MAX, dF, dL;
|
||||
LM_REAL tau, eps1, eps2, eps2_sq, eps3;
|
||||
LM_REAL init_p_eL2;
|
||||
int nu=2, nu2, stop=0, nfev, njev=0, nlss=0;
|
||||
const int nm=n*m;
|
||||
int (*linsolver)(LM_REAL *A, LM_REAL *B, LM_REAL *x, int m)=NULL;
|
||||
|
||||
mu=jacTe_inf=0.0; /* -Wall */
|
||||
|
||||
if(n<m){
|
||||
fprintf(stderr, LCAT(LEVMAR_DER, "(): cannot solve a problem with fewer measurements [%d] than unknowns [%d]\n"), n, m);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
if(!jacf){
|
||||
fprintf(stderr, RCAT("No function specified for computing the Jacobian in ", LEVMAR_DER)
|
||||
RCAT("().\nIf no such function is available, use ", LEVMAR_DIF) RCAT("() rather than ", LEVMAR_DER) "()\n");
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
if(opts){
|
||||
tau=opts[0];
|
||||
eps1=opts[1];
|
||||
eps2=opts[2];
|
||||
eps2_sq=opts[2]*opts[2];
|
||||
eps3=opts[3];
|
||||
}
|
||||
else{ // use default values
|
||||
tau=LM_CNST(LM_INIT_MU);
|
||||
eps1=LM_CNST(LM_STOP_THRESH);
|
||||
eps2=LM_CNST(LM_STOP_THRESH);
|
||||
eps2_sq=LM_CNST(LM_STOP_THRESH)*LM_CNST(LM_STOP_THRESH);
|
||||
eps3=LM_CNST(LM_STOP_THRESH);
|
||||
}
|
||||
|
||||
if(!work){
|
||||
worksz=LM_DER_WORKSZ(m, n); //2*n+4*m + n*m + m*m;
|
||||
work=(LM_REAL *)malloc(worksz*sizeof(LM_REAL)); /* allocate a big chunk in one step */
|
||||
if(!work){
|
||||
fprintf(stderr, LCAT(LEVMAR_DER, "(): memory allocation request failed\n"));
|
||||
return LM_ERROR;
|
||||
}
|
||||
freework=1;
|
||||
}
|
||||
|
||||
/* set up work arrays */
|
||||
e=work;
|
||||
hx=e + n;
|
||||
jacTe=hx + n;
|
||||
jac=jacTe + m;
|
||||
jacTjac=jac + nm;
|
||||
Dp=jacTjac + m*m;
|
||||
diag_jacTjac=Dp + m;
|
||||
pDp=diag_jacTjac + m;
|
||||
|
||||
/* compute e=x - f(p) and its L2 norm */
|
||||
(*func)(p, hx, m, n, adata); nfev=1;
|
||||
/* ### e=x-hx, p_eL2=||e|| */
|
||||
#if 1
|
||||
p_eL2=LEVMAR_L2NRMXMY(e, x, hx, n);
|
||||
#else
|
||||
for(i=0, p_eL2=0.0; i<n; ++i){
|
||||
e[i]=tmp=x[i]-hx[i];
|
||||
p_eL2+=tmp*tmp;
|
||||
}
|
||||
#endif
|
||||
init_p_eL2=p_eL2;
|
||||
if(!LM_FINITE(p_eL2)) stop=7;
|
||||
|
||||
for(k=0; k<itmax && !stop; ++k){
|
||||
/* Note that p and e have been updated at a previous iteration */
|
||||
|
||||
if(p_eL2<=eps3){ /* error is small */
|
||||
stop=6;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Compute the Jacobian J at p, J^T J, J^T e, ||J^T e||_inf and ||p||^2.
|
||||
* Since J^T J is symmetric, its computation can be sped up by computing
|
||||
* only its upper triangular part and copying it to the lower part
|
||||
*/
|
||||
|
||||
(*jacf)(p, jac, m, n, adata); ++njev;
|
||||
|
||||
/* J^T J, J^T e */
|
||||
if(nm<__BLOCKSZ__SQ){ // this is a small problem
|
||||
/* J^T*J_ij = \sum_l J^T_il * J_lj = \sum_l J_li * J_lj.
|
||||
* Thus, the product J^T J can be computed using an outer loop for
|
||||
* l that adds J_li*J_lj to each element ij of the result. Note that
|
||||
* with this scheme, the accesses to J and JtJ are always along rows,
|
||||
* therefore induces less cache misses compared to the straightforward
|
||||
* algorithm for computing the product (i.e., l loop is innermost one).
|
||||
* A similar scheme applies to the computation of J^T e.
|
||||
* However, for large minimization problems (i.e., involving a large number
|
||||
* of unknowns and measurements) for which J/J^T J rows are too large to
|
||||
* fit in the L1 cache, even this scheme incures many cache misses. In
|
||||
* such cases, a cache-efficient blocking scheme is preferable.
|
||||
*
|
||||
* Thanks to John Nitao of Lawrence Livermore Lab for pointing out this
|
||||
* performance problem.
|
||||
*
|
||||
* Note that the non-blocking algorithm is faster on small
|
||||
* problems since in this case it avoids the overheads of blocking.
|
||||
*/
|
||||
|
||||
/* looping downwards saves a few computations */
|
||||
register int l;
|
||||
register LM_REAL alpha, *jaclm, *jacTjacim;
|
||||
|
||||
for(i=m*m; i-->0; )
|
||||
jacTjac[i]=0.0;
|
||||
for(i=m; i-->0; )
|
||||
jacTe[i]=0.0;
|
||||
|
||||
for(l=n; l-->0; ){
|
||||
jaclm=jac+l*m;
|
||||
for(i=m; i-->0; ){
|
||||
jacTjacim=jacTjac+i*m;
|
||||
alpha=jaclm[i]; //jac[l*m+i];
|
||||
for(j=i+1; j-->0; ) /* j<=i computes lower triangular part only */
|
||||
jacTjacim[j]+=jaclm[j]*alpha; //jacTjac[i*m+j]+=jac[l*m+j]*alpha
|
||||
|
||||
/* J^T e */
|
||||
jacTe[i]+=alpha*e[l];
|
||||
}
|
||||
}
|
||||
|
||||
for(i=m; i-->0; ) /* copy to upper part */
|
||||
for(j=i+1; j<m; ++j)
|
||||
jacTjac[i*m+j]=jacTjac[j*m+i];
|
||||
|
||||
}
|
||||
else{ // this is a large problem
|
||||
/* Cache efficient computation of J^T J based on blocking
|
||||
*/
|
||||
LEVMAR_TRANS_MAT_MAT_MULT(jac, jacTjac, n, m);
|
||||
|
||||
/* cache efficient computation of J^T e */
|
||||
for(i=0; i<m; ++i)
|
||||
jacTe[i]=0.0;
|
||||
|
||||
for(i=0; i<n; ++i){
|
||||
register LM_REAL *jacrow;
|
||||
|
||||
for(l=0, jacrow=jac+i*m, tmp=e[i]; l<m; ++l)
|
||||
jacTe[l]+=jacrow[l]*tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute ||J^T e||_inf and ||p||^2 */
|
||||
for(i=0, p_L2=jacTe_inf=0.0; i<m; ++i){
|
||||
if(jacTe_inf < (tmp=FABS(jacTe[i]))) jacTe_inf=tmp;
|
||||
|
||||
diag_jacTjac[i]=jacTjac[i*m+i]; /* save diagonal entries so that augmentation can be later canceled */
|
||||
p_L2+=p[i]*p[i];
|
||||
}
|
||||
//p_L2=sqrt(p_L2);
|
||||
|
||||
#if 0
|
||||
if(!(k%100)){
|
||||
printf("Current estimate: ");
|
||||
for(i=0; i<m; ++i)
|
||||
printf("%.9g ", p[i]);
|
||||
printf("-- errors %.9g %0.9g\n", jacTe_inf, p_eL2);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* check for convergence */
|
||||
if((jacTe_inf <= eps1)){
|
||||
Dp_L2=0.0; /* no increment for p in this case */
|
||||
stop=1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* compute initial damping factor */
|
||||
if(k==0){
|
||||
for(i=0, tmp=LM_REAL_MIN; i<m; ++i)
|
||||
if(diag_jacTjac[i]>tmp) tmp=diag_jacTjac[i]; /* find max diagonal element */
|
||||
mu=tau*tmp;
|
||||
}
|
||||
|
||||
/* determine increment using adaptive damping */
|
||||
while(1){
|
||||
/* augment normal equations */
|
||||
for(i=0; i<m; ++i)
|
||||
jacTjac[i*m+i]+=mu;
|
||||
|
||||
/* solve augmented equations */
|
||||
#ifdef HAVE_LAPACK
|
||||
/* 7 alternatives are available: LU, Cholesky + Cholesky with PLASMA, LDLt, 2 variants of QR decomposition and SVD.
|
||||
* For matrices with dimensions of at least a few hundreds, the PLASMA implementation of Cholesky is the fastest.
|
||||
* From the serial solvers, Cholesky is the fastest but might occasionally be inapplicable due to numerical round-off;
|
||||
* QR is slower but more robust; SVD is the slowest but most robust; LU is quite robust but
|
||||
* slower than LDLt; LDLt offers a good tradeoff between robustness and speed
|
||||
*/
|
||||
|
||||
issolved=AX_EQ_B_BK(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_BK;
|
||||
//issolved=AX_EQ_B_LU(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_LU;
|
||||
//issolved=AX_EQ_B_CHOL(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_CHOL;
|
||||
#ifdef HAVE_PLASMA
|
||||
//issolved=AX_EQ_B_PLASMA_CHOL(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_PLASMA_CHOL;
|
||||
#endif
|
||||
//issolved=AX_EQ_B_QR(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_QR;
|
||||
//issolved=AX_EQ_B_QRLS(jacTjac, jacTe, Dp, m, m); ++nlss; linsolver=(int (*)(LM_REAL *A, LM_REAL *B, LM_REAL *x, int m))AX_EQ_B_QRLS;
|
||||
//issolved=AX_EQ_B_SVD(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_SVD;
|
||||
|
||||
#else
|
||||
/* use the LU included with levmar */
|
||||
issolved=AX_EQ_B_LU(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_LU;
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
if(issolved){
|
||||
/* compute p's new estimate and ||Dp||^2 */
|
||||
for(i=0, Dp_L2=0.0; i<m; ++i){
|
||||
pDp[i]=p[i] + (tmp=Dp[i]);
|
||||
Dp_L2+=tmp*tmp;
|
||||
}
|
||||
//Dp_L2=sqrt(Dp_L2);
|
||||
|
||||
if(Dp_L2<=eps2_sq*p_L2){ /* relative change in p is small, stop */
|
||||
//if(Dp_L2<=eps2*(p_L2 + eps2)){ /* relative change in p is small, stop */
|
||||
stop=2;
|
||||
break;
|
||||
}
|
||||
|
||||
if(Dp_L2>=(p_L2+eps2)/(LM_CNST(EPSILON)*LM_CNST(EPSILON))){ /* almost singular */
|
||||
//if(Dp_L2>=(p_L2+eps2)/LM_CNST(EPSILON)){ /* almost singular */
|
||||
stop=4;
|
||||
break;
|
||||
}
|
||||
|
||||
(*func)(pDp, hx, m, n, adata); ++nfev; /* evaluate function at p + Dp */
|
||||
/* compute ||e(pDp)||_2 */
|
||||
/* ### hx=x-hx, pDp_eL2=||hx|| */
|
||||
#if 1
|
||||
pDp_eL2=LEVMAR_L2NRMXMY(hx, x, hx, n);
|
||||
#else
|
||||
for(i=0, pDp_eL2=0.0; i<n; ++i){
|
||||
hx[i]=tmp=x[i]-hx[i];
|
||||
pDp_eL2+=tmp*tmp;
|
||||
}
|
||||
#endif
|
||||
if(!LM_FINITE(pDp_eL2)){ /* sum of squares is not finite, most probably due to a user error.
|
||||
* This check makes sure that the inner loop does not run indefinitely.
|
||||
* Thanks to Steve Danauskas for reporting such cases
|
||||
*/
|
||||
stop=7;
|
||||
break;
|
||||
}
|
||||
|
||||
for(i=0, dL=0.0; i<m; ++i)
|
||||
dL+=Dp[i]*(mu*Dp[i]+jacTe[i]);
|
||||
|
||||
dF=p_eL2-pDp_eL2;
|
||||
|
||||
if(dL>0.0 && dF>0.0){ /* reduction in error, increment is accepted */
|
||||
tmp=(LM_CNST(2.0)*dF/dL-LM_CNST(1.0));
|
||||
tmp=LM_CNST(1.0)-tmp*tmp*tmp;
|
||||
mu=mu*( (tmp>=LM_CNST(ONE_THIRD))? tmp : LM_CNST(ONE_THIRD) );
|
||||
nu=2;
|
||||
|
||||
for(i=0 ; i<m; ++i) /* update p's estimate */
|
||||
p[i]=pDp[i];
|
||||
|
||||
for(i=0; i<n; ++i) /* update e and ||e||_2 */
|
||||
e[i]=hx[i];
|
||||
p_eL2=pDp_eL2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if this point is reached, either the linear system could not be solved or
|
||||
* the error did not reduce; in any case, the increment must be rejected
|
||||
*/
|
||||
|
||||
mu*=nu;
|
||||
nu2=nu<<1; // 2*nu;
|
||||
if(nu2<=nu){ /* nu has wrapped around (overflown). Thanks to Frank Jordan for spotting this case */
|
||||
stop=5;
|
||||
break;
|
||||
}
|
||||
nu=nu2;
|
||||
|
||||
for(i=0; i<m; ++i) /* restore diagonal J^T J entries */
|
||||
jacTjac[i*m+i]=diag_jacTjac[i];
|
||||
} /* inner loop */
|
||||
}
|
||||
|
||||
if(k>=itmax) stop=3;
|
||||
|
||||
for(i=0; i<m; ++i) /* restore diagonal J^T J entries */
|
||||
jacTjac[i*m+i]=diag_jacTjac[i];
|
||||
|
||||
if(info){
|
||||
info[0]=init_p_eL2;
|
||||
info[1]=p_eL2;
|
||||
info[2]=jacTe_inf;
|
||||
info[3]=Dp_L2;
|
||||
for(i=0, tmp=LM_REAL_MIN; i<m; ++i)
|
||||
if(tmp<jacTjac[i*m+i]) tmp=jacTjac[i*m+i];
|
||||
info[4]=mu/tmp;
|
||||
info[5]=(LM_REAL)k;
|
||||
info[6]=(LM_REAL)stop;
|
||||
info[7]=(LM_REAL)nfev;
|
||||
info[8]=(LM_REAL)njev;
|
||||
info[9]=(LM_REAL)nlss;
|
||||
}
|
||||
|
||||
/* covariance matrix */
|
||||
if(covar){
|
||||
LEVMAR_COVAR(jacTjac, covar, p_eL2, m, n);
|
||||
}
|
||||
|
||||
if(freework) free(work);
|
||||
|
||||
#ifdef LINSOLVERS_RETAIN_MEMORY
|
||||
if(linsolver) (*linsolver)(NULL, NULL, NULL, 0);
|
||||
#endif
|
||||
|
||||
return (stop!=4 && stop!=7)? k : LM_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* Secant version of the LEVMAR_DER() function above: the Jacobian is approximated with
|
||||
* the aid of finite differences (forward or central, see the comment for the opts argument)
|
||||
*/
|
||||
int LEVMAR_DIF(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata), /* functional relation describing measurements. A p \in R^m yields a \hat{x} \in R^n */
|
||||
LM_REAL *p, /* I/O: initial parameter estimates. On output has the estimated solution */
|
||||
LM_REAL *x, /* I: measurement vector. NULL implies a zero vector */
|
||||
int m, /* I: parameter vector dimension (i.e. #unknowns) */
|
||||
int n, /* I: measurement vector dimension */
|
||||
int itmax, /* I: maximum number of iterations */
|
||||
LM_REAL opts[5], /* I: opts[0-4] = minim. options [\mu, \epsilon1, \epsilon2, \epsilon3, \delta]. Respectively the
|
||||
* scale factor for initial \mu, stopping thresholds for ||J^T e||_inf, ||Dp||_2 and ||e||_2 and
|
||||
* the step used in difference approximation to the Jacobian. Set to NULL for defaults to be used.
|
||||
* If \delta<0, the Jacobian is approximated with central differences which are more accurate
|
||||
* (but slower!) compared to the forward differences employed by default.
|
||||
*/
|
||||
LM_REAL info[LM_INFO_SZ],
|
||||
/* O: information regarding the minimization. Set to NULL if don't care
|
||||
* info[0]= ||e||_2 at initial p.
|
||||
* info[1-4]=[ ||e||_2, ||J^T e||_inf, ||Dp||_2, mu/max[J^T J]_ii ], all computed at estimated p.
|
||||
* info[5]= # iterations,
|
||||
* info[6]=reason for terminating: 1 - stopped by small gradient J^T e
|
||||
* 2 - stopped by small Dp
|
||||
* 3 - stopped by itmax
|
||||
* 4 - singular matrix. Restart from current p with increased mu
|
||||
* 5 - no further error reduction is possible. Restart with increased mu
|
||||
* 6 - stopped by small ||e||_2
|
||||
* 7 - stopped by invalid (i.e. NaN or Inf) "func" values. This is a user error
|
||||
* info[7]= # function evaluations
|
||||
* info[8]= # Jacobian evaluations
|
||||
* info[9]= # linear systems solved, i.e. # attempts for reducing error
|
||||
*/
|
||||
LM_REAL *work, /* working memory at least LM_DIF_WORKSZ() reals large, allocated if NULL */
|
||||
LM_REAL *covar, /* O: Covariance matrix corresponding to LS solution; mxm. Set to NULL if not needed. */
|
||||
void *adata) /* pointer to possibly additional data, passed uninterpreted to func.
|
||||
* Set to NULL if not needed
|
||||
*/
|
||||
{
|
||||
register int i, j, k, l;
|
||||
int worksz, freework=0, issolved;
|
||||
/* temp work arrays */
|
||||
LM_REAL *e, /* nx1 */
|
||||
*hx, /* \hat{x}_i, nx1 */
|
||||
*jacTe, /* J^T e_i mx1 */
|
||||
*jac, /* nxm */
|
||||
*jacTjac, /* mxm */
|
||||
*Dp, /* mx1 */
|
||||
*diag_jacTjac, /* diagonal of J^T J, mx1 */
|
||||
*pDp, /* p + Dp, mx1 */
|
||||
*wrk, /* nx1 */
|
||||
*wrk2; /* nx1, used only for holding a temporary e vector and when differentiating with central differences */
|
||||
|
||||
int using_ffdif=1;
|
||||
|
||||
register LM_REAL mu, /* damping constant */
|
||||
tmp; /* mainly used in matrix & vector multiplications */
|
||||
LM_REAL p_eL2, jacTe_inf, pDp_eL2; /* ||e(p)||_2, ||J^T e||_inf, ||e(p+Dp)||_2 */
|
||||
LM_REAL p_L2, Dp_L2=LM_REAL_MAX, dF, dL;
|
||||
LM_REAL tau, eps1, eps2, eps2_sq, eps3, delta;
|
||||
LM_REAL init_p_eL2;
|
||||
int nu, nu2, stop=0, nfev, njap=0, nlss=0, K=(m>=10)? m: 10, updjac, updp=1, newjac;
|
||||
const int nm=n*m;
|
||||
int (*linsolver)(LM_REAL *A, LM_REAL *B, LM_REAL *x, int m)=NULL;
|
||||
|
||||
mu=jacTe_inf=p_L2=0.0; /* -Wall */
|
||||
updjac=newjac=0; /* -Wall */
|
||||
|
||||
if(n<m){
|
||||
fprintf(stderr, LCAT(LEVMAR_DIF, "(): cannot solve a problem with fewer measurements [%d] than unknowns [%d]\n"), n, m);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
if(opts){
|
||||
tau=opts[0];
|
||||
eps1=opts[1];
|
||||
eps2=opts[2];
|
||||
eps2_sq=opts[2]*opts[2];
|
||||
eps3=opts[3];
|
||||
delta=opts[4];
|
||||
if(delta<0.0){
|
||||
delta=-delta; /* make positive */
|
||||
using_ffdif=0; /* use central differencing */
|
||||
}
|
||||
}
|
||||
else{ // use default values
|
||||
tau=LM_CNST(LM_INIT_MU);
|
||||
eps1=LM_CNST(LM_STOP_THRESH);
|
||||
eps2=LM_CNST(LM_STOP_THRESH);
|
||||
eps2_sq=LM_CNST(LM_STOP_THRESH)*LM_CNST(LM_STOP_THRESH);
|
||||
eps3=LM_CNST(LM_STOP_THRESH);
|
||||
delta=LM_CNST(LM_DIFF_DELTA);
|
||||
}
|
||||
|
||||
if(!work){
|
||||
worksz=LM_DIF_WORKSZ(m, n); //4*n+4*m + n*m + m*m;
|
||||
work=(LM_REAL *)malloc(worksz*sizeof(LM_REAL)); /* allocate a big chunk in one step */
|
||||
if(!work){
|
||||
fprintf(stderr, LCAT(LEVMAR_DIF, "(): memory allocation request failed\n"));
|
||||
return LM_ERROR;
|
||||
}
|
||||
freework=1;
|
||||
}
|
||||
|
||||
/* set up work arrays */
|
||||
e=work;
|
||||
hx=e + n;
|
||||
jacTe=hx + n;
|
||||
jac=jacTe + m;
|
||||
jacTjac=jac + nm;
|
||||
Dp=jacTjac + m*m;
|
||||
diag_jacTjac=Dp + m;
|
||||
pDp=diag_jacTjac + m;
|
||||
wrk=pDp + m;
|
||||
wrk2=wrk + n;
|
||||
|
||||
/* compute e=x - f(p) and its L2 norm */
|
||||
(*func)(p, hx, m, n, adata); nfev=1;
|
||||
/* ### e=x-hx, p_eL2=||e|| */
|
||||
#if 1
|
||||
p_eL2=LEVMAR_L2NRMXMY(e, x, hx, n);
|
||||
#else
|
||||
for(i=0, p_eL2=0.0; i<n; ++i){
|
||||
e[i]=tmp=x[i]-hx[i];
|
||||
p_eL2+=tmp*tmp;
|
||||
}
|
||||
#endif
|
||||
init_p_eL2=p_eL2;
|
||||
if(!LM_FINITE(p_eL2)) stop=7;
|
||||
|
||||
nu=20; /* force computation of J */
|
||||
|
||||
for(k=0; k<itmax && !stop; ++k){
|
||||
/* Note that p and e have been updated at a previous iteration */
|
||||
|
||||
if(p_eL2<=eps3){ /* error is small */
|
||||
stop=6;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Compute the Jacobian J at p, J^T J, J^T e, ||J^T e||_inf and ||p||^2.
|
||||
* The symmetry of J^T J is again exploited for speed
|
||||
*/
|
||||
|
||||
if((updp && nu>16) || updjac==K){ /* compute difference approximation to J */
|
||||
if(using_ffdif){ /* use forward differences */
|
||||
LEVMAR_FDIF_FORW_JAC_APPROX(func, p, hx, wrk, delta, jac, m, n, adata);
|
||||
++njap; nfev+=m;
|
||||
}
|
||||
else{ /* use central differences */
|
||||
LEVMAR_FDIF_CENT_JAC_APPROX(func, p, wrk, wrk2, delta, jac, m, n, adata);
|
||||
++njap; nfev+=2*m;
|
||||
}
|
||||
nu=2; updjac=0; updp=0; newjac=1;
|
||||
}
|
||||
|
||||
if(newjac){ /* Jacobian has changed, recompute J^T J, J^t e, etc */
|
||||
newjac=0;
|
||||
|
||||
/* J^T J, J^T e */
|
||||
if(nm<=__BLOCKSZ__SQ){ // this is a small problem
|
||||
/* J^T*J_ij = \sum_l J^T_il * J_lj = \sum_l J_li * J_lj.
|
||||
* Thus, the product J^T J can be computed using an outer loop for
|
||||
* l that adds J_li*J_lj to each element ij of the result. Note that
|
||||
* with this scheme, the accesses to J and JtJ are always along rows,
|
||||
* therefore induces less cache misses compared to the straightforward
|
||||
* algorithm for computing the product (i.e., l loop is innermost one).
|
||||
* A similar scheme applies to the computation of J^T e.
|
||||
* However, for large minimization problems (i.e., involving a large number
|
||||
* of unknowns and measurements) for which J/J^T J rows are too large to
|
||||
* fit in the L1 cache, even this scheme incures many cache misses. In
|
||||
* such cases, a cache-efficient blocking scheme is preferable.
|
||||
*
|
||||
* Thanks to John Nitao of Lawrence Livermore Lab for pointing out this
|
||||
* performance problem.
|
||||
*
|
||||
* Note that the non-blocking algorithm is faster on small
|
||||
* problems since in this case it avoids the overheads of blocking.
|
||||
*/
|
||||
register int l;
|
||||
register LM_REAL alpha, *jaclm, *jacTjacim;
|
||||
|
||||
/* looping downwards saves a few computations */
|
||||
for(i=m*m; i-->0; )
|
||||
jacTjac[i]=0.0;
|
||||
for(i=m; i-->0; )
|
||||
jacTe[i]=0.0;
|
||||
|
||||
for(l=n; l-->0; ){
|
||||
jaclm=jac+l*m;
|
||||
for(i=m; i-->0; ){
|
||||
jacTjacim=jacTjac+i*m;
|
||||
alpha=jaclm[i]; //jac[l*m+i];
|
||||
for(j=i+1; j-->0; ) /* j<=i computes lower triangular part only */
|
||||
jacTjacim[j]+=jaclm[j]*alpha; //jacTjac[i*m+j]+=jac[l*m+j]*alpha
|
||||
|
||||
/* J^T e */
|
||||
jacTe[i]+=alpha*e[l];
|
||||
}
|
||||
}
|
||||
|
||||
for(i=m; i-->0; ) /* copy to upper part */
|
||||
for(j=i+1; j<m; ++j)
|
||||
jacTjac[i*m+j]=jacTjac[j*m+i];
|
||||
}
|
||||
else{ // this is a large problem
|
||||
/* Cache efficient computation of J^T J based on blocking
|
||||
*/
|
||||
LEVMAR_TRANS_MAT_MAT_MULT(jac, jacTjac, n, m);
|
||||
|
||||
/* cache efficient computation of J^T e */
|
||||
for(i=0; i<m; ++i)
|
||||
jacTe[i]=0.0;
|
||||
|
||||
for(i=0; i<n; ++i){
|
||||
register LM_REAL *jacrow;
|
||||
|
||||
for(l=0, jacrow=jac+i*m, tmp=e[i]; l<m; ++l)
|
||||
jacTe[l]+=jacrow[l]*tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute ||J^T e||_inf and ||p||^2 */
|
||||
for(i=0, p_L2=jacTe_inf=0.0; i<m; ++i){
|
||||
if(jacTe_inf < (tmp=FABS(jacTe[i]))) jacTe_inf=tmp;
|
||||
|
||||
diag_jacTjac[i]=jacTjac[i*m+i]; /* save diagonal entries so that augmentation can be later canceled */
|
||||
p_L2+=p[i]*p[i];
|
||||
}
|
||||
//p_L2=sqrt(p_L2);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(!(k%100)){
|
||||
printf("Current estimate: ");
|
||||
for(i=0; i<m; ++i)
|
||||
printf("%.9g ", p[i]);
|
||||
printf("-- errors %.9g %0.9g\n", jacTe_inf, p_eL2);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* check for convergence */
|
||||
if((jacTe_inf <= eps1)){
|
||||
Dp_L2=0.0; /* no increment for p in this case */
|
||||
stop=1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* compute initial damping factor */
|
||||
if(k==0){
|
||||
for(i=0, tmp=LM_REAL_MIN; i<m; ++i)
|
||||
if(diag_jacTjac[i]>tmp) tmp=diag_jacTjac[i]; /* find max diagonal element */
|
||||
mu=tau*tmp;
|
||||
}
|
||||
|
||||
/* determine increment using adaptive damping */
|
||||
|
||||
/* augment normal equations */
|
||||
for(i=0; i<m; ++i)
|
||||
jacTjac[i*m+i]+=mu;
|
||||
|
||||
/* solve augmented equations */
|
||||
#ifdef HAVE_LAPACK
|
||||
/* 7 alternatives are available: LU, Cholesky + Cholesky with PLASMA, LDLt, 2 variants of QR decomposition and SVD.
|
||||
* For matrices with dimensions of at least a few hundreds, the PLASMA implementation of Cholesky is the fastest.
|
||||
* From the serial solvers, Cholesky is the fastest but might occasionally be inapplicable due to numerical round-off;
|
||||
* QR is slower but more robust; SVD is the slowest but most robust; LU is quite robust but
|
||||
* slower than LDLt; LDLt offers a good tradeoff between robustness and speed
|
||||
*/
|
||||
|
||||
issolved=AX_EQ_B_BK(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_BK;
|
||||
//issolved=AX_EQ_B_LU(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_LU;
|
||||
//issolved=AX_EQ_B_CHOL(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_CHOL;
|
||||
#ifdef HAVE_PLASMA
|
||||
//issolved=AX_EQ_B_PLASMA_CHOL(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_PLASMA_CHOL;
|
||||
#endif
|
||||
//issolved=AX_EQ_B_QR(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_QR;
|
||||
//issolved=AX_EQ_B_QRLS(jacTjac, jacTe, Dp, m, m); ++nlss; linsolver=(int (*)(LM_REAL *A, LM_REAL *B, LM_REAL *x, int m))AX_EQ_B_QRLS;
|
||||
//issolved=AX_EQ_B_SVD(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_SVD;
|
||||
#else
|
||||
/* use the LU included with levmar */
|
||||
issolved=AX_EQ_B_LU(jacTjac, jacTe, Dp, m); ++nlss; linsolver=AX_EQ_B_LU;
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
if(issolved){
|
||||
/* compute p's new estimate and ||Dp||^2 */
|
||||
for(i=0, Dp_L2=0.0; i<m; ++i){
|
||||
pDp[i]=p[i] + (tmp=Dp[i]);
|
||||
Dp_L2+=tmp*tmp;
|
||||
}
|
||||
//Dp_L2=sqrt(Dp_L2);
|
||||
|
||||
if(Dp_L2<=eps2_sq*p_L2){ /* relative change in p is small, stop */
|
||||
//if(Dp_L2<=eps2*(p_L2 + eps2)){ /* relative change in p is small, stop */
|
||||
stop=2;
|
||||
break;
|
||||
}
|
||||
|
||||
if(Dp_L2>=(p_L2+eps2)/(LM_CNST(EPSILON)*LM_CNST(EPSILON))){ /* almost singular */
|
||||
//if(Dp_L2>=(p_L2+eps2)/LM_CNST(EPSILON)){ /* almost singular */
|
||||
stop=4;
|
||||
break;
|
||||
}
|
||||
|
||||
(*func)(pDp, wrk, m, n, adata); ++nfev; /* evaluate function at p + Dp */
|
||||
/* compute ||e(pDp)||_2 */
|
||||
/* ### wrk2=x-wrk, pDp_eL2=||wrk2|| */
|
||||
#if 1
|
||||
pDp_eL2=LEVMAR_L2NRMXMY(wrk2, x, wrk, n);
|
||||
#else
|
||||
for(i=0, pDp_eL2=0.0; i<n; ++i){
|
||||
wrk2[i]=tmp=x[i]-wrk[i];
|
||||
pDp_eL2+=tmp*tmp;
|
||||
}
|
||||
#endif
|
||||
if(!LM_FINITE(pDp_eL2)){ /* sum of squares is not finite, most probably due to a user error.
|
||||
* This check makes sure that the loop terminates early in the case
|
||||
* of invalid input. Thanks to Steve Danauskas for suggesting it
|
||||
*/
|
||||
|
||||
stop=7;
|
||||
break;
|
||||
}
|
||||
|
||||
dF=p_eL2-pDp_eL2;
|
||||
if(updp || dF>0){ /* update jac */
|
||||
for(i=0; i<n; ++i){
|
||||
for(l=0, tmp=0.0; l<m; ++l)
|
||||
tmp+=jac[i*m+l]*Dp[l]; /* (J * Dp)[i] */
|
||||
tmp=(wrk[i] - hx[i] - tmp)/Dp_L2; /* (f(p+dp)[i] - f(p)[i] - (J * Dp)[i])/(dp^T*dp) */
|
||||
for(j=0; j<m; ++j)
|
||||
jac[i*m+j]+=tmp*Dp[j];
|
||||
}
|
||||
++updjac;
|
||||
newjac=1;
|
||||
}
|
||||
|
||||
for(i=0, dL=0.0; i<m; ++i)
|
||||
dL+=Dp[i]*(mu*Dp[i]+jacTe[i]);
|
||||
|
||||
if(dL>0.0 && dF>0.0){ /* reduction in error, increment is accepted */
|
||||
tmp=(LM_CNST(2.0)*dF/dL-LM_CNST(1.0));
|
||||
tmp=LM_CNST(1.0)-tmp*tmp*tmp;
|
||||
mu=mu*( (tmp>=LM_CNST(ONE_THIRD))? tmp : LM_CNST(ONE_THIRD) );
|
||||
nu=2;
|
||||
|
||||
for(i=0 ; i<m; ++i) /* update p's estimate */
|
||||
p[i]=pDp[i];
|
||||
|
||||
for(i=0; i<n; ++i){ /* update e, hx and ||e||_2 */
|
||||
e[i]=wrk2[i]; //x[i]-wrk[i];
|
||||
hx[i]=wrk[i];
|
||||
}
|
||||
p_eL2=pDp_eL2;
|
||||
updp=1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* if this point is reached, either the linear system could not be solved or
|
||||
* the error did not reduce; in any case, the increment must be rejected
|
||||
*/
|
||||
|
||||
mu*=nu;
|
||||
nu2=nu<<1; // 2*nu;
|
||||
if(nu2<=nu){ /* nu has wrapped around (overflown). Thanks to Frank Jordan for spotting this case */
|
||||
stop=5;
|
||||
break;
|
||||
}
|
||||
nu=nu2;
|
||||
|
||||
for(i=0; i<m; ++i) /* restore diagonal J^T J entries */
|
||||
jacTjac[i*m+i]=diag_jacTjac[i];
|
||||
}
|
||||
|
||||
if(k>=itmax) stop=3;
|
||||
|
||||
for(i=0; i<m; ++i) /* restore diagonal J^T J entries */
|
||||
jacTjac[i*m+i]=diag_jacTjac[i];
|
||||
|
||||
if(info){
|
||||
info[0]=init_p_eL2;
|
||||
info[1]=p_eL2;
|
||||
info[2]=jacTe_inf;
|
||||
info[3]=Dp_L2;
|
||||
for(i=0, tmp=LM_REAL_MIN; i<m; ++i)
|
||||
if(tmp<jacTjac[i*m+i]) tmp=jacTjac[i*m+i];
|
||||
info[4]=mu/tmp;
|
||||
info[5]=(LM_REAL)k;
|
||||
info[6]=(LM_REAL)stop;
|
||||
info[7]=(LM_REAL)nfev;
|
||||
info[8]=(LM_REAL)njap;
|
||||
info[9]=(LM_REAL)nlss;
|
||||
}
|
||||
|
||||
/* covariance matrix */
|
||||
if(covar){
|
||||
LEVMAR_COVAR(jacTjac, covar, p_eL2, m, n);
|
||||
}
|
||||
|
||||
|
||||
if(freework) free(work);
|
||||
|
||||
#ifdef LINSOLVERS_RETAIN_MEMORY
|
||||
if(linsolver) (*linsolver)(NULL, NULL, NULL, 0);
|
||||
#endif
|
||||
|
||||
return (stop!=4 && stop!=7)? k : LM_ERROR;
|
||||
}
|
||||
|
||||
/* undefine everything. THIS MUST REMAIN AT THE END OF THE FILE */
|
||||
#undef LEVMAR_DER
|
||||
#undef LEVMAR_DIF
|
||||
#undef LEVMAR_FDIF_FORW_JAC_APPROX
|
||||
#undef LEVMAR_FDIF_CENT_JAC_APPROX
|
||||
#undef LEVMAR_COVAR
|
||||
#undef LEVMAR_TRANS_MAT_MAT_MULT
|
||||
#undef LEVMAR_L2NRMXMY
|
||||
#undef AX_EQ_B_LU
|
||||
#undef AX_EQ_B_CHOL
|
||||
#undef AX_EQ_B_PLASMA_CHOL
|
||||
#undef AX_EQ_B_QR
|
||||
#undef AX_EQ_B_QRLS
|
||||
#undef AX_EQ_B_SVD
|
||||
#undef AX_EQ_B_BK
|
||||
87
contrib/levmar/lmbc.c
Normal file
87
contrib/levmar/lmbc.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2004-05 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/********************************************************************************
|
||||
* Box-constrained Levenberg-Marquardt nonlinear minimization. The same core code
|
||||
* is used with appropriate #defines to derive single and double precision versions,
|
||||
* see also lmbc_core.c
|
||||
********************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "levmar.h"
|
||||
#include "compiler.h"
|
||||
#include "misc.h"
|
||||
|
||||
#define EPSILON 1E-12
|
||||
#define ONE_THIRD 0.3333333334 /* 1.0/3.0 */
|
||||
#define _LSITMAX_ 150 /* max #iterations for line search */
|
||||
#define _POW_ 2.1
|
||||
|
||||
#if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC)
|
||||
#error At least one of LM_DBL_PREC, LM_SNGL_PREC should be defined!
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
/* single precision (float) definitions */
|
||||
#define LM_REAL float
|
||||
#define LM_PREFIX s
|
||||
|
||||
#define LM_REAL_MAX FLT_MAX
|
||||
#define LM_REAL_MIN -FLT_MAX
|
||||
|
||||
#define LM_REAL_EPSILON FLT_EPSILON
|
||||
#define __SUBCNST(x) x##F
|
||||
#define LM_CNST(x) __SUBCNST(x) // force substitution
|
||||
|
||||
#include "lmbc_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_REAL_MAX
|
||||
#undef LM_REAL_MIN
|
||||
#undef LM_REAL_EPSILON
|
||||
#undef __SUBCNST
|
||||
#undef LM_CNST
|
||||
#endif /* LM_SNGL_PREC */
|
||||
|
||||
#ifdef LM_DBL_PREC
|
||||
/* double precision definitions */
|
||||
#define LM_REAL double
|
||||
#define LM_PREFIX d
|
||||
|
||||
#define LM_REAL_MAX DBL_MAX
|
||||
#define LM_REAL_MIN -DBL_MAX
|
||||
|
||||
#define LM_REAL_EPSILON DBL_EPSILON
|
||||
#define LM_CNST(x) (x)
|
||||
|
||||
#include "lmbc_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_REAL_MAX
|
||||
#undef LM_REAL_MIN
|
||||
#undef LM_REAL_EPSILON
|
||||
#undef LM_CNST
|
||||
#endif /* LM_DBL_PREC */
|
||||
1154
contrib/levmar/lmbc_core.c
Normal file
1154
contrib/levmar/lmbc_core.c
Normal file
File diff suppressed because it is too large
Load Diff
87
contrib/levmar/lmblec.c
Normal file
87
contrib/levmar/lmblec.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2004-06 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/********************************************************************************
|
||||
* combined box and linear equation constraints Levenberg-Marquardt nonlinear
|
||||
* minimization. The same core code is used with appropriate #defines to derive
|
||||
* single and double precision versions, see also lmblec_core.c
|
||||
********************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "levmar.h"
|
||||
#include "misc.h"
|
||||
|
||||
#ifndef HAVE_LAPACK
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("Combined box and linearly constrained optimization requires LAPACK and was not compiled!")
|
||||
#else
|
||||
#warning Combined box and linearly constrained optimization requires LAPACK and was not compiled!
|
||||
#endif // _MSC_VER
|
||||
|
||||
#else // LAPACK present
|
||||
|
||||
#if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC)
|
||||
#error At least one of LM_DBL_PREC, LM_SNGL_PREC should be defined!
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
/* single precision (float) definitions */
|
||||
#define LM_REAL float
|
||||
#define LM_PREFIX s
|
||||
|
||||
#define LM_REAL_MAX FLT_MAX
|
||||
#define LM_REAL_MIN -FLT_MAX
|
||||
#define __SUBCNST(x) x##F
|
||||
#define LM_CNST(x) __SUBCNST(x) // force substitution
|
||||
|
||||
#include "lmblec_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_REAL_MAX
|
||||
#undef LM_REAL_MIN
|
||||
#undef __SUBCNST
|
||||
#undef LM_CNST
|
||||
#endif /* LM_SNGL_PREC */
|
||||
|
||||
#ifdef LM_DBL_PREC
|
||||
/* double precision definitions */
|
||||
#define LM_REAL double
|
||||
#define LM_PREFIX d
|
||||
|
||||
#define LM_REAL_MAX DBL_MAX
|
||||
#define LM_REAL_MIN -DBL_MAX
|
||||
#define LM_CNST(x) (x)
|
||||
|
||||
#include "lmblec_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_REAL_MAX
|
||||
#undef LM_REAL_MIN
|
||||
#undef LM_CNST
|
||||
#endif /* LM_DBL_PREC */
|
||||
|
||||
#endif /* HAVE_LAPACK */
|
||||
413
contrib/levmar/lmblec_core.c
Normal file
413
contrib/levmar/lmblec_core.c
Normal file
@@ -0,0 +1,413 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2004-06 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*******************************************************************************
|
||||
* This file implements combined box and linear equation constraints.
|
||||
*
|
||||
* Note that the algorithm implementing linearly constrained minimization does
|
||||
* so by a change in parameters that transforms the original program into an
|
||||
* unconstrained one. To employ the same idea for implementing box & linear
|
||||
* constraints would require the transformation of box constraints on the
|
||||
* original parameters to box constraints for the new parameter set. This
|
||||
* being impossible, a different approach is used here for finding the minimum.
|
||||
* The trick is to remove the box constraints by augmenting the function to
|
||||
* be fitted with penalty terms and then solve the resulting problem (which
|
||||
* involves linear constrains only) with the functions in lmlec.c
|
||||
*
|
||||
* More specifically, for the constraint a<=x[i]<=b to hold, the term C[i]=
|
||||
* (2*x[i]-(a+b))/(b-a) should be within [-1, 1]. This is enforced by adding
|
||||
* the penalty term w[i]*max((C[i])^2-1, 0) to the objective function, where
|
||||
* w[i] is a large weight. In the case of constraints of the form a<=x[i],
|
||||
* the term C[i]=a-x[i] has to be non positive, thus the penalty term is
|
||||
* w[i]*max(C[i], 0). If x[i]<=b, C[i]=x[i]-b has to be non negative and
|
||||
* the penalty is w[i]*max(C[i], 0). The derivatives needed for the Jacobian
|
||||
* are as follows:
|
||||
* For the constraint a<=x[i]<=b: 4*(2*x[i]-(a+b))/(b-a)^2 if x[i] not in [a, b],
|
||||
* 0 otherwise
|
||||
* For the constraint a<=x[i]: -1 if x[i]<=a, 0 otherwise
|
||||
* For the constraint x[i]<=b: 1 if b<=x[i], 0 otherwise
|
||||
*
|
||||
* Note that for the above to work, the weights w[i] should be large enough;
|
||||
* depending on your minimization problem, the default values might need some
|
||||
* tweaking (see arg "wghts" below).
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef LM_REAL // not included by lmblec.c
|
||||
#error This file should not be compiled directly!
|
||||
#endif
|
||||
|
||||
|
||||
#define __MAX__(x, y) (((x)>=(y))? (x) : (y))
|
||||
#define __BC_WEIGHT__ LM_CNST(1E+04)
|
||||
|
||||
#define __BC_INTERVAL__ 0
|
||||
#define __BC_LOW__ 1
|
||||
#define __BC_HIGH__ 2
|
||||
|
||||
/* precision-specific definitions */
|
||||
#define LEVMAR_BOX_CHECK LM_ADD_PREFIX(levmar_box_check)
|
||||
#define LMBLEC_DATA LM_ADD_PREFIX(lmblec_data)
|
||||
#define LMBLEC_FUNC LM_ADD_PREFIX(lmblec_func)
|
||||
#define LMBLEC_JACF LM_ADD_PREFIX(lmblec_jacf)
|
||||
#define LEVMAR_LEC_DER LM_ADD_PREFIX(levmar_lec_der)
|
||||
#define LEVMAR_LEC_DIF LM_ADD_PREFIX(levmar_lec_dif)
|
||||
#define LEVMAR_BLEC_DER LM_ADD_PREFIX(levmar_blec_der)
|
||||
#define LEVMAR_BLEC_DIF LM_ADD_PREFIX(levmar_blec_dif)
|
||||
#define LEVMAR_COVAR LM_ADD_PREFIX(levmar_covar)
|
||||
|
||||
struct LMBLEC_DATA{
|
||||
LM_REAL *x, *lb, *ub, *w;
|
||||
int *bctype;
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata);
|
||||
void (*jacf)(LM_REAL *p, LM_REAL *jac, int m, int n, void *adata);
|
||||
void *adata;
|
||||
};
|
||||
|
||||
/* augmented measurements */
|
||||
static void LMBLEC_FUNC(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata)
|
||||
{
|
||||
struct LMBLEC_DATA *data=(struct LMBLEC_DATA *)adata;
|
||||
int nn;
|
||||
register int i, j, *typ;
|
||||
register LM_REAL *lb, *ub, *w, tmp;
|
||||
|
||||
nn=n-m;
|
||||
lb=data->lb;
|
||||
ub=data->ub;
|
||||
w=data->w;
|
||||
typ=data->bctype;
|
||||
(*(data->func))(p, hx, m, nn, data->adata);
|
||||
|
||||
for(i=nn, j=0; i<n; ++i, ++j){
|
||||
switch(typ[j]){
|
||||
case __BC_INTERVAL__:
|
||||
tmp=(LM_CNST(2.0)*p[j]-(lb[j]+ub[j]))/(ub[j]-lb[j]);
|
||||
hx[i]=w[j]*__MAX__(tmp*tmp-LM_CNST(1.0), LM_CNST(0.0));
|
||||
break;
|
||||
|
||||
case __BC_LOW__:
|
||||
hx[i]=w[j]*__MAX__(lb[j]-p[j], LM_CNST(0.0));
|
||||
break;
|
||||
|
||||
case __BC_HIGH__:
|
||||
hx[i]=w[j]*__MAX__(p[j]-ub[j], LM_CNST(0.0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* augmented Jacobian */
|
||||
static void LMBLEC_JACF(LM_REAL *p, LM_REAL *jac, int m, int n, void *adata)
|
||||
{
|
||||
struct LMBLEC_DATA *data=(struct LMBLEC_DATA *)adata;
|
||||
int nn, *typ;
|
||||
register int i, j;
|
||||
register LM_REAL *lb, *ub, *w, tmp;
|
||||
|
||||
nn=n-m;
|
||||
lb=data->lb;
|
||||
ub=data->ub;
|
||||
w=data->w;
|
||||
typ=data->bctype;
|
||||
(*(data->jacf))(p, jac, m, nn, data->adata);
|
||||
|
||||
/* clear all extra rows */
|
||||
for(i=nn*m; i<n*m; ++i)
|
||||
jac[i]=0.0;
|
||||
|
||||
for(i=nn, j=0; i<n; ++i, ++j){
|
||||
switch(typ[j]){
|
||||
case __BC_INTERVAL__:
|
||||
if(lb[j]<=p[j] && p[j]<=ub[j])
|
||||
continue; // corresp. jac element already 0
|
||||
|
||||
/* out of interval */
|
||||
tmp=ub[j]-lb[j];
|
||||
tmp=LM_CNST(4.0)*(LM_CNST(2.0)*p[j]-(lb[j]+ub[j]))/(tmp*tmp);
|
||||
jac[i*m+j]=w[j]*tmp;
|
||||
break;
|
||||
|
||||
case __BC_LOW__: // (lb[j]<=p[j])? 0.0 : -1.0;
|
||||
if(lb[j]<=p[j])
|
||||
continue; // corresp. jac element already 0
|
||||
|
||||
/* smaller than lower bound */
|
||||
jac[i*m+j]=-w[j];
|
||||
break;
|
||||
|
||||
case __BC_HIGH__: // (p[j]<=ub[j])? 0.0 : 1.0;
|
||||
if(p[j]<=ub[j])
|
||||
continue; // corresp. jac element already 0
|
||||
|
||||
/* greater than upper bound */
|
||||
jac[i*m+j]=w[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function seeks the parameter vector p that best describes the measurements
|
||||
* vector x under box & linear constraints.
|
||||
* More precisely, given a vector function func : R^m --> R^n with n>=m,
|
||||
* it finds p s.t. func(p) ~= x, i.e. the squared second order (i.e. L2) norm of
|
||||
* e=x-func(p) is minimized under the constraints lb[i]<=p[i]<=ub[i] and A p=b;
|
||||
* A is kxm, b kx1. Note that this function DOES NOT check the satisfiability of
|
||||
* the specified box and linear equation constraints.
|
||||
* If no lower bound constraint applies for p[i], use -DBL_MAX/-FLT_MAX for lb[i];
|
||||
* If no upper bound constraint applies for p[i], use DBL_MAX/FLT_MAX for ub[i].
|
||||
*
|
||||
* This function requires an analytic Jacobian. In case the latter is unavailable,
|
||||
* use LEVMAR_BLEC_DIF() bellow
|
||||
*
|
||||
* Returns the number of iterations (>=0) if successful, LM_ERROR if failed
|
||||
*
|
||||
* For more details on the algorithm implemented by this function, please refer to
|
||||
* the comments in the top of this file.
|
||||
*
|
||||
*/
|
||||
int LEVMAR_BLEC_DER(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata), /* functional relation describing measurements. A p \in R^m yields a \hat{x} \in R^n */
|
||||
void (*jacf)(LM_REAL *p, LM_REAL *j, int m, int n, void *adata), /* function to evaluate the Jacobian \part x / \part p */
|
||||
LM_REAL *p, /* I/O: initial parameter estimates. On output has the estimated solution */
|
||||
LM_REAL *x, /* I: measurement vector. NULL implies a zero vector */
|
||||
int m, /* I: parameter vector dimension (i.e. #unknowns) */
|
||||
int n, /* I: measurement vector dimension */
|
||||
LM_REAL *lb, /* I: vector of lower bounds. If NULL, no lower bounds apply */
|
||||
LM_REAL *ub, /* I: vector of upper bounds. If NULL, no upper bounds apply */
|
||||
LM_REAL *A, /* I: constraints matrix, kxm */
|
||||
LM_REAL *b, /* I: right hand constraints vector, kx1 */
|
||||
int k, /* I: number of constraints (i.e. A's #rows) */
|
||||
LM_REAL *wghts, /* mx1 weights for penalty terms, defaults used if NULL */
|
||||
int itmax, /* I: maximum number of iterations */
|
||||
LM_REAL opts[4], /* I: minim. options [\mu, \epsilon1, \epsilon2, \epsilon3]. Respectively the scale factor for initial \mu,
|
||||
* stopping thresholds for ||J^T e||_inf, ||Dp||_2 and ||e||_2. Set to NULL for defaults to be used
|
||||
*/
|
||||
LM_REAL info[LM_INFO_SZ],
|
||||
/* O: information regarding the minimization. Set to NULL if don't care
|
||||
* info[0]= ||e||_2 at initial p.
|
||||
* info[1-4]=[ ||e||_2, ||J^T e||_inf, ||Dp||_2, mu/max[J^T J]_ii ], all computed at estimated p.
|
||||
* info[5]= # iterations,
|
||||
* info[6]=reason for terminating: 1 - stopped by small gradient J^T e
|
||||
* 2 - stopped by small Dp
|
||||
* 3 - stopped by itmax
|
||||
* 4 - singular matrix. Restart from current p with increased mu
|
||||
* 5 - no further error reduction is possible. Restart with increased mu
|
||||
* 6 - stopped by small ||e||_2
|
||||
* 7 - stopped by invalid (i.e. NaN or Inf) "func" values. This is a user error
|
||||
* info[7]= # function evaluations
|
||||
* info[8]= # Jacobian evaluations
|
||||
* info[9]= # linear systems solved, i.e. # attempts for reducing error
|
||||
*/
|
||||
LM_REAL *work, /* working memory at least LM_BLEC_DER_WORKSZ() reals large, allocated if NULL */
|
||||
LM_REAL *covar, /* O: Covariance matrix corresponding to LS solution; mxm. Set to NULL if not needed. */
|
||||
void *adata) /* pointer to possibly additional data, passed uninterpreted to func & jacf.
|
||||
* Set to NULL if not needed
|
||||
*/
|
||||
{
|
||||
struct LMBLEC_DATA data;
|
||||
int ret;
|
||||
LM_REAL locinfo[LM_INFO_SZ];
|
||||
register int i;
|
||||
|
||||
if(!jacf){
|
||||
fprintf(stderr, RCAT("No function specified for computing the Jacobian in ", LEVMAR_BLEC_DER)
|
||||
RCAT("().\nIf no such function is available, use ", LEVMAR_BLEC_DIF) RCAT("() rather than ", LEVMAR_BLEC_DER) "()\n");
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
if(!lb && !ub){
|
||||
fprintf(stderr, RCAT(LCAT(LEVMAR_BLEC_DER, "(): lower and upper bounds for box constraints cannot be both NULL, use "),
|
||||
LEVMAR_LEC_DER) "() in this case!\n");
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
if(!LEVMAR_BOX_CHECK(lb, ub, m)){
|
||||
fprintf(stderr, LCAT(LEVMAR_BLEC_DER, "(): at least one lower bound exceeds the upper one\n"));
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
/* measurement vector needs to be extended by m */
|
||||
if(x){ /* nonzero x */
|
||||
data.x=(LM_REAL *)malloc((n+m)*sizeof(LM_REAL));
|
||||
if(!data.x){
|
||||
fprintf(stderr, LCAT(LEVMAR_BLEC_DER, "(): memory allocation request #1 failed\n"));
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
for(i=0; i<n; ++i)
|
||||
data.x[i]=x[i];
|
||||
for(i=n; i<n+m; ++i)
|
||||
data.x[i]=0.0;
|
||||
}
|
||||
else
|
||||
data.x=NULL;
|
||||
|
||||
data.w=(LM_REAL *)malloc(m*sizeof(LM_REAL) + m*sizeof(int)); /* should be arranged in that order for proper doubles alignment */
|
||||
if(!data.w){
|
||||
fprintf(stderr, LCAT(LEVMAR_BLEC_DER, "(): memory allocation request #2 failed\n"));
|
||||
if(data.x) free(data.x);
|
||||
return LM_ERROR;
|
||||
}
|
||||
data.bctype=(int *)(data.w+m);
|
||||
|
||||
/* note: at this point, one of lb, ub are not NULL */
|
||||
for(i=0; i<m; ++i){
|
||||
data.w[i]=(!wghts)? __BC_WEIGHT__ : wghts[i];
|
||||
if(!lb) data.bctype[i]=__BC_HIGH__;
|
||||
else if(!ub) data.bctype[i]=__BC_LOW__;
|
||||
else if(ub[i]!=LM_REAL_MAX && lb[i]!=LM_REAL_MIN) data.bctype[i]=__BC_INTERVAL__;
|
||||
else if(lb[i]!=LM_REAL_MIN) data.bctype[i]=__BC_LOW__;
|
||||
else data.bctype[i]=__BC_HIGH__;
|
||||
}
|
||||
|
||||
data.lb=lb;
|
||||
data.ub=ub;
|
||||
data.func=func;
|
||||
data.jacf=jacf;
|
||||
data.adata=adata;
|
||||
|
||||
if(!info) info=locinfo; /* make sure that LEVMAR_LEC_DER() is called with non-null info */
|
||||
ret=LEVMAR_LEC_DER(LMBLEC_FUNC, LMBLEC_JACF, p, data.x, m, n+m, A, b, k, itmax, opts, info, work, covar, (void *)&data);
|
||||
|
||||
if(data.x) free(data.x);
|
||||
free(data.w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Similar to the LEVMAR_BLEC_DER() function above, except that the Jacobian is approximated
|
||||
* with the aid of finite differences (forward or central, see the comment for the opts argument)
|
||||
*/
|
||||
int LEVMAR_BLEC_DIF(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata), /* functional relation describing measurements. A p \in R^m yields a \hat{x} \in R^n */
|
||||
LM_REAL *p, /* I/O: initial parameter estimates. On output has the estimated solution */
|
||||
LM_REAL *x, /* I: measurement vector. NULL implies a zero vector */
|
||||
int m, /* I: parameter vector dimension (i.e. #unknowns) */
|
||||
int n, /* I: measurement vector dimension */
|
||||
LM_REAL *lb, /* I: vector of lower bounds. If NULL, no lower bounds apply */
|
||||
LM_REAL *ub, /* I: vector of upper bounds. If NULL, no upper bounds apply */
|
||||
LM_REAL *A, /* I: constraints matrix, kxm */
|
||||
LM_REAL *b, /* I: right hand constraints vector, kx1 */
|
||||
int k, /* I: number of constraints (i.e. A's #rows) */
|
||||
LM_REAL *wghts, /* mx1 weights for penalty terms, defaults used if NULL */
|
||||
int itmax, /* I: maximum number of iterations */
|
||||
LM_REAL opts[5], /* I: opts[0-3] = minim. options [\mu, \epsilon1, \epsilon2, \epsilon3, \delta]. Respectively the
|
||||
* scale factor for initial \mu, stopping thresholds for ||J^T e||_inf, ||Dp||_2 and ||e||_2 and
|
||||
* the step used in difference approximation to the Jacobian. Set to NULL for defaults to be used.
|
||||
* If \delta<0, the Jacobian is approximated with central differences which are more accurate
|
||||
* (but slower!) compared to the forward differences employed by default.
|
||||
*/
|
||||
LM_REAL info[LM_INFO_SZ],
|
||||
/* O: information regarding the minimization. Set to NULL if don't care
|
||||
* info[0]= ||e||_2 at initial p.
|
||||
* info[1-4]=[ ||e||_2, ||J^T e||_inf, ||Dp||_2, mu/max[J^T J]_ii ], all computed at estimated p.
|
||||
* info[5]= # iterations,
|
||||
* info[6]=reason for terminating: 1 - stopped by small gradient J^T e
|
||||
* 2 - stopped by small Dp
|
||||
* 3 - stopped by itmax
|
||||
* 4 - singular matrix. Restart from current p with increased mu
|
||||
* 5 - no further error reduction is possible. Restart with increased mu
|
||||
* 6 - stopped by small ||e||_2
|
||||
* 7 - stopped by invalid (i.e. NaN or Inf) "func" values. This is a user error
|
||||
* info[7]= # function evaluations
|
||||
* info[8]= # Jacobian evaluations
|
||||
* info[9]= # linear systems solved, i.e. # attempts for reducing error
|
||||
*/
|
||||
LM_REAL *work, /* working memory at least LM_BLEC_DIF_WORKSZ() reals large, allocated if NULL */
|
||||
LM_REAL *covar, /* O: Covariance matrix corresponding to LS solution; mxm. Set to NULL if not needed. */
|
||||
void *adata) /* pointer to possibly additional data, passed uninterpreted to func.
|
||||
* Set to NULL if not needed
|
||||
*/
|
||||
{
|
||||
struct LMBLEC_DATA data;
|
||||
int ret;
|
||||
register int i;
|
||||
LM_REAL locinfo[LM_INFO_SZ];
|
||||
|
||||
if(!lb && !ub){
|
||||
fprintf(stderr, RCAT(LCAT(LEVMAR_BLEC_DIF, "(): lower and upper bounds for box constraints cannot be both NULL, use "),
|
||||
LEVMAR_LEC_DIF) "() in this case!\n");
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
if(!LEVMAR_BOX_CHECK(lb, ub, m)){
|
||||
fprintf(stderr, LCAT(LEVMAR_BLEC_DER, "(): at least one lower bound exceeds the upper one\n"));
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
/* measurement vector needs to be extended by m */
|
||||
if(x){ /* nonzero x */
|
||||
data.x=(LM_REAL *)malloc((n+m)*sizeof(LM_REAL));
|
||||
if(!data.x){
|
||||
fprintf(stderr, LCAT(LEVMAR_BLEC_DER, "(): memory allocation request #1 failed\n"));
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
for(i=0; i<n; ++i)
|
||||
data.x[i]=x[i];
|
||||
for(i=n; i<n+m; ++i)
|
||||
data.x[i]=0.0;
|
||||
}
|
||||
else
|
||||
data.x=NULL;
|
||||
|
||||
data.w=(LM_REAL *)malloc(m*sizeof(LM_REAL) + m*sizeof(int)); /* should be arranged in that order for proper doubles alignment */
|
||||
if(!data.w){
|
||||
fprintf(stderr, LCAT(LEVMAR_BLEC_DER, "(): memory allocation request #2 failed\n"));
|
||||
if(data.x) free(data.x);
|
||||
return LM_ERROR;
|
||||
}
|
||||
data.bctype=(int *)(data.w+m);
|
||||
|
||||
/* note: at this point, one of lb, ub are not NULL */
|
||||
for(i=0; i<m; ++i){
|
||||
data.w[i]=(!wghts)? __BC_WEIGHT__ : wghts[i];
|
||||
if(!lb) data.bctype[i]=__BC_HIGH__;
|
||||
else if(!ub) data.bctype[i]=__BC_LOW__;
|
||||
else if(ub[i]!=LM_REAL_MAX && lb[i]!=LM_REAL_MIN) data.bctype[i]=__BC_INTERVAL__;
|
||||
else if(lb[i]!=LM_REAL_MIN) data.bctype[i]=__BC_LOW__;
|
||||
else data.bctype[i]=__BC_HIGH__;
|
||||
}
|
||||
|
||||
data.lb=lb;
|
||||
data.ub=ub;
|
||||
data.func=func;
|
||||
data.jacf=NULL;
|
||||
data.adata=adata;
|
||||
|
||||
if(!info) info=locinfo; /* make sure that LEVMAR_LEC_DIF() is called with non-null info */
|
||||
ret=LEVMAR_LEC_DIF(LMBLEC_FUNC, p, data.x, m, n+m, A, b, k, itmax, opts, info, work, covar, (void *)&data);
|
||||
|
||||
if(data.x) free(data.x);
|
||||
free(data.w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* undefine all. THIS MUST REMAIN AT THE END OF THE FILE */
|
||||
#undef LEVMAR_BOX_CHECK
|
||||
#undef LMBLEC_DATA
|
||||
#undef LMBLEC_FUNC
|
||||
#undef LMBLEC_JACF
|
||||
#undef LEVMAR_COVAR
|
||||
#undef LEVMAR_LEC_DER
|
||||
#undef LEVMAR_LEC_DIF
|
||||
#undef LEVMAR_BLEC_DER
|
||||
#undef LEVMAR_BLEC_DIF
|
||||
89
contrib/levmar/lmbleic.c
Normal file
89
contrib/levmar/lmbleic.c
Normal file
@@ -0,0 +1,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2009 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*******************************************************************************
|
||||
* Wrappers for linear inequality constrained Levenberg-Marquardt minimization.
|
||||
* The same core code is used with appropriate #defines to derive single and
|
||||
* double precision versions, see also lmbleic_core.c
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "levmar.h"
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
#ifndef HAVE_LAPACK
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("Linear inequalities constrained optimization requires LAPACK and was not compiled!")
|
||||
#else
|
||||
#warning Linear inequalities constrained optimization requires LAPACK and was not compiled!
|
||||
#endif // _MSC_VER
|
||||
|
||||
#else // LAPACK present
|
||||
|
||||
#if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC)
|
||||
#error At least one of LM_DBL_PREC, LM_SNGL_PREC should be defined!
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
/* single precision (float) definitions */
|
||||
#define LM_REAL float
|
||||
#define LM_PREFIX s
|
||||
|
||||
#define LM_REAL_MAX FLT_MAX
|
||||
#define LM_REAL_MIN -FLT_MAX
|
||||
#define __SUBCNST(x) x##F
|
||||
#define LM_CNST(x) __SUBCNST(x) // force substitution
|
||||
|
||||
#include "lmbleic_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_REAL_MAX
|
||||
#undef LM_REAL_MIN
|
||||
#undef __SUBCNST
|
||||
#undef LM_CNST
|
||||
#endif /* LM_SNGL_PREC */
|
||||
|
||||
#ifdef LM_DBL_PREC
|
||||
/* double precision definitions */
|
||||
#define LM_REAL double
|
||||
#define LM_PREFIX d
|
||||
|
||||
#define LM_REAL_MAX DBL_MAX
|
||||
#define LM_REAL_MIN -DBL_MAX
|
||||
#define LM_CNST(x) (x)
|
||||
|
||||
#include "lmbleic_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_REAL_MAX
|
||||
#undef LM_REAL_MIN
|
||||
#undef LM_CNST
|
||||
#endif /* LM_DBL_PREC */
|
||||
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
506
contrib/levmar/lmbleic_core.c
Normal file
506
contrib/levmar/lmbleic_core.c
Normal file
@@ -0,0 +1,506 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2009 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef LM_REAL // not included by lmbleic.c
|
||||
#error This file should not be compiled directly!
|
||||
#endif
|
||||
|
||||
|
||||
/* precision-specific definitions */
|
||||
#define LMBLEIC_DATA LM_ADD_PREFIX(lmbleic_data)
|
||||
#define LMBLEIC_ELIM LM_ADD_PREFIX(lmbleic_elim)
|
||||
#define LMBLEIC_FUNC LM_ADD_PREFIX(lmbleic_func)
|
||||
#define LMBLEIC_JACF LM_ADD_PREFIX(lmbleic_jacf)
|
||||
#define LEVMAR_BLEIC_DER LM_ADD_PREFIX(levmar_bleic_der)
|
||||
#define LEVMAR_BLEIC_DIF LM_ADD_PREFIX(levmar_bleic_dif)
|
||||
#define LEVMAR_BLIC_DER LM_ADD_PREFIX(levmar_blic_der)
|
||||
#define LEVMAR_BLIC_DIF LM_ADD_PREFIX(levmar_blic_dif)
|
||||
#define LEVMAR_LEIC_DER LM_ADD_PREFIX(levmar_leic_der)
|
||||
#define LEVMAR_LEIC_DIF LM_ADD_PREFIX(levmar_leic_dif)
|
||||
#define LEVMAR_LIC_DER LM_ADD_PREFIX(levmar_lic_der)
|
||||
#define LEVMAR_LIC_DIF LM_ADD_PREFIX(levmar_lic_dif)
|
||||
#define LEVMAR_BLEC_DER LM_ADD_PREFIX(levmar_blec_der)
|
||||
#define LEVMAR_BLEC_DIF LM_ADD_PREFIX(levmar_blec_dif)
|
||||
#define LEVMAR_TRANS_MAT_MAT_MULT LM_ADD_PREFIX(levmar_trans_mat_mat_mult)
|
||||
#define LEVMAR_COVAR LM_ADD_PREFIX(levmar_covar)
|
||||
#define LEVMAR_FDIF_FORW_JAC_APPROX LM_ADD_PREFIX(levmar_fdif_forw_jac_approx)
|
||||
|
||||
struct LMBLEIC_DATA{
|
||||
LM_REAL *jac;
|
||||
int nineqcnstr; // #inequality constraints
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata);
|
||||
void (*jacf)(LM_REAL *p, LM_REAL *jac, int m, int n, void *adata);
|
||||
void *adata;
|
||||
};
|
||||
|
||||
|
||||
/* wrapper ensuring that the user-supplied function is called with the right number of variables (i.e. m) */
|
||||
static void LMBLEIC_FUNC(LM_REAL *pext, LM_REAL *hx, int mm, int n, void *adata)
|
||||
{
|
||||
struct LMBLEIC_DATA *data=(struct LMBLEIC_DATA *)adata;
|
||||
int m;
|
||||
|
||||
m=mm-data->nineqcnstr;
|
||||
(*(data->func))(pext, hx, m, n, data->adata);
|
||||
}
|
||||
|
||||
|
||||
/* wrapper for computing the Jacobian at pext. The Jacobian is nxmm */
|
||||
static void LMBLEIC_JACF(LM_REAL *pext, LM_REAL *jacext, int mm, int n, void *adata)
|
||||
{
|
||||
struct LMBLEIC_DATA *data=(struct LMBLEIC_DATA *)adata;
|
||||
int m;
|
||||
register int i, j;
|
||||
LM_REAL *jac, *jacim, *jacextimm;
|
||||
|
||||
m=mm-data->nineqcnstr;
|
||||
jac=data->jac;
|
||||
|
||||
(*(data->jacf))(pext, jac, m, n, data->adata);
|
||||
|
||||
for(i=0; i<n; ++i){
|
||||
jacextimm=jacext+i*mm;
|
||||
jacim=jac+i*m;
|
||||
for(j=0; j<m; ++j)
|
||||
jacextimm[j]=jacim[j]; //jacext[i*mm+j]=jac[i*m+j];
|
||||
|
||||
for(j=m; j<mm; ++j)
|
||||
jacextimm[j]=0.0; //jacext[i*mm+j]=0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function is similar to LEVMAR_DER except that the minimization is
|
||||
* performed subject to the box constraints lb[i]<=p[i]<=ub[i], the linear
|
||||
* equation constraints A*p=b, A being k1xm, b k1x1, and the linear inequality
|
||||
* constraints C*p>=d, C being k2xm, d k2x1.
|
||||
*
|
||||
* The inequalities are converted to equations by introducing surplus variables,
|
||||
* i.e. c^T*p >= d becomes c^T*p - y = d, with y>=0. To transform all inequalities
|
||||
* to equations, a total of k2 surplus variables are introduced; a problem with only
|
||||
* box and linear constraints results then and is solved with LEVMAR_BLEC_DER()
|
||||
* Note that opposite direction inequalities should be converted to the desired
|
||||
* direction by negating, i.e. c^T*p <= d becomes -c^T*p >= -d
|
||||
*
|
||||
* This function requires an analytic Jacobian. In case the latter is unavailable,
|
||||
* use LEVMAR_BLEIC_DIF() bellow
|
||||
*
|
||||
*/
|
||||
int LEVMAR_BLEIC_DER(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata), /* functional relation describing measurements. A p \in R^m yields a \hat{x} \in R^n */
|
||||
void (*jacf)(LM_REAL *p, LM_REAL *j, int m, int n, void *adata), /* function to evaluate the Jacobian \part x / \part p */
|
||||
LM_REAL *p, /* I/O: initial parameter estimates. On output has the estimated solution */
|
||||
LM_REAL *x, /* I: measurement vector. NULL implies a zero vector */
|
||||
int m, /* I: parameter vector dimension (i.e. #unknowns) */
|
||||
int n, /* I: measurement vector dimension */
|
||||
LM_REAL *lb, /* I: vector of lower bounds. If NULL, no lower bounds apply */
|
||||
LM_REAL *ub, /* I: vector of upper bounds. If NULL, no upper bounds apply */
|
||||
LM_REAL *A, /* I: equality constraints matrix, k1xm. If NULL, no linear equation constraints apply */
|
||||
LM_REAL *b, /* I: right hand constraints vector, k1x1 */
|
||||
int k1, /* I: number of constraints (i.e. A's #rows) */
|
||||
LM_REAL *C, /* I: inequality constraints matrix, k2xm */
|
||||
LM_REAL *d, /* I: right hand constraints vector, k2x1 */
|
||||
int k2, /* I: number of inequality constraints (i.e. C's #rows) */
|
||||
int itmax, /* I: maximum number of iterations */
|
||||
LM_REAL opts[4], /* I: minim. options [\mu, \epsilon1, \epsilon2, \epsilon3]. Respectively the scale factor for initial \mu,
|
||||
* stopping thresholds for ||J^T e||_inf, ||Dp||_2 and ||e||_2. Set to NULL for defaults to be used
|
||||
*/
|
||||
LM_REAL info[LM_INFO_SZ],
|
||||
/* O: information regarding the minimization. Set to NULL if don't care
|
||||
* info[0]= ||e||_2 at initial p.
|
||||
* info[1-4]=[ ||e||_2, ||J^T e||_inf, ||Dp||_2, mu/max[J^T J]_ii ], all computed at estimated p.
|
||||
* info[5]= # iterations,
|
||||
* info[6]=reason for terminating: 1 - stopped by small gradient J^T e
|
||||
* 2 - stopped by small Dp
|
||||
* 3 - stopped by itmax
|
||||
* 4 - singular matrix. Restart from current p with increased mu
|
||||
* 5 - no further error reduction is possible. Restart with increased mu
|
||||
* 6 - stopped by small ||e||_2
|
||||
* 7 - stopped by invalid (i.e. NaN or Inf) "func" values. This is a user error
|
||||
* info[7]= # function evaluations
|
||||
* info[8]= # Jacobian evaluations
|
||||
* info[9]= # linear systems solved, i.e. # attempts for reducing error
|
||||
*/
|
||||
LM_REAL *work, /* working memory at least LM_BLEIC_DER_WORKSZ() reals large, allocated if NULL */
|
||||
LM_REAL *covar, /* O: Covariance matrix corresponding to LS solution; mxm. Set to NULL if not needed. */
|
||||
void *adata) /* pointer to possibly additional data, passed uninterpreted to func & jacf.
|
||||
* Set to NULL if not needed
|
||||
*/
|
||||
{
|
||||
struct LMBLEIC_DATA data;
|
||||
LM_REAL *ptr, *pext, *Aext, *bext, *covext; /* corresponding to p, A, b, covar for the full set of variables;
|
||||
pext=[p, surplus], pext is mm, Aext is (k1+k2)xmm, bext (k1+k2), covext is mmxmm
|
||||
*/
|
||||
LM_REAL *lbext, *ubext; // corresponding to lb, ub for the full set of variables
|
||||
int mm, ret, k12;
|
||||
register int i, j, ii;
|
||||
register LM_REAL tmp;
|
||||
LM_REAL locinfo[LM_INFO_SZ];
|
||||
|
||||
if(!jacf){
|
||||
fprintf(stderr, RCAT("No function specified for computing the Jacobian in ", LEVMAR_BLEIC_DER)
|
||||
RCAT("().\nIf no such function is available, use ", LEVMAR_BLEIC_DIF) RCAT("() rather than ", LEVMAR_BLEIC_DER) "()\n");
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
if(!C || !d){
|
||||
fprintf(stderr, RCAT(LCAT(LEVMAR_BLEIC_DER, "(): missing inequality constraints, use "), LEVMAR_BLEC_DER) "() in this case!\n");
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
if(!A || !b) k1=0; // sanity check
|
||||
|
||||
mm=m+k2;
|
||||
|
||||
if(n<m-k1){
|
||||
fprintf(stderr, LCAT(LEVMAR_BLEIC_DER, "(): cannot solve a problem with fewer measurements + equality constraints [%d + %d] than unknowns [%d]\n"), n, k1, m);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
k12=k1+k2;
|
||||
ptr=(LM_REAL *)malloc((3*mm + k12*mm + k12 + n*m + (covar? mm*mm : 0))*sizeof(LM_REAL));
|
||||
if(!ptr){
|
||||
fprintf(stderr, LCAT(LEVMAR_BLEIC_DER, "(): memory allocation request failed\n"));
|
||||
return LM_ERROR;
|
||||
}
|
||||
pext=ptr;
|
||||
lbext=pext+mm;
|
||||
ubext=lbext+mm;
|
||||
Aext=ubext+mm;
|
||||
bext=Aext+k12*mm;
|
||||
data.jac=bext+k12;
|
||||
covext=covar? data.jac+n*m : NULL;
|
||||
data.nineqcnstr=k2;
|
||||
data.func=func;
|
||||
data.jacf=jacf;
|
||||
data.adata=adata;
|
||||
|
||||
/* compute y s.t. C*p - y=d, i.e. y=C*p-d.
|
||||
* y is stored in the last k2 elements of pext
|
||||
*/
|
||||
for(i=0; i<k2; ++i){
|
||||
for(j=0, tmp=0.0; j<m; ++j)
|
||||
tmp+=C[i*m+j]*p[j];
|
||||
pext[j=i+m]=tmp-d[i];
|
||||
|
||||
/* surplus variables must be >=0 */
|
||||
lbext[j]=0.0;
|
||||
ubext[j]=LM_REAL_MAX;
|
||||
}
|
||||
/* set the first m elements of pext equal to p */
|
||||
for(i=0; i<m; ++i){
|
||||
pext[i]=p[i];
|
||||
lbext[i]=lb? lb[i] : LM_REAL_MIN;
|
||||
ubext[i]=ub? ub[i] : LM_REAL_MAX;
|
||||
}
|
||||
|
||||
/* setup the constraints matrix */
|
||||
/* original linear equation constraints */
|
||||
for(i=0; i<k1; ++i){
|
||||
for(j=0; j<m; ++j)
|
||||
Aext[i*mm+j]=A[i*m+j];
|
||||
|
||||
for(j=m; j<mm; ++j)
|
||||
Aext[i*mm+j]=0.0;
|
||||
|
||||
bext[i]=b[i];
|
||||
}
|
||||
/* linear equation constraints resulting from surplus variables */
|
||||
for(i=0, ii=k1; i<k2; ++i, ++ii){
|
||||
for(j=0; j<m; ++j)
|
||||
Aext[ii*mm+j]=C[i*m+j];
|
||||
|
||||
for(j=m; j<mm; ++j)
|
||||
Aext[ii*mm+j]=0.0;
|
||||
|
||||
Aext[ii*mm+m+i]=-1.0;
|
||||
|
||||
bext[ii]=d[i];
|
||||
}
|
||||
|
||||
if(!info) info=locinfo; /* make sure that LEVMAR_BLEC_DER() is called with non-null info */
|
||||
/* note that the default weights for the penalty terms are being used below */
|
||||
ret=LEVMAR_BLEC_DER(LMBLEIC_FUNC, LMBLEIC_JACF, pext, x, mm, n, lbext, ubext, Aext, bext, k12, NULL, itmax, opts, info, work, covext, (void *)&data);
|
||||
|
||||
/* copy back the minimizer */
|
||||
for(i=0; i<m; ++i)
|
||||
p[i]=pext[i];
|
||||
|
||||
#if 0
|
||||
printf("Surplus variables for the minimizer:\n");
|
||||
for(i=m; i<mm; ++i)
|
||||
printf("%g ", pext[i]);
|
||||
printf("\n\n");
|
||||
#endif
|
||||
|
||||
if(covar){
|
||||
for(i=0; i<m; ++i){
|
||||
for(j=0; j<m; ++j)
|
||||
covar[i*m+j]=covext[i*mm+j];
|
||||
}
|
||||
}
|
||||
|
||||
free(ptr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Similar to the LEVMAR_BLEIC_DER() function above, except that the Jacobian is approximated
|
||||
* with the aid of finite differences (forward or central, see the comment for the opts argument)
|
||||
*/
|
||||
int LEVMAR_BLEIC_DIF(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata), /* functional relation describing measurements. A p \in R^m yields a \hat{x} \in R^n */
|
||||
LM_REAL *p, /* I/O: initial parameter estimates. On output has the estimated solution */
|
||||
LM_REAL *x, /* I: measurement vector. NULL implies a zero vector */
|
||||
int m, /* I: parameter vector dimension (i.e. #unknowns) */
|
||||
int n, /* I: measurement vector dimension */
|
||||
LM_REAL *lb, /* I: vector of lower bounds. If NULL, no lower bounds apply */
|
||||
LM_REAL *ub, /* I: vector of upper bounds. If NULL, no upper bounds apply */
|
||||
LM_REAL *A, /* I: equality constraints matrix, k1xm. If NULL, no linear equation constraints apply */
|
||||
LM_REAL *b, /* I: right hand constraints vector, k1x1 */
|
||||
int k1, /* I: number of constraints (i.e. A's #rows) */
|
||||
LM_REAL *C, /* I: inequality constraints matrix, k2xm */
|
||||
LM_REAL *d, /* I: right hand constraints vector, k2x1 */
|
||||
int k2, /* I: number of inequality constraints (i.e. C's #rows) */
|
||||
int itmax, /* I: maximum number of iterations */
|
||||
LM_REAL opts[5], /* I: opts[0-3] = minim. options [\mu, \epsilon1, \epsilon2, \epsilon3, \delta]. Respectively the
|
||||
* scale factor for initial \mu, stopping thresholds for ||J^T e||_inf, ||Dp||_2 and ||e||_2 and
|
||||
* the step used in difference approximation to the Jacobian. Set to NULL for defaults to be used.
|
||||
* If \delta<0, the Jacobian is approximated with central differences which are more accurate
|
||||
* (but slower!) compared to the forward differences employed by default.
|
||||
*/
|
||||
LM_REAL info[LM_INFO_SZ],
|
||||
/* O: information regarding the minimization. Set to NULL if don't care
|
||||
* info[0]= ||e||_2 at initial p.
|
||||
* info[1-4]=[ ||e||_2, ||J^T e||_inf, ||Dp||_2, mu/max[J^T J]_ii ], all computed at estimated p.
|
||||
* info[5]= # iterations,
|
||||
* info[6]=reason for terminating: 1 - stopped by small gradient J^T e
|
||||
* 2 - stopped by small Dp
|
||||
* 3 - stopped by itmax
|
||||
* 4 - singular matrix. Restart from current p with increased mu
|
||||
* 5 - no further error reduction is possible. Restart with increased mu
|
||||
* 6 - stopped by small ||e||_2
|
||||
* 7 - stopped by invalid (i.e. NaN or Inf) "func" values. This is a user error
|
||||
* info[7]= # function evaluations
|
||||
* info[8]= # Jacobian evaluations
|
||||
* info[9]= # linear systems solved, i.e. # attempts for reducing error
|
||||
*/
|
||||
LM_REAL *work, /* working memory at least LM_BLEIC_DIF_WORKSZ() reals large, allocated if NULL */
|
||||
LM_REAL *covar, /* O: Covariance matrix corresponding to LS solution; mxm. Set to NULL if not needed. */
|
||||
void *adata) /* pointer to possibly additional data, passed uninterpreted to func.
|
||||
* Set to NULL if not needed
|
||||
*/
|
||||
{
|
||||
struct LMBLEIC_DATA data;
|
||||
LM_REAL *ptr, *pext, *Aext, *bext, *covext; /* corresponding to p, A, b, covar for the full set of variables;
|
||||
pext=[p, surplus], pext is mm, Aext is (k1+k2)xmm, bext (k1+k2), covext is mmxmm
|
||||
*/
|
||||
LM_REAL *lbext, *ubext; // corresponding to lb, ub for the full set of variables
|
||||
int mm, ret, k12;
|
||||
register int i, j, ii;
|
||||
register LM_REAL tmp;
|
||||
LM_REAL locinfo[LM_INFO_SZ];
|
||||
|
||||
if(!C || !d){
|
||||
fprintf(stderr, RCAT(LCAT(LEVMAR_BLEIC_DIF, "(): missing inequality constraints, use "), LEVMAR_BLEC_DIF) "() in this case!\n");
|
||||
return LM_ERROR;
|
||||
}
|
||||
if(!A || !b) k1=0; // sanity check
|
||||
|
||||
mm=m+k2;
|
||||
|
||||
if(n<m-k1){
|
||||
fprintf(stderr, LCAT(LEVMAR_BLEIC_DIF, "(): cannot solve a problem with fewer measurements + equality constraints [%d + %d] than unknowns [%d]\n"), n, k1, m);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
k12=k1+k2;
|
||||
ptr=(LM_REAL *)malloc((3*mm + k12*mm + k12 + (covar? mm*mm : 0))*sizeof(LM_REAL));
|
||||
if(!ptr){
|
||||
fprintf(stderr, LCAT(LEVMAR_BLEIC_DIF, "(): memory allocation request failed\n"));
|
||||
return LM_ERROR;
|
||||
}
|
||||
pext=ptr;
|
||||
lbext=pext+mm;
|
||||
ubext=lbext+mm;
|
||||
Aext=ubext+mm;
|
||||
bext=Aext+k12*mm;
|
||||
data.jac=NULL;
|
||||
covext=covar? bext+k12 : NULL;
|
||||
data.nineqcnstr=k2;
|
||||
data.func=func;
|
||||
data.jacf=NULL;
|
||||
data.adata=adata;
|
||||
|
||||
/* compute y s.t. C*p - y=d, i.e. y=C*p-d.
|
||||
* y is stored in the last k2 elements of pext
|
||||
*/
|
||||
for(i=0; i<k2; ++i){
|
||||
for(j=0, tmp=0.0; j<m; ++j)
|
||||
tmp+=C[i*m+j]*p[j];
|
||||
pext[j=i+m]=tmp-d[i];
|
||||
|
||||
/* surplus variables must be >=0 */
|
||||
lbext[j]=0.0;
|
||||
ubext[j]=LM_REAL_MAX;
|
||||
}
|
||||
/* set the first m elements of pext equal to p */
|
||||
for(i=0; i<m; ++i){
|
||||
pext[i]=p[i];
|
||||
lbext[i]=lb? lb[i] : LM_REAL_MIN;
|
||||
ubext[i]=ub? ub[i] : LM_REAL_MAX;
|
||||
}
|
||||
|
||||
/* setup the constraints matrix */
|
||||
/* original linear equation constraints */
|
||||
for(i=0; i<k1; ++i){
|
||||
for(j=0; j<m; ++j)
|
||||
Aext[i*mm+j]=A[i*m+j];
|
||||
|
||||
for(j=m; j<mm; ++j)
|
||||
Aext[i*mm+j]=0.0;
|
||||
|
||||
bext[i]=b[i];
|
||||
}
|
||||
/* linear equation constraints resulting from surplus variables */
|
||||
for(i=0, ii=k1; i<k2; ++i, ++ii){
|
||||
for(j=0; j<m; ++j)
|
||||
Aext[ii*mm+j]=C[i*m+j];
|
||||
|
||||
for(j=m; j<mm; ++j)
|
||||
Aext[ii*mm+j]=0.0;
|
||||
|
||||
Aext[ii*mm+m+i]=-1.0;
|
||||
|
||||
bext[ii]=d[i];
|
||||
}
|
||||
|
||||
if(!info) info=locinfo; /* make sure that LEVMAR_BLEC_DIF() is called with non-null info */
|
||||
/* note that the default weights for the penalty terms are being used below */
|
||||
ret=LEVMAR_BLEC_DIF(LMBLEIC_FUNC, pext, x, mm, n, lbext, ubext, Aext, bext, k12, NULL, itmax, opts, info, work, covext, (void *)&data);
|
||||
|
||||
/* copy back the minimizer */
|
||||
for(i=0; i<m; ++i)
|
||||
p[i]=pext[i];
|
||||
|
||||
#if 0
|
||||
printf("Surplus variables for the minimizer:\n");
|
||||
for(i=m; i<mm; ++i)
|
||||
printf("%g ", pext[i]);
|
||||
printf("\n\n");
|
||||
#endif
|
||||
|
||||
if(covar){
|
||||
for(i=0; i<m; ++i){
|
||||
for(j=0; j<m; ++j)
|
||||
covar[i*m+j]=covext[i*mm+j];
|
||||
}
|
||||
}
|
||||
|
||||
free(ptr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* convenience wrappers to LEVMAR_BLEIC_DER/LEVMAR_BLEIC_DIF */
|
||||
|
||||
/* box & linear inequality constraints */
|
||||
int LEVMAR_BLIC_DER(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata),
|
||||
void (*jacf)(LM_REAL *p, LM_REAL *j, int m, int n, void *adata),
|
||||
LM_REAL *p, LM_REAL *x, int m, int n,
|
||||
LM_REAL *lb, LM_REAL *ub,
|
||||
LM_REAL *C, LM_REAL *d, int k2,
|
||||
int itmax, LM_REAL opts[4], LM_REAL info[LM_INFO_SZ], LM_REAL *work, LM_REAL *covar, void *adata)
|
||||
{
|
||||
return LEVMAR_BLEIC_DER(func, jacf, p, x, m, n, lb, ub, NULL, NULL, 0, C, d, k2, itmax, opts, info, work, covar, adata);
|
||||
}
|
||||
|
||||
int LEVMAR_BLIC_DIF(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata),
|
||||
LM_REAL *p, LM_REAL *x, int m, int n,
|
||||
LM_REAL *lb, LM_REAL *ub,
|
||||
LM_REAL *C, LM_REAL *d, int k2,
|
||||
int itmax, LM_REAL opts[5], LM_REAL info[LM_INFO_SZ], LM_REAL *work, LM_REAL *covar, void *adata)
|
||||
{
|
||||
return LEVMAR_BLEIC_DIF(func, p, x, m, n, lb, ub, NULL, NULL, 0, C, d, k2, itmax, opts, info, work, covar, adata);
|
||||
}
|
||||
|
||||
/* linear equation & inequality constraints */
|
||||
int LEVMAR_LEIC_DER(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata),
|
||||
void (*jacf)(LM_REAL *p, LM_REAL *j, int m, int n, void *adata),
|
||||
LM_REAL *p, LM_REAL *x, int m, int n,
|
||||
LM_REAL *A, LM_REAL *b, int k1,
|
||||
LM_REAL *C, LM_REAL *d, int k2,
|
||||
int itmax, LM_REAL opts[4], LM_REAL info[LM_INFO_SZ], LM_REAL *work, LM_REAL *covar, void *adata)
|
||||
{
|
||||
return LEVMAR_BLEIC_DER(func, jacf, p, x, m, n, NULL, NULL, A, b, k1, C, d, k2, itmax, opts, info, work, covar, adata);
|
||||
}
|
||||
|
||||
int LEVMAR_LEIC_DIF(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata),
|
||||
LM_REAL *p, LM_REAL *x, int m, int n,
|
||||
LM_REAL *A, LM_REAL *b, int k1,
|
||||
LM_REAL *C, LM_REAL *d, int k2,
|
||||
int itmax, LM_REAL opts[5], LM_REAL info[LM_INFO_SZ], LM_REAL *work, LM_REAL *covar, void *adata)
|
||||
{
|
||||
return LEVMAR_BLEIC_DIF(func, p, x, m, n, NULL, NULL, A, b, k1, C, d, k2, itmax, opts, info, work, covar, adata);
|
||||
}
|
||||
|
||||
/* linear inequality constraints */
|
||||
int LEVMAR_LIC_DER(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata),
|
||||
void (*jacf)(LM_REAL *p, LM_REAL *j, int m, int n, void *adata),
|
||||
LM_REAL *p, LM_REAL *x, int m, int n,
|
||||
LM_REAL *C, LM_REAL *d, int k2,
|
||||
int itmax, LM_REAL opts[4], LM_REAL info[LM_INFO_SZ], LM_REAL *work, LM_REAL *covar, void *adata)
|
||||
{
|
||||
return LEVMAR_BLEIC_DER(func, jacf, p, x, m, n, NULL, NULL, NULL, NULL, 0, C, d, k2, itmax, opts, info, work, covar, adata);
|
||||
}
|
||||
|
||||
int LEVMAR_LIC_DIF(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata),
|
||||
LM_REAL *p, LM_REAL *x, int m, int n,
|
||||
LM_REAL *C, LM_REAL *d, int k2,
|
||||
int itmax, LM_REAL opts[5], LM_REAL info[LM_INFO_SZ], LM_REAL *work, LM_REAL *covar, void *adata)
|
||||
{
|
||||
return LEVMAR_BLEIC_DIF(func, p, x, m, n, NULL, NULL, NULL, NULL, 0, C, d, k2, itmax, opts, info, work, covar, adata);
|
||||
}
|
||||
|
||||
/* undefine all. THIS MUST REMAIN AT THE END OF THE FILE */
|
||||
#undef LMBLEIC_DATA
|
||||
#undef LMBLEIC_ELIM
|
||||
#undef LMBLEIC_FUNC
|
||||
#undef LMBLEIC_JACF
|
||||
#undef LEVMAR_FDIF_FORW_JAC_APPROX
|
||||
#undef LEVMAR_COVAR
|
||||
#undef LEVMAR_TRANS_MAT_MAT_MULT
|
||||
#undef LEVMAR_BLEIC_DER
|
||||
#undef LEVMAR_BLEIC_DIF
|
||||
#undef LEVMAR_BLIC_DER
|
||||
#undef LEVMAR_BLIC_DIF
|
||||
#undef LEVMAR_LEIC_DER
|
||||
#undef LEVMAR_LEIC_DIF
|
||||
#undef LEVMAR_LIC_DER
|
||||
#undef LEVMAR_LIC_DIF
|
||||
#undef LEVMAR_BLEC_DER
|
||||
#undef LEVMAR_BLEC_DIF
|
||||
80
contrib/levmar/lmlec.c
Normal file
80
contrib/levmar/lmlec.c
Normal file
@@ -0,0 +1,80 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2004-05 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*******************************************************************************
|
||||
* Wrappers for linearly constrained Levenberg-Marquardt minimization. The same
|
||||
* core code is used with appropriate #defines to derive single and double
|
||||
* precision versions, see also lmlec_core.c
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "levmar.h"
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
#ifndef HAVE_LAPACK
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("Linearly constrained optimization requires LAPACK and was not compiled!")
|
||||
#else
|
||||
#warning Linearly constrained optimization requires LAPACK and was not compiled!
|
||||
#endif // _MSC_VER
|
||||
|
||||
#else // LAPACK present
|
||||
|
||||
#if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC)
|
||||
#error At least one of LM_DBL_PREC, LM_SNGL_PREC should be defined!
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
/* single precision (float) definitions */
|
||||
#define LM_REAL float
|
||||
#define LM_PREFIX s
|
||||
|
||||
#define __SUBCNST(x) x##F
|
||||
#define LM_CNST(x) __SUBCNST(x) // force substitution
|
||||
|
||||
#include "lmlec_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef __SUBCNST
|
||||
#undef LM_CNST
|
||||
#endif /* LM_SNGL_PREC */
|
||||
|
||||
#ifdef LM_DBL_PREC
|
||||
/* double precision definitions */
|
||||
#define LM_REAL double
|
||||
#define LM_PREFIX d
|
||||
|
||||
#define LM_CNST(x) (x)
|
||||
|
||||
#include "lmlec_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_CNST
|
||||
#endif /* LM_DBL_PREC */
|
||||
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
656
contrib/levmar/lmlec_core.c
Normal file
656
contrib/levmar/lmlec_core.c
Normal file
@@ -0,0 +1,656 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2004-05 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef LM_REAL // not included by lmlec.c
|
||||
#error This file should not be compiled directly!
|
||||
#endif
|
||||
|
||||
|
||||
/* precision-specific definitions */
|
||||
#define LMLEC_DATA LM_ADD_PREFIX(lmlec_data)
|
||||
#define LMLEC_ELIM LM_ADD_PREFIX(lmlec_elim)
|
||||
#define LMLEC_FUNC LM_ADD_PREFIX(lmlec_func)
|
||||
#define LMLEC_JACF LM_ADD_PREFIX(lmlec_jacf)
|
||||
#define LEVMAR_LEC_DER LM_ADD_PREFIX(levmar_lec_der)
|
||||
#define LEVMAR_LEC_DIF LM_ADD_PREFIX(levmar_lec_dif)
|
||||
#define LEVMAR_DER LM_ADD_PREFIX(levmar_der)
|
||||
#define LEVMAR_DIF LM_ADD_PREFIX(levmar_dif)
|
||||
#define LEVMAR_TRANS_MAT_MAT_MULT LM_ADD_PREFIX(levmar_trans_mat_mat_mult)
|
||||
#define LEVMAR_COVAR LM_ADD_PREFIX(levmar_covar)
|
||||
#define LEVMAR_FDIF_FORW_JAC_APPROX LM_ADD_PREFIX(levmar_fdif_forw_jac_approx)
|
||||
|
||||
#define GEQP3 LM_MK_LAPACK_NAME(geqp3)
|
||||
#define ORGQR LM_MK_LAPACK_NAME(orgqr)
|
||||
#define TRTRI LM_MK_LAPACK_NAME(trtri)
|
||||
|
||||
struct LMLEC_DATA{
|
||||
LM_REAL *c, *Z, *p, *jac;
|
||||
int ncnstr;
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata);
|
||||
void (*jacf)(LM_REAL *p, LM_REAL *jac, int m, int n, void *adata);
|
||||
void *adata;
|
||||
};
|
||||
|
||||
/* prototypes for LAPACK routines */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern int GEQP3(int *m, int *n, LM_REAL *a, int *lda, int *jpvt,
|
||||
LM_REAL *tau, LM_REAL *work, int *lwork, int *info);
|
||||
|
||||
extern int ORGQR(int *m, int *n, int *k, LM_REAL *a, int *lda, LM_REAL *tau,
|
||||
LM_REAL *work, int *lwork, int *info);
|
||||
|
||||
extern int TRTRI(char *uplo, char *diag, int *n, LM_REAL *a, int *lda, int *info);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function implements an elimination strategy for linearly constrained
|
||||
* optimization problems. The strategy relies on QR decomposition to transform
|
||||
* an optimization problem constrained by Ax=b to an equivalent, unconstrained
|
||||
* one. Also referred to as "null space" or "reduced Hessian" method.
|
||||
* See pp. 430-433 (chap. 15) of "Numerical Optimization" by Nocedal-Wright
|
||||
* for details.
|
||||
*
|
||||
* A is mxn with m<=n and rank(A)=m
|
||||
* Two matrices Y and Z of dimensions nxm and nx(n-m) are computed from A^T so that
|
||||
* their columns are orthonormal and every x can be written as x=Y*b + Z*x_z=
|
||||
* c + Z*x_z, where c=Y*b is a fixed vector of dimension n and x_z is an
|
||||
* arbitrary vector of dimension n-m. Then, the problem of minimizing f(x)
|
||||
* subject to Ax=b is equivalent to minimizing f(c + Z*x_z) with no constraints.
|
||||
* The computed Y and Z are such that any solution of Ax=b can be written as
|
||||
* x=Y*x_y + Z*x_z for some x_y, x_z. Furthermore, A*Y is nonsingular, A*Z=0
|
||||
* and Z spans the null space of A.
|
||||
*
|
||||
* The function accepts A, b and computes c, Y, Z. If b or c is NULL, c is not
|
||||
* computed. Also, Y can be NULL in which case it is not referenced.
|
||||
* The function returns LM_ERROR in case of error, A's computed rank if successful
|
||||
*
|
||||
*/
|
||||
static int LMLEC_ELIM(LM_REAL *A, LM_REAL *b, LM_REAL *c, LM_REAL *Y, LM_REAL *Z, int m, int n)
|
||||
{
|
||||
static LM_REAL eps=LM_CNST(-1.0);
|
||||
|
||||
LM_REAL *buf=NULL;
|
||||
LM_REAL *a, *tau, *work, *r, aux;
|
||||
register LM_REAL tmp;
|
||||
int a_sz, jpvt_sz, tau_sz, r_sz, Y_sz, worksz;
|
||||
int info, rank, *jpvt, tot_sz, mintmn, tm, tn;
|
||||
register int i, j, k;
|
||||
|
||||
if(m>n){
|
||||
fprintf(stderr, RCAT("matrix of constraints cannot have more rows than columns in", LMLEC_ELIM) "()!\n");
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
tm=n; tn=m; // transpose dimensions
|
||||
mintmn=m;
|
||||
|
||||
/* calculate required memory size */
|
||||
worksz=-1; // workspace query. Optimal work size is returned in aux
|
||||
//ORGQR((int *)&tm, (int *)&tm, (int *)&mintmn, NULL, (int *)&tm, NULL, (LM_REAL *)&aux, &worksz, &info);
|
||||
GEQP3((int *)&tm, (int *)&tn, NULL, (int *)&tm, NULL, NULL, (LM_REAL *)&aux, (int *)&worksz, &info);
|
||||
worksz=(int)aux;
|
||||
a_sz=tm*tm; // tm*tn is enough for xgeqp3()
|
||||
jpvt_sz=tn;
|
||||
tau_sz=mintmn;
|
||||
r_sz=mintmn*mintmn; // actually smaller if a is not of full row rank
|
||||
Y_sz=(Y)? 0 : tm*tn;
|
||||
|
||||
tot_sz=(a_sz + tau_sz + r_sz + worksz + Y_sz)*sizeof(LM_REAL) + jpvt_sz*sizeof(int); /* should be arranged in that order for proper doubles alignment */
|
||||
buf=(LM_REAL *)malloc(tot_sz); /* allocate a "big" memory chunk at once */
|
||||
if(!buf){
|
||||
fprintf(stderr, RCAT("Memory allocation request failed in ", LMLEC_ELIM) "()\n");
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
a=buf;
|
||||
tau=a+a_sz;
|
||||
r=tau+tau_sz;
|
||||
work=r+r_sz;
|
||||
if(!Y){
|
||||
Y=work+worksz;
|
||||
jpvt=(int *)(Y+Y_sz);
|
||||
}
|
||||
else
|
||||
jpvt=(int *)(work+worksz);
|
||||
|
||||
/* copy input array so that LAPACK won't destroy it. Note that copying is
|
||||
* done in row-major order, which equals A^T in column-major
|
||||
*/
|
||||
for(i=0; i<tm*tn; ++i)
|
||||
a[i]=A[i];
|
||||
|
||||
/* clear jpvt */
|
||||
for(i=0; i<jpvt_sz; ++i) jpvt[i]=0;
|
||||
|
||||
/* rank revealing QR decomposition of A^T*/
|
||||
GEQP3((int *)&tm, (int *)&tn, a, (int *)&tm, jpvt, tau, work, (int *)&worksz, &info);
|
||||
//dgeqpf_((int *)&tm, (int *)&tn, a, (int *)&tm, jpvt, tau, work, &info);
|
||||
/* error checking */
|
||||
if(info!=0){
|
||||
if(info<0){
|
||||
fprintf(stderr, RCAT(RCAT("LAPACK error: illegal value for argument %d of ", GEQP3) " in ", LMLEC_ELIM) "()\n", -info);
|
||||
}
|
||||
else if(info>0){
|
||||
fprintf(stderr, RCAT(RCAT("unknown LAPACK error (%d) for ", GEQP3) " in ", LMLEC_ELIM) "()\n", info);
|
||||
}
|
||||
free(buf);
|
||||
return LM_ERROR;
|
||||
}
|
||||
/* the upper triangular part of a now contains the upper triangle of the unpermuted R */
|
||||
|
||||
if(eps<0.0){
|
||||
LM_REAL aux;
|
||||
|
||||
/* compute machine epsilon. DBL_EPSILON should do also */
|
||||
for(eps=LM_CNST(1.0); aux=eps+LM_CNST(1.0), aux-LM_CNST(1.0)>0.0; eps*=LM_CNST(0.5))
|
||||
;
|
||||
eps*=LM_CNST(2.0);
|
||||
}
|
||||
|
||||
tmp=tm*LM_CNST(10.0)*eps*FABS(a[0]); // threshold. tm is max(tm, tn)
|
||||
tmp=(tmp>LM_CNST(1E-12))? tmp : LM_CNST(1E-12); // ensure that threshold is not too small
|
||||
/* compute A^T's numerical rank by counting the non-zeros in R's diagonal */
|
||||
for(i=rank=0; i<mintmn; ++i)
|
||||
if(a[i*(tm+1)]>tmp || a[i*(tm+1)]<-tmp) ++rank; /* loop across R's diagonal elements */
|
||||
else break; /* diagonal is arranged in absolute decreasing order */
|
||||
|
||||
if(rank<tn){
|
||||
fprintf(stderr, RCAT("\nConstraints matrix in ", LMLEC_ELIM) "() is not of full row rank (i.e. %d < %d)!\n"
|
||||
"Make sure that you do not specify redundant or inconsistent constraints.\n\n", rank, tn);
|
||||
free(buf);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
/* compute the permuted inverse transpose of R */
|
||||
/* first, copy R from the upper triangular part of a to the lower part of r (thus transposing it). R is rank x rank */
|
||||
for(j=0; j<rank; ++j){
|
||||
for(i=0; i<=j; ++i)
|
||||
r[j+i*rank]=a[i+j*tm];
|
||||
for(i=j+1; i<rank; ++i)
|
||||
r[j+i*rank]=0.0; // upper part is zero
|
||||
}
|
||||
/* r now contains R^T */
|
||||
|
||||
/* compute the inverse */
|
||||
TRTRI("L", "N", (int *)&rank, r, (int *)&rank, &info);
|
||||
/* error checking */
|
||||
if(info!=0){
|
||||
if(info<0){
|
||||
fprintf(stderr, RCAT(RCAT("LAPACK error: illegal value for argument %d of ", TRTRI) " in ", LMLEC_ELIM) "()\n", -info);
|
||||
}
|
||||
else if(info>0){
|
||||
fprintf(stderr, RCAT(RCAT("A(%d, %d) is exactly zero for ", TRTRI) " (singular matrix) in ", LMLEC_ELIM) "()\n", info, info);
|
||||
}
|
||||
free(buf);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
/* finally, permute R^-T using Y as intermediate storage */
|
||||
for(j=0; j<rank; ++j)
|
||||
for(i=0, k=jpvt[j]-1; i<rank; ++i)
|
||||
Y[i+k*rank]=r[i+j*rank];
|
||||
|
||||
for(i=0; i<rank*rank; ++i) // copy back to r
|
||||
r[i]=Y[i];
|
||||
|
||||
/* resize a to be tm x tm, filling with zeroes */
|
||||
for(i=tm*tn; i<tm*tm; ++i)
|
||||
a[i]=0.0;
|
||||
|
||||
/* compute Q in a as the product of elementary reflectors. Q is tm x tm */
|
||||
ORGQR((int *)&tm, (int *)&tm, (int *)&mintmn, a, (int *)&tm, tau, work, &worksz, &info);
|
||||
/* error checking */
|
||||
if(info!=0){
|
||||
if(info<0){
|
||||
fprintf(stderr, RCAT(RCAT("LAPACK error: illegal value for argument %d of ", ORGQR) " in ", LMLEC_ELIM) "()\n", -info);
|
||||
}
|
||||
else if(info>0){
|
||||
fprintf(stderr, RCAT(RCAT("unknown LAPACK error (%d) for ", ORGQR) " in ", LMLEC_ELIM) "()\n", info);
|
||||
}
|
||||
free(buf);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
/* compute Y=Q_1*R^-T*P^T. Y is tm x rank */
|
||||
for(i=0; i<tm; ++i)
|
||||
for(j=0; j<rank; ++j){
|
||||
for(k=0, tmp=0.0; k<rank; ++k)
|
||||
tmp+=a[i+k*tm]*r[k+j*rank];
|
||||
Y[i*rank+j]=tmp;
|
||||
}
|
||||
|
||||
if(b && c){
|
||||
/* compute c=Y*b */
|
||||
for(i=0; i<tm; ++i){
|
||||
for(j=0, tmp=0.0; j<rank; ++j)
|
||||
tmp+=Y[i*rank+j]*b[j];
|
||||
|
||||
c[i]=tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* copy Q_2 into Z. Z is tm x (tm-rank) */
|
||||
for(j=0; j<tm-rank; ++j)
|
||||
for(i=0, k=j+rank; i<tm; ++i)
|
||||
Z[i*(tm-rank)+j]=a[i+k*tm];
|
||||
|
||||
free(buf);
|
||||
|
||||
return rank;
|
||||
}
|
||||
|
||||
/* constrained measurements: given pp, compute the measurements at c + Z*pp */
|
||||
static void LMLEC_FUNC(LM_REAL *pp, LM_REAL *hx, int mm, int n, void *adata)
|
||||
{
|
||||
struct LMLEC_DATA *data=(struct LMLEC_DATA *)adata;
|
||||
int m;
|
||||
register int i, j;
|
||||
register LM_REAL sum;
|
||||
LM_REAL *c, *Z, *p, *Zimm;
|
||||
|
||||
m=mm+data->ncnstr;
|
||||
c=data->c;
|
||||
Z=data->Z;
|
||||
p=data->p;
|
||||
/* p=c + Z*pp */
|
||||
for(i=0; i<m; ++i){
|
||||
Zimm=Z+i*mm;
|
||||
for(j=0, sum=c[i]; j<mm; ++j)
|
||||
sum+=Zimm[j]*pp[j]; // sum+=Z[i*mm+j]*pp[j];
|
||||
p[i]=sum;
|
||||
}
|
||||
|
||||
(*(data->func))(p, hx, m, n, data->adata);
|
||||
}
|
||||
|
||||
/* constrained Jacobian: given pp, compute the Jacobian at c + Z*pp
|
||||
* Using the chain rule, the Jacobian with respect to pp equals the
|
||||
* product of the Jacobian with respect to p (at c + Z*pp) times Z
|
||||
*/
|
||||
static void LMLEC_JACF(LM_REAL *pp, LM_REAL *jacjac, int mm, int n, void *adata)
|
||||
{
|
||||
struct LMLEC_DATA *data=(struct LMLEC_DATA *)adata;
|
||||
int m;
|
||||
register int i, j, l;
|
||||
register LM_REAL sum, *aux1, *aux2;
|
||||
LM_REAL *c, *Z, *p, *jac;
|
||||
|
||||
m=mm+data->ncnstr;
|
||||
c=data->c;
|
||||
Z=data->Z;
|
||||
p=data->p;
|
||||
jac=data->jac;
|
||||
/* p=c + Z*pp */
|
||||
for(i=0; i<m; ++i){
|
||||
aux1=Z+i*mm;
|
||||
for(j=0, sum=c[i]; j<mm; ++j)
|
||||
sum+=aux1[j]*pp[j]; // sum+=Z[i*mm+j]*pp[j];
|
||||
p[i]=sum;
|
||||
}
|
||||
|
||||
(*(data->jacf))(p, jac, m, n, data->adata);
|
||||
|
||||
/* compute jac*Z in jacjac */
|
||||
if(n*m<=__BLOCKSZ__SQ){ // this is a small problem
|
||||
/* This is the straightforward way to compute jac*Z. However, due to
|
||||
* its noncontinuous memory access pattern, it incures many cache misses when
|
||||
* applied to large minimization problems (i.e. problems involving a large
|
||||
* number of free variables and measurements), in which jac is too large to
|
||||
* fit in the L1 cache. For such problems, a cache-efficient blocking scheme
|
||||
* is preferable. On the other hand, the straightforward algorithm is faster
|
||||
* on small problems since in this case it avoids the overheads of blocking.
|
||||
*/
|
||||
|
||||
for(i=0; i<n; ++i){
|
||||
aux1=jac+i*m;
|
||||
aux2=jacjac+i*mm;
|
||||
for(j=0; j<mm; ++j){
|
||||
for(l=0, sum=0.0; l<m; ++l)
|
||||
sum+=aux1[l]*Z[l*mm+j]; // sum+=jac[i*m+l]*Z[l*mm+j];
|
||||
|
||||
aux2[j]=sum; // jacjac[i*mm+j]=sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{ // this is a large problem
|
||||
/* Cache efficient computation of jac*Z based on blocking
|
||||
*/
|
||||
#define __MIN__(x, y) (((x)<=(y))? (x) : (y))
|
||||
register int jj, ll;
|
||||
|
||||
for(jj=0; jj<mm; jj+=__BLOCKSZ__){
|
||||
for(i=0; i<n; ++i){
|
||||
aux1=jacjac+i*mm;
|
||||
for(j=jj; j<__MIN__(jj+__BLOCKSZ__, mm); ++j)
|
||||
aux1[j]=0.0; //jacjac[i*mm+j]=0.0;
|
||||
}
|
||||
|
||||
for(ll=0; ll<m; ll+=__BLOCKSZ__){
|
||||
for(i=0; i<n; ++i){
|
||||
aux1=jacjac+i*mm; aux2=jac+i*m;
|
||||
for(j=jj; j<__MIN__(jj+__BLOCKSZ__, mm); ++j){
|
||||
sum=0.0;
|
||||
for(l=ll; l<__MIN__(ll+__BLOCKSZ__, m); ++l)
|
||||
sum+=aux2[l]*Z[l*mm+j]; //jac[i*m+l]*Z[l*mm+j];
|
||||
aux1[j]+=sum; //jacjac[i*mm+j]+=sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#undef __MIN__
|
||||
|
||||
|
||||
/*
|
||||
* This function is similar to LEVMAR_DER except that the minimization
|
||||
* is performed subject to the linear constraints A p=b, A is kxm, b kx1
|
||||
*
|
||||
* This function requires an analytic Jacobian. In case the latter is unavailable,
|
||||
* use LEVMAR_LEC_DIF() bellow
|
||||
*
|
||||
*/
|
||||
int LEVMAR_LEC_DER(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata), /* functional relation describing measurements. A p \in R^m yields a \hat{x} \in R^n */
|
||||
void (*jacf)(LM_REAL *p, LM_REAL *j, int m, int n, void *adata), /* function to evaluate the Jacobian \part x / \part p */
|
||||
LM_REAL *p, /* I/O: initial parameter estimates. On output has the estimated solution */
|
||||
LM_REAL *x, /* I: measurement vector. NULL implies a zero vector */
|
||||
int m, /* I: parameter vector dimension (i.e. #unknowns) */
|
||||
int n, /* I: measurement vector dimension */
|
||||
LM_REAL *A, /* I: constraints matrix, kxm */
|
||||
LM_REAL *b, /* I: right hand constraints vector, kx1 */
|
||||
int k, /* I: number of constraints (i.e. A's #rows) */
|
||||
int itmax, /* I: maximum number of iterations */
|
||||
LM_REAL opts[4], /* I: minim. options [\mu, \epsilon1, \epsilon2, \epsilon3]. Respectively the scale factor for initial \mu,
|
||||
* stopping thresholds for ||J^T e||_inf, ||Dp||_2 and ||e||_2. Set to NULL for defaults to be used
|
||||
*/
|
||||
LM_REAL info[LM_INFO_SZ],
|
||||
/* O: information regarding the minimization. Set to NULL if don't care
|
||||
* info[0]= ||e||_2 at initial p.
|
||||
* info[1-4]=[ ||e||_2, ||J^T e||_inf, ||Dp||_2, mu/max[J^T J]_ii ], all computed at estimated p.
|
||||
* info[5]= # iterations,
|
||||
* info[6]=reason for terminating: 1 - stopped by small gradient J^T e
|
||||
* 2 - stopped by small Dp
|
||||
* 3 - stopped by itmax
|
||||
* 4 - singular matrix. Restart from current p with increased mu
|
||||
* 5 - no further error reduction is possible. Restart with increased mu
|
||||
* 6 - stopped by small ||e||_2
|
||||
* 7 - stopped by invalid (i.e. NaN or Inf) "func" values. This is a user error
|
||||
* info[7]= # function evaluations
|
||||
* info[8]= # Jacobian evaluations
|
||||
* info[9]= # linear systems solved, i.e. # attempts for reducing error
|
||||
*/
|
||||
LM_REAL *work, /* working memory at least LM_LEC_DER_WORKSZ() reals large, allocated if NULL */
|
||||
LM_REAL *covar, /* O: Covariance matrix corresponding to LS solution; mxm. Set to NULL if not needed. */
|
||||
void *adata) /* pointer to possibly additional data, passed uninterpreted to func & jacf.
|
||||
* Set to NULL if not needed
|
||||
*/
|
||||
{
|
||||
struct LMLEC_DATA data;
|
||||
LM_REAL *ptr, *Z, *pp, *p0, *Zimm; /* Z is mxmm */
|
||||
int mm, ret;
|
||||
register int i, j;
|
||||
register LM_REAL tmp;
|
||||
LM_REAL locinfo[LM_INFO_SZ];
|
||||
|
||||
if(!jacf){
|
||||
fprintf(stderr, RCAT("No function specified for computing the Jacobian in ", LEVMAR_LEC_DER)
|
||||
RCAT("().\nIf no such function is available, use ", LEVMAR_LEC_DIF) RCAT("() rather than ", LEVMAR_LEC_DER) "()\n");
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
mm=m-k;
|
||||
|
||||
if(n<mm){
|
||||
fprintf(stderr, LCAT(LEVMAR_LEC_DER, "(): cannot solve a problem with fewer measurements + equality constraints [%d + %d] than unknowns [%d]\n"), n, k, m);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
ptr=(LM_REAL *)malloc((2*m + m*mm + n*m + mm)*sizeof(LM_REAL));
|
||||
if(!ptr){
|
||||
fprintf(stderr, LCAT(LEVMAR_LEC_DER, "(): memory allocation request failed\n"));
|
||||
return LM_ERROR;
|
||||
}
|
||||
data.p=p;
|
||||
p0=ptr;
|
||||
data.c=p0+m;
|
||||
data.Z=Z=data.c+m;
|
||||
data.jac=data.Z+m*mm;
|
||||
pp=data.jac+n*m;
|
||||
data.ncnstr=k;
|
||||
data.func=func;
|
||||
data.jacf=jacf;
|
||||
data.adata=adata;
|
||||
|
||||
ret=LMLEC_ELIM(A, b, data.c, NULL, Z, k, m); // compute c, Z
|
||||
if(ret==LM_ERROR){
|
||||
free(ptr);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
/* compute pp s.t. p = c + Z*pp or (Z^T Z)*pp=Z^T*(p-c)
|
||||
* Due to orthogonality, Z^T Z = I and the last equation
|
||||
* becomes pp=Z^T*(p-c). Also, save the starting p in p0
|
||||
*/
|
||||
for(i=0; i<m; ++i){
|
||||
p0[i]=p[i];
|
||||
p[i]-=data.c[i];
|
||||
}
|
||||
|
||||
/* Z^T*(p-c) */
|
||||
for(i=0; i<mm; ++i){
|
||||
for(j=0, tmp=0.0; j<m; ++j)
|
||||
tmp+=Z[j*mm+i]*p[j];
|
||||
pp[i]=tmp;
|
||||
}
|
||||
|
||||
/* compute the p corresponding to pp (i.e. c + Z*pp) and compare with p0 */
|
||||
for(i=0; i<m; ++i){
|
||||
Zimm=Z+i*mm;
|
||||
for(j=0, tmp=data.c[i]; j<mm; ++j)
|
||||
tmp+=Zimm[j]*pp[j]; // tmp+=Z[i*mm+j]*pp[j];
|
||||
if(FABS(tmp-p0[i])>LM_CNST(1E-03))
|
||||
fprintf(stderr, RCAT("Warning: component %d of starting point not feasible in ", LEVMAR_LEC_DER) "()! [%.10g reset to %.10g]\n",
|
||||
i, p0[i], tmp);
|
||||
}
|
||||
|
||||
if(!info) info=locinfo; /* make sure that LEVMAR_DER() is called with non-null info */
|
||||
/* note that covariance computation is not requested from LEVMAR_DER() */
|
||||
ret=LEVMAR_DER(LMLEC_FUNC, LMLEC_JACF, pp, x, mm, n, itmax, opts, info, work, NULL, (void *)&data);
|
||||
|
||||
/* p=c + Z*pp */
|
||||
for(i=0; i<m; ++i){
|
||||
Zimm=Z+i*mm;
|
||||
for(j=0, tmp=data.c[i]; j<mm; ++j)
|
||||
tmp+=Zimm[j]*pp[j]; // tmp+=Z[i*mm+j]*pp[j];
|
||||
p[i]=tmp;
|
||||
}
|
||||
|
||||
/* compute the covariance from the Jacobian in data.jac */
|
||||
if(covar){
|
||||
LEVMAR_TRANS_MAT_MAT_MULT(data.jac, covar, n, m); /* covar = J^T J */
|
||||
LEVMAR_COVAR(covar, covar, info[1], m, n);
|
||||
}
|
||||
|
||||
free(ptr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Similar to the LEVMAR_LEC_DER() function above, except that the Jacobian is approximated
|
||||
* with the aid of finite differences (forward or central, see the comment for the opts argument)
|
||||
*/
|
||||
int LEVMAR_LEC_DIF(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata), /* functional relation describing measurements. A p \in R^m yields a \hat{x} \in R^n */
|
||||
LM_REAL *p, /* I/O: initial parameter estimates. On output has the estimated solution */
|
||||
LM_REAL *x, /* I: measurement vector. NULL implies a zero vector */
|
||||
int m, /* I: parameter vector dimension (i.e. #unknowns) */
|
||||
int n, /* I: measurement vector dimension */
|
||||
LM_REAL *A, /* I: constraints matrix, kxm */
|
||||
LM_REAL *b, /* I: right hand constraints vector, kx1 */
|
||||
int k, /* I: number of constraints (i.e. A's #rows) */
|
||||
int itmax, /* I: maximum number of iterations */
|
||||
LM_REAL opts[5], /* I: opts[0-3] = minim. options [\mu, \epsilon1, \epsilon2, \epsilon3, \delta]. Respectively the
|
||||
* scale factor for initial \mu, stopping thresholds for ||J^T e||_inf, ||Dp||_2 and ||e||_2 and
|
||||
* the step used in difference approximation to the Jacobian. Set to NULL for defaults to be used.
|
||||
* If \delta<0, the Jacobian is approximated with central differences which are more accurate
|
||||
* (but slower!) compared to the forward differences employed by default.
|
||||
*/
|
||||
LM_REAL info[LM_INFO_SZ],
|
||||
/* O: information regarding the minimization. Set to NULL if don't care
|
||||
* info[0]= ||e||_2 at initial p.
|
||||
* info[1-4]=[ ||e||_2, ||J^T e||_inf, ||Dp||_2, mu/max[J^T J]_ii ], all computed at estimated p.
|
||||
* info[5]= # iterations,
|
||||
* info[6]=reason for terminating: 1 - stopped by small gradient J^T e
|
||||
* 2 - stopped by small Dp
|
||||
* 3 - stopped by itmax
|
||||
* 4 - singular matrix. Restart from current p with increased mu
|
||||
* 5 - no further error reduction is possible. Restart with increased mu
|
||||
* 6 - stopped by small ||e||_2
|
||||
* 7 - stopped by invalid (i.e. NaN or Inf) "func" values. This is a user error
|
||||
* info[7]= # function evaluations
|
||||
* info[8]= # Jacobian evaluations
|
||||
* info[9]= # linear systems solved, i.e. # attempts for reducing error
|
||||
*/
|
||||
LM_REAL *work, /* working memory at least LM_LEC_DIF_WORKSZ() reals large, allocated if NULL */
|
||||
LM_REAL *covar, /* O: Covariance matrix corresponding to LS solution; mxm. Set to NULL if not needed. */
|
||||
void *adata) /* pointer to possibly additional data, passed uninterpreted to func.
|
||||
* Set to NULL if not needed
|
||||
*/
|
||||
{
|
||||
struct LMLEC_DATA data;
|
||||
LM_REAL *ptr, *Z, *pp, *p0, *Zimm; /* Z is mxmm */
|
||||
int mm, ret;
|
||||
register int i, j;
|
||||
register LM_REAL tmp;
|
||||
LM_REAL locinfo[LM_INFO_SZ];
|
||||
|
||||
mm=m-k;
|
||||
|
||||
if(n<mm){
|
||||
fprintf(stderr, LCAT(LEVMAR_LEC_DIF, "(): cannot solve a problem with fewer measurements + equality constraints [%d + %d] than unknowns [%d]\n"), n, k, m);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
ptr=(LM_REAL *)malloc((2*m + m*mm + mm)*sizeof(LM_REAL));
|
||||
if(!ptr){
|
||||
fprintf(stderr, LCAT(LEVMAR_LEC_DIF, "(): memory allocation request failed\n"));
|
||||
return LM_ERROR;
|
||||
}
|
||||
data.p=p;
|
||||
p0=ptr;
|
||||
data.c=p0+m;
|
||||
data.Z=Z=data.c+m;
|
||||
data.jac=NULL;
|
||||
pp=data.Z+m*mm;
|
||||
data.ncnstr=k;
|
||||
data.func=func;
|
||||
data.jacf=NULL;
|
||||
data.adata=adata;
|
||||
|
||||
ret=LMLEC_ELIM(A, b, data.c, NULL, Z, k, m); // compute c, Z
|
||||
if(ret==LM_ERROR){
|
||||
free(ptr);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
/* compute pp s.t. p = c + Z*pp or (Z^T Z)*pp=Z^T*(p-c)
|
||||
* Due to orthogonality, Z^T Z = I and the last equation
|
||||
* becomes pp=Z^T*(p-c). Also, save the starting p in p0
|
||||
*/
|
||||
for(i=0; i<m; ++i){
|
||||
p0[i]=p[i];
|
||||
p[i]-=data.c[i];
|
||||
}
|
||||
|
||||
/* Z^T*(p-c) */
|
||||
for(i=0; i<mm; ++i){
|
||||
for(j=0, tmp=0.0; j<m; ++j)
|
||||
tmp+=Z[j*mm+i]*p[j];
|
||||
pp[i]=tmp;
|
||||
}
|
||||
|
||||
/* compute the p corresponding to pp (i.e. c + Z*pp) and compare with p0 */
|
||||
for(i=0; i<m; ++i){
|
||||
Zimm=Z+i*mm;
|
||||
for(j=0, tmp=data.c[i]; j<mm; ++j)
|
||||
tmp+=Zimm[j]*pp[j]; // tmp+=Z[i*mm+j]*pp[j];
|
||||
if(FABS(tmp-p0[i])>LM_CNST(1E-03))
|
||||
fprintf(stderr, RCAT("Warning: component %d of starting point not feasible in ", LEVMAR_LEC_DIF) "()! [%.10g reset to %.10g]\n",
|
||||
i, p0[i], tmp);
|
||||
}
|
||||
|
||||
if(!info) info=locinfo; /* make sure that LEVMAR_DIF() is called with non-null info */
|
||||
/* note that covariance computation is not requested from LEVMAR_DIF() */
|
||||
ret=LEVMAR_DIF(LMLEC_FUNC, pp, x, mm, n, itmax, opts, info, work, NULL, (void *)&data);
|
||||
|
||||
/* p=c + Z*pp */
|
||||
for(i=0; i<m; ++i){
|
||||
Zimm=Z+i*mm;
|
||||
for(j=0, tmp=data.c[i]; j<mm; ++j)
|
||||
tmp+=Zimm[j]*pp[j]; // tmp+=Z[i*mm+j]*pp[j];
|
||||
p[i]=tmp;
|
||||
}
|
||||
|
||||
/* compute the Jacobian with finite differences and use it to estimate the covariance */
|
||||
if(covar){
|
||||
LM_REAL *hx, *wrk, *jac;
|
||||
|
||||
hx=(LM_REAL *)malloc((2*n+n*m)*sizeof(LM_REAL));
|
||||
if(!hx){
|
||||
fprintf(stderr, LCAT(LEVMAR_LEC_DIF, "(): memory allocation request failed\n"));
|
||||
free(ptr);
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
wrk=hx+n;
|
||||
jac=wrk+n;
|
||||
|
||||
(*func)(p, hx, m, n, adata); /* evaluate function at p */
|
||||
LEVMAR_FDIF_FORW_JAC_APPROX(func, p, hx, wrk, (LM_REAL)LM_DIFF_DELTA, jac, m, n, adata); /* compute the Jacobian at p */
|
||||
LEVMAR_TRANS_MAT_MAT_MULT(jac, covar, n, m); /* covar = J^T J */
|
||||
LEVMAR_COVAR(covar, covar, info[1], m, n);
|
||||
free(hx);
|
||||
}
|
||||
|
||||
free(ptr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* undefine all. THIS MUST REMAIN AT THE END OF THE FILE */
|
||||
#undef LMLEC_DATA
|
||||
#undef LMLEC_ELIM
|
||||
#undef LMLEC_FUNC
|
||||
#undef LMLEC_JACF
|
||||
#undef LEVMAR_FDIF_FORW_JAC_APPROX
|
||||
#undef LEVMAR_COVAR
|
||||
#undef LEVMAR_TRANS_MAT_MAT_MULT
|
||||
#undef LEVMAR_LEC_DER
|
||||
#undef LEVMAR_LEC_DIF
|
||||
#undef LEVMAR_DER
|
||||
#undef LEVMAR_DIF
|
||||
|
||||
#undef GEQP3
|
||||
#undef ORGQR
|
||||
#undef TRTRI
|
||||
70
contrib/levmar/misc.c
Normal file
70
contrib/levmar/misc.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2004-05 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/********************************************************************************
|
||||
* Miscelaneous functions for Levenberg-Marquardt nonlinear minimization. The
|
||||
* same core code is used with appropriate #defines to derive single and double
|
||||
* precision versions, see also misc_core.c
|
||||
********************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "levmar.h"
|
||||
#include "misc.h"
|
||||
|
||||
#if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC)
|
||||
#error At least one of LM_DBL_PREC, LM_SNGL_PREC should be defined!
|
||||
#endif
|
||||
|
||||
#ifdef LM_SNGL_PREC
|
||||
/* single precision (float) definitions */
|
||||
#define LM_REAL float
|
||||
#define LM_PREFIX s
|
||||
|
||||
#define LM_REAL_EPSILON FLT_EPSILON
|
||||
#define __SUBCNST(x) x##F
|
||||
#define LM_CNST(x) __SUBCNST(x) // force substitution
|
||||
|
||||
#include "misc_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_REAL_EPSILON
|
||||
#undef __SUBCNST
|
||||
#undef LM_CNST
|
||||
#endif /* LM_SNGL_PREC */
|
||||
|
||||
#ifdef LM_DBL_PREC
|
||||
/* double precision definitions */
|
||||
#define LM_REAL double
|
||||
#define LM_PREFIX d
|
||||
|
||||
#define LM_REAL_EPSILON DBL_EPSILON
|
||||
#define LM_CNST(x) (x)
|
||||
|
||||
#include "misc_core.c" // read in core code
|
||||
|
||||
#undef LM_REAL
|
||||
#undef LM_PREFIX
|
||||
#undef LM_REAL_EPSILON
|
||||
#undef LM_CNST
|
||||
#endif /* LM_DBL_PREC */
|
||||
114
contrib/levmar/misc.h
Normal file
114
contrib/levmar/misc.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2004 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MISC_H_
|
||||
#define _MISC_H_
|
||||
|
||||
/* common suffix for LAPACK subroutines. Define empty in case of no prefix. */
|
||||
#define LM_LAPACK_SUFFIX _
|
||||
//#define LM_LAPACK_SUFFIX // define empty
|
||||
|
||||
/* common prefix for BLAS subroutines. Leave undefined in case of no prefix.
|
||||
* You might also need to modify LM_BLAS_PREFIX below
|
||||
*/
|
||||
/* f2c'd BLAS */
|
||||
//#define LM_BLAS_PREFIX f2c_
|
||||
/* C BLAS */
|
||||
//#define LM_BLAS_PREFIX cblas_
|
||||
|
||||
/* common suffix for BLAS subroutines */
|
||||
//#define LM_BLAS_SUFFIX // define empty if a f2c_ or cblas_ prefix was defined for LM_BLAS_PREFIX above
|
||||
#define LM_BLAS_SUFFIX _ // use this in case of no BLAS prefix
|
||||
|
||||
|
||||
#define LCAT_(a, b) #a b
|
||||
#define LCAT(a, b) LCAT_(a, b) // force substitution
|
||||
#define RCAT_(a, b) a #b
|
||||
#define RCAT(a, b) RCAT_(a, b) // force substitution
|
||||
|
||||
#define LM_MK_LAPACK_NAME(s) LM_ADD_PREFIX(LM_CAT_(s, LM_LAPACK_SUFFIX))
|
||||
|
||||
#ifdef LM_BLAS_PREFIX
|
||||
#define LM_MK_BLAS_NAME(s) LM_CAT_(LM_BLAS_PREFIX, LM_ADD_PREFIX(LM_CAT_(s, LM_BLAS_SUFFIX)))
|
||||
#else
|
||||
#define LM_MK_BLAS_NAME(s) LM_ADD_PREFIX(LM_CAT_(s, LM_BLAS_SUFFIX))
|
||||
#endif
|
||||
|
||||
|
||||
#define __BLOCKSZ__ 32 /* block size for cache-friendly matrix-matrix multiply. It should be
|
||||
* such that __BLOCKSZ__^2*sizeof(LM_REAL) is smaller than the CPU (L1)
|
||||
* data cache size. Notice that a value of 32 when LM_REAL=double assumes
|
||||
* an 8Kb L1 data cache (32*32*8=8K). This is a concervative choice since
|
||||
* newer Pentium 4s have a L1 data cache of size 16K, capable of holding
|
||||
* up to 45x45 double blocks.
|
||||
*/
|
||||
#define __BLOCKSZ__SQ (__BLOCKSZ__)*(__BLOCKSZ__)
|
||||
|
||||
/* add a prefix in front of a token */
|
||||
#define LM_CAT__(a, b) a ## b
|
||||
#define LM_CAT_(a, b) LM_CAT__(a, b) // force substitution
|
||||
#define LM_ADD_PREFIX(s) LM_CAT_(LM_PREFIX, s)
|
||||
|
||||
#define FABS(x) (((x)>=0.0)? (x) : -(x))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* blocking-based matrix multiply */
|
||||
extern void slevmar_trans_mat_mat_mult(float *a, float *b, int n, int m);
|
||||
extern void dlevmar_trans_mat_mat_mult(double *a, double *b, int n, int m);
|
||||
|
||||
/* forward finite differences */
|
||||
extern void slevmar_fdif_forw_jac_approx(void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
float *p, float *hx, float *hxx, float delta,
|
||||
float *jac, int m, int n, void *adata);
|
||||
extern void dlevmar_fdif_forw_jac_approx(void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
double *p, double *hx, double *hxx, double delta,
|
||||
double *jac, int m, int n, void *adata);
|
||||
|
||||
/* central finite differences */
|
||||
extern void slevmar_fdif_cent_jac_approx(void (*func)(float *p, float *hx, int m, int n, void *adata),
|
||||
float *p, float *hxm, float *hxp, float delta,
|
||||
float *jac, int m, int n, void *adata);
|
||||
extern void dlevmar_fdif_cent_jac_approx(void (*func)(double *p, double *hx, int m, int n, void *adata),
|
||||
double *p, double *hxm, double *hxp, double delta,
|
||||
double *jac, int m, int n, void *adata);
|
||||
|
||||
/* e=x-y and ||e|| */
|
||||
extern float slevmar_L2nrmxmy(float *e, float *x, float *y, int n);
|
||||
extern double dlevmar_L2nrmxmy(double *e, double *x, double *y, int n);
|
||||
|
||||
/* covariance of LS fit */
|
||||
extern int slevmar_covar(float *JtJ, float *C, float sumsq, int m, int n);
|
||||
extern int dlevmar_covar(double *JtJ, double *C, double sumsq, int m, int n);
|
||||
|
||||
/* box constraints consistency check */
|
||||
extern int slevmar_box_check(float *lb, float *ub, int m);
|
||||
extern int dlevmar_box_check(double *lb, double *ub, int m);
|
||||
|
||||
/* Cholesky */
|
||||
extern int slevmar_chol(float *C, float *W, int m);
|
||||
extern int dlevmar_chol(double *C, double *W, int m);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MISC_H_ */
|
||||
829
contrib/levmar/misc_core.c
Normal file
829
contrib/levmar/misc_core.c
Normal file
@@ -0,0 +1,829 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Levenberg - Marquardt non-linear minimization algorithm
|
||||
// Copyright (C) 2004-05 Manolis Lourakis (lourakis at ics forth gr)
|
||||
// Institute of Computer Science, Foundation for Research & Technology - Hellas
|
||||
// Heraklion, Crete, Greece.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef LM_REAL // not included by misc.c
|
||||
#error This file should not be compiled directly!
|
||||
#endif
|
||||
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#pragma GCC diagnostic ignored "-Wcpp"
|
||||
|
||||
/* precision-specific definitions */
|
||||
#define LEVMAR_CHKJAC LM_ADD_PREFIX(levmar_chkjac)
|
||||
#define LEVMAR_FDIF_FORW_JAC_APPROX LM_ADD_PREFIX(levmar_fdif_forw_jac_approx)
|
||||
#define LEVMAR_FDIF_CENT_JAC_APPROX LM_ADD_PREFIX(levmar_fdif_cent_jac_approx)
|
||||
#define LEVMAR_TRANS_MAT_MAT_MULT LM_ADD_PREFIX(levmar_trans_mat_mat_mult)
|
||||
#define LEVMAR_COVAR LM_ADD_PREFIX(levmar_covar)
|
||||
#define LEVMAR_STDDEV LM_ADD_PREFIX(levmar_stddev)
|
||||
#define LEVMAR_CORCOEF LM_ADD_PREFIX(levmar_corcoef)
|
||||
#define LEVMAR_R2 LM_ADD_PREFIX(levmar_R2)
|
||||
#define LEVMAR_BOX_CHECK LM_ADD_PREFIX(levmar_box_check)
|
||||
#define LEVMAR_L2NRMXMY LM_ADD_PREFIX(levmar_L2nrmxmy)
|
||||
|
||||
#ifdef HAVE_LAPACK
|
||||
#define LEVMAR_PSEUDOINVERSE LM_ADD_PREFIX(levmar_pseudoinverse)
|
||||
static int LEVMAR_PSEUDOINVERSE(LM_REAL *A, LM_REAL *B, int m);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* BLAS matrix multiplication, LAPACK SVD & Cholesky routines */
|
||||
#define GEMM LM_MK_BLAS_NAME(gemm)
|
||||
/* C := alpha*op( A )*op( B ) + beta*C */
|
||||
extern void GEMM(char *transa, char *transb, int *m, int *n, int *k,
|
||||
LM_REAL *alpha, LM_REAL *a, int *lda, LM_REAL *b, int *ldb, LM_REAL *beta, LM_REAL *c, int *ldc);
|
||||
|
||||
#define GESVD LM_MK_LAPACK_NAME(gesvd)
|
||||
#define GESDD LM_MK_LAPACK_NAME(gesdd)
|
||||
extern int GESVD(char *jobu, char *jobvt, int *m, int *n, LM_REAL *a, int *lda, LM_REAL *s, LM_REAL *u, int *ldu,
|
||||
LM_REAL *vt, int *ldvt, LM_REAL *work, int *lwork, int *info);
|
||||
|
||||
/* lapack 3.0 new SVD routine, faster than xgesvd() */
|
||||
extern int GESDD(char *jobz, int *m, int *n, LM_REAL *a, int *lda, LM_REAL *s, LM_REAL *u, int *ldu, LM_REAL *vt, int *ldvt,
|
||||
LM_REAL *work, int *lwork, int *iwork, int *info);
|
||||
|
||||
/* Cholesky decomposition */
|
||||
#define POTF2 LM_MK_LAPACK_NAME(potf2)
|
||||
extern int POTF2(char *uplo, int *n, LM_REAL *a, int *lda, int *info);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define LEVMAR_CHOLESKY LM_ADD_PREFIX(levmar_chol)
|
||||
|
||||
#else /* !HAVE_LAPACK */
|
||||
#define LEVMAR_LUINVERSE LM_ADD_PREFIX(levmar_LUinverse_noLapack)
|
||||
|
||||
static int LEVMAR_LUINVERSE(LM_REAL *A, LM_REAL *B, int m);
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
/* blocked multiplication of the transpose of the nxm matrix a with itself (i.e. a^T a)
|
||||
* using a block size of bsize. The product is returned in b.
|
||||
* Since a^T a is symmetric, its computation can be sped up by computing only its
|
||||
* upper triangular part and copying it to the lower part.
|
||||
*
|
||||
* More details on blocking can be found at
|
||||
* http://www-2.cs.cmu.edu/afs/cs/academic/class/15213-f02/www/R07/section_a/Recitation07-SectionA.pdf
|
||||
*/
|
||||
void LEVMAR_TRANS_MAT_MAT_MULT(LM_REAL *a, LM_REAL *b, int n, int m)
|
||||
{
|
||||
#ifdef HAVE_LAPACK /* use BLAS matrix multiply */
|
||||
|
||||
LM_REAL alpha=LM_CNST(1.0), beta=LM_CNST(0.0);
|
||||
/* Fool BLAS to compute a^T*a avoiding transposing a: a is equivalent to a^T in column major,
|
||||
* therefore BLAS computes a*a^T with a and a*a^T in column major, which is equivalent to
|
||||
* computing a^T*a in row major!
|
||||
*/
|
||||
GEMM("N", "T", &m, &m, &n, &alpha, a, &m, a, &m, &beta, b, &m);
|
||||
|
||||
#else /* no LAPACK, use blocking-based multiply */
|
||||
|
||||
register int i, j, k, jj, kk;
|
||||
register LM_REAL sum, *bim, *akm;
|
||||
const int bsize=__BLOCKSZ__;
|
||||
|
||||
#define __MIN__(x, y) (((x)<=(y))? (x) : (y))
|
||||
#define __MAX__(x, y) (((x)>=(y))? (x) : (y))
|
||||
|
||||
/* compute upper triangular part using blocking */
|
||||
for(jj=0; jj<m; jj+=bsize){
|
||||
for(i=0; i<m; ++i){
|
||||
bim=b+i*m;
|
||||
for(j=__MAX__(jj, i); j<__MIN__(jj+bsize, m); ++j)
|
||||
bim[j]=0.0; //b[i*m+j]=0.0;
|
||||
}
|
||||
|
||||
for(kk=0; kk<n; kk+=bsize){
|
||||
for(i=0; i<m; ++i){
|
||||
bim=b+i*m;
|
||||
for(j=__MAX__(jj, i); j<__MIN__(jj+bsize, m); ++j){
|
||||
sum=0.0;
|
||||
for(k=kk; k<__MIN__(kk+bsize, n); ++k){
|
||||
akm=a+k*m;
|
||||
sum+=akm[i]*akm[j]; //a[k*m+i]*a[k*m+j];
|
||||
}
|
||||
bim[j]+=sum; //b[i*m+j]+=sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* copy upper triangular part to the lower one */
|
||||
for(i=0; i<m; ++i)
|
||||
for(j=0; j<i; ++j)
|
||||
b[i*m+j]=b[j*m+i];
|
||||
|
||||
#undef __MIN__
|
||||
#undef __MAX__
|
||||
|
||||
#endif /* HAVE_LAPACK */
|
||||
}
|
||||
|
||||
/* forward finite difference approximation to the Jacobian of func */
|
||||
void LEVMAR_FDIF_FORW_JAC_APPROX(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata),
|
||||
/* function to differentiate */
|
||||
LM_REAL *p, /* I: current parameter estimate, mx1 */
|
||||
LM_REAL *hx, /* I: func evaluated at p, i.e. hx=func(p), nx1 */
|
||||
LM_REAL *hxx, /* W/O: work array for evaluating func(p+delta), nx1 */
|
||||
LM_REAL delta, /* increment for computing the Jacobian */
|
||||
LM_REAL *jac, /* O: array for storing approximated Jacobian, nxm */
|
||||
int m,
|
||||
int n,
|
||||
void *adata)
|
||||
{
|
||||
register int i, j;
|
||||
LM_REAL tmp;
|
||||
register LM_REAL d;
|
||||
|
||||
for(j=0; j<m; ++j){
|
||||
/* determine d=max(1E-04*|p[j]|, delta), see HZ */
|
||||
d=LM_CNST(1E-04)*p[j]; // force evaluation
|
||||
d=FABS(d);
|
||||
if(d<delta)
|
||||
d=delta;
|
||||
|
||||
tmp=p[j];
|
||||
p[j]+=d;
|
||||
|
||||
(*func)(p, hxx, m, n, adata);
|
||||
|
||||
p[j]=tmp; /* restore */
|
||||
|
||||
d=LM_CNST(1.0)/d; /* invert so that divisions can be carried out faster as multiplications */
|
||||
for(i=0; i<n; ++i){
|
||||
jac[i*m+j]=(hxx[i]-hx[i])*d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* central finite difference approximation to the Jacobian of func */
|
||||
void LEVMAR_FDIF_CENT_JAC_APPROX(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata),
|
||||
/* function to differentiate */
|
||||
LM_REAL *p, /* I: current parameter estimate, mx1 */
|
||||
LM_REAL *hxm, /* W/O: work array for evaluating func(p-delta), nx1 */
|
||||
LM_REAL *hxp, /* W/O: work array for evaluating func(p+delta), nx1 */
|
||||
LM_REAL delta, /* increment for computing the Jacobian */
|
||||
LM_REAL *jac, /* O: array for storing approximated Jacobian, nxm */
|
||||
int m,
|
||||
int n,
|
||||
void *adata)
|
||||
{
|
||||
register int i, j;
|
||||
LM_REAL tmp;
|
||||
register LM_REAL d;
|
||||
|
||||
for(j=0; j<m; ++j){
|
||||
/* determine d=max(1E-04*|p[j]|, delta), see HZ */
|
||||
d=LM_CNST(1E-04)*p[j]; // force evaluation
|
||||
d=FABS(d);
|
||||
if(d<delta)
|
||||
d=delta;
|
||||
|
||||
tmp=p[j];
|
||||
p[j]-=d;
|
||||
(*func)(p, hxm, m, n, adata);
|
||||
|
||||
p[j]=tmp+d;
|
||||
(*func)(p, hxp, m, n, adata);
|
||||
p[j]=tmp; /* restore */
|
||||
|
||||
d=LM_CNST(0.5)/d; /* invert so that divisions can be carried out faster as multiplications */
|
||||
for(i=0; i<n; ++i){
|
||||
jac[i*m+j]=(hxp[i]-hxm[i])*d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the Jacobian of a n-valued nonlinear function in m variables
|
||||
* evaluated at a point p, for consistency with the function itself.
|
||||
*
|
||||
* Based on fortran77 subroutine CHKDER by
|
||||
* Burton S. Garbow, Kenneth E. Hillstrom, Jorge J. More
|
||||
* Argonne National Laboratory. MINPACK project. March 1980.
|
||||
*
|
||||
*
|
||||
* func points to a function from R^m --> R^n: Given a p in R^m it yields hx in R^n
|
||||
* jacf points to a function implementing the Jacobian of func, whose correctness
|
||||
* is to be tested. Given a p in R^m, jacf computes into the nxm matrix j the
|
||||
* Jacobian of func at p. Note that row i of j corresponds to the gradient of
|
||||
* the i-th component of func, evaluated at p.
|
||||
* p is an input array of length m containing the point of evaluation.
|
||||
* m is the number of variables
|
||||
* n is the number of functions
|
||||
* adata points to possible additional data and is passed uninterpreted
|
||||
* to func, jacf.
|
||||
* err is an array of length n. On output, err contains measures
|
||||
* of correctness of the respective gradients. if there is
|
||||
* no severe loss of significance, then if err[i] is 1.0 the
|
||||
* i-th gradient is correct, while if err[i] is 0.0 the i-th
|
||||
* gradient is incorrect. For values of err between 0.0 and 1.0,
|
||||
* the categorization is less certain. In general, a value of
|
||||
* err[i] greater than 0.5 indicates that the i-th gradient is
|
||||
* probably correct, while a value of err[i] less than 0.5
|
||||
* indicates that the i-th gradient is probably incorrect.
|
||||
*
|
||||
*
|
||||
* The function does not perform reliably if cancellation or
|
||||
* rounding errors cause a severe loss of significance in the
|
||||
* evaluation of a function. therefore, none of the components
|
||||
* of p should be unusually small (in particular, zero) or any
|
||||
* other value which may cause loss of significance.
|
||||
*/
|
||||
|
||||
void LEVMAR_CHKJAC(
|
||||
void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata),
|
||||
void (*jacf)(LM_REAL *p, LM_REAL *j, int m, int n, void *adata),
|
||||
LM_REAL *p, int m, int n, void *adata, LM_REAL *err)
|
||||
{
|
||||
LM_REAL factor=LM_CNST(100.0);
|
||||
LM_REAL one=LM_CNST(1.0);
|
||||
LM_REAL zero=LM_CNST(0.0);
|
||||
LM_REAL *fvec, *fjac, *pp, *fvecp, *buf;
|
||||
|
||||
register int i, j;
|
||||
LM_REAL eps, epsf, temp, epsmch;
|
||||
LM_REAL epslog;
|
||||
int fvec_sz=n, fjac_sz=n*m, pp_sz=m, fvecp_sz=n;
|
||||
|
||||
epsmch=LM_REAL_EPSILON;
|
||||
eps=(LM_REAL)sqrt(epsmch);
|
||||
|
||||
buf=(LM_REAL *)malloc((fvec_sz + fjac_sz + pp_sz + fvecp_sz)*sizeof(LM_REAL));
|
||||
if(!buf){
|
||||
fprintf(stderr, LCAT(LEVMAR_CHKJAC, "(): memory allocation request failed\n"));
|
||||
exit(1);
|
||||
}
|
||||
fvec=buf;
|
||||
fjac=fvec+fvec_sz;
|
||||
pp=fjac+fjac_sz;
|
||||
fvecp=pp+pp_sz;
|
||||
|
||||
/* compute fvec=func(p) */
|
||||
(*func)(p, fvec, m, n, adata);
|
||||
|
||||
/* compute the Jacobian at p */
|
||||
(*jacf)(p, fjac, m, n, adata);
|
||||
|
||||
/* compute pp */
|
||||
for(j=0; j<m; ++j){
|
||||
temp=eps*FABS(p[j]);
|
||||
if(temp==zero) temp=eps;
|
||||
pp[j]=p[j]+temp;
|
||||
}
|
||||
|
||||
/* compute fvecp=func(pp) */
|
||||
(*func)(pp, fvecp, m, n, adata);
|
||||
|
||||
epsf=factor*epsmch;
|
||||
epslog=(LM_REAL)log10(eps);
|
||||
|
||||
for(i=0; i<n; ++i)
|
||||
err[i]=zero;
|
||||
|
||||
for(j=0; j<m; ++j){
|
||||
temp=FABS(p[j]);
|
||||
if(temp==zero) temp=one;
|
||||
|
||||
for(i=0; i<n; ++i)
|
||||
err[i]+=temp*fjac[i*m+j];
|
||||
}
|
||||
|
||||
for(i=0; i<n; ++i){
|
||||
temp=one;
|
||||
if(fvec[i]!=zero && fvecp[i]!=zero && FABS(fvecp[i]-fvec[i])>=epsf*FABS(fvec[i]))
|
||||
temp=eps*FABS((fvecp[i]-fvec[i])/eps - err[i])/(FABS(fvec[i])+FABS(fvecp[i]));
|
||||
err[i]=one;
|
||||
if(temp>epsmch && temp<eps)
|
||||
err[i]=((LM_REAL)log10(temp) - epslog)/epslog;
|
||||
if(temp>=eps) err[i]=zero;
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LAPACK
|
||||
/*
|
||||
* This function computes the pseudoinverse of a square matrix A
|
||||
* into B using SVD. A and B can coincide
|
||||
*
|
||||
* The function returns 0 in case of error (e.g. A is singular),
|
||||
* the rank of A if successful
|
||||
*
|
||||
* A, B are mxm
|
||||
*
|
||||
*/
|
||||
static int LEVMAR_PSEUDOINVERSE(LM_REAL *A, LM_REAL *B, int m)
|
||||
{
|
||||
LM_REAL *buf=NULL;
|
||||
int buf_sz=0;
|
||||
static LM_REAL eps=LM_CNST(-1.0);
|
||||
|
||||
register int i, j;
|
||||
LM_REAL *a, *u, *s, *vt, *work;
|
||||
int a_sz, u_sz, s_sz, vt_sz, tot_sz;
|
||||
LM_REAL thresh, one_over_denom;
|
||||
int info, rank, worksz, *iwork, iworksz;
|
||||
|
||||
/* calculate required memory size */
|
||||
worksz=5*m; // min worksize for GESVD
|
||||
//worksz=m*(7*m+4); // min worksize for GESDD
|
||||
iworksz=8*m;
|
||||
a_sz=m*m;
|
||||
u_sz=m*m; s_sz=m; vt_sz=m*m;
|
||||
|
||||
tot_sz=(a_sz + u_sz + s_sz + vt_sz + worksz)*sizeof(LM_REAL) + iworksz*sizeof(int); /* should be arranged in that order for proper doubles alignment */
|
||||
|
||||
buf_sz=tot_sz;
|
||||
buf=(LM_REAL *)malloc(buf_sz);
|
||||
if(!buf){
|
||||
fprintf(stderr, RCAT("memory allocation in ", LEVMAR_PSEUDOINVERSE) "() failed!\n");
|
||||
return 0; /* error */
|
||||
}
|
||||
|
||||
a=buf;
|
||||
u=a+a_sz;
|
||||
s=u+u_sz;
|
||||
vt=s+s_sz;
|
||||
work=vt+vt_sz;
|
||||
iwork=(int *)(work+worksz);
|
||||
|
||||
/* store A (column major!) into a */
|
||||
for(i=0; i<m; i++)
|
||||
for(j=0; j<m; j++)
|
||||
a[i+j*m]=A[i*m+j];
|
||||
|
||||
/* SVD decomposition of A */
|
||||
GESVD("A", "A", (int *)&m, (int *)&m, a, (int *)&m, s, u, (int *)&m, vt, (int *)&m, work, (int *)&worksz, &info);
|
||||
//GESDD("A", (int *)&m, (int *)&m, a, (int *)&m, s, u, (int *)&m, vt, (int *)&m, work, (int *)&worksz, iwork, &info);
|
||||
|
||||
/* error treatment */
|
||||
if(info!=0){
|
||||
if(info<0){
|
||||
fprintf(stderr, RCAT(RCAT(RCAT("LAPACK error: illegal value for argument %d of ", GESVD), "/" GESDD) " in ", LEVMAR_PSEUDOINVERSE) "()\n", -info);
|
||||
}
|
||||
else{
|
||||
fprintf(stderr, RCAT("LAPACK error: dgesdd (dbdsdc)/dgesvd (dbdsqr) failed to converge in ", LEVMAR_PSEUDOINVERSE) "() [info=%d]\n", info);
|
||||
}
|
||||
free(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(eps<0.0){
|
||||
LM_REAL aux;
|
||||
|
||||
/* compute machine epsilon */
|
||||
for(eps=LM_CNST(1.0); aux=eps+LM_CNST(1.0), aux-LM_CNST(1.0)>0.0; eps*=LM_CNST(0.5))
|
||||
;
|
||||
eps*=LM_CNST(2.0);
|
||||
}
|
||||
|
||||
/* compute the pseudoinverse in B */
|
||||
for(i=0; i<a_sz; i++) B[i]=0.0; /* initialize to zero */
|
||||
for(rank=0, thresh=eps*s[0]; rank<m && s[rank]>thresh; rank++){
|
||||
one_over_denom=LM_CNST(1.0)/s[rank];
|
||||
|
||||
for(j=0; j<m; j++)
|
||||
for(i=0; i<m; i++)
|
||||
B[i*m+j]+=vt[rank+i*m]*u[j+rank*m]*one_over_denom;
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
return rank;
|
||||
}
|
||||
#else // no LAPACK
|
||||
|
||||
/*
|
||||
* This function computes the inverse of A in B. A and B can coincide
|
||||
*
|
||||
* The function employs LAPACK-free LU decomposition of A to solve m linear
|
||||
* systems A*B_i=I_i, where B_i and I_i are the i-th columns of B and I.
|
||||
*
|
||||
* A and B are mxm
|
||||
*
|
||||
* The function returns 0 in case of error, 1 if successful
|
||||
*
|
||||
*/
|
||||
static int LEVMAR_LUINVERSE(LM_REAL *A, LM_REAL *B, int m)
|
||||
{
|
||||
void *buf=NULL;
|
||||
//int buf_sz=0;
|
||||
|
||||
register int i, j, k, l;
|
||||
int *idx, maxi=-1, idx_sz, a_sz, x_sz, work_sz, tot_sz;
|
||||
LM_REAL *a, *x, *work, max, sum, tmp;
|
||||
|
||||
/* calculate required memory size */
|
||||
idx_sz=m;
|
||||
a_sz=m*m;
|
||||
x_sz=m;
|
||||
work_sz=m;
|
||||
tot_sz=(a_sz + x_sz + work_sz)*sizeof(LM_REAL) + idx_sz*sizeof(int); /* should be arranged in that order for proper doubles alignment */
|
||||
|
||||
//buf_sz=tot_sz;
|
||||
buf=(void *)malloc(tot_sz);
|
||||
if(!buf){
|
||||
fprintf(stderr, RCAT("memory allocation in ", LEVMAR_LUINVERSE) "() failed!\n");
|
||||
return 0; /* error */
|
||||
}
|
||||
|
||||
a=buf;
|
||||
x=a+a_sz;
|
||||
work=x+x_sz;
|
||||
idx=(int *)(work+work_sz);
|
||||
|
||||
/* avoid destroying A by copying it to a */
|
||||
for(i=0; i<a_sz; ++i) a[i]=A[i];
|
||||
|
||||
/* compute the LU decomposition of a row permutation of matrix a; the permutation itself is saved in idx[] */
|
||||
for(i=0; i<m; ++i){
|
||||
max=0.0;
|
||||
for(j=0; j<m; ++j)
|
||||
if((tmp=FABS(a[i*m+j]))>max)
|
||||
max=tmp;
|
||||
if(max==0.0){
|
||||
fprintf(stderr, RCAT("Singular matrix A in ", LEVMAR_LUINVERSE) "()!\n");
|
||||
free(buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
work[i]=LM_CNST(1.0)/max;
|
||||
}
|
||||
|
||||
for(j=0; j<m; ++j){
|
||||
for(i=0; i<j; ++i){
|
||||
sum=a[i*m+j];
|
||||
for(k=0; k<i; ++k)
|
||||
sum-=a[i*m+k]*a[k*m+j];
|
||||
a[i*m+j]=sum;
|
||||
}
|
||||
max=0.0;
|
||||
for(i=j; i<m; ++i){
|
||||
sum=a[i*m+j];
|
||||
for(k=0; k<j; ++k)
|
||||
sum-=a[i*m+k]*a[k*m+j];
|
||||
a[i*m+j]=sum;
|
||||
if((tmp=work[i]*FABS(sum))>=max){
|
||||
max=tmp;
|
||||
maxi=i;
|
||||
}
|
||||
}
|
||||
if(j!=maxi){
|
||||
for(k=0; k<m; ++k){
|
||||
tmp=a[maxi*m+k];
|
||||
a[maxi*m+k]=a[j*m+k];
|
||||
a[j*m+k]=tmp;
|
||||
}
|
||||
work[maxi]=work[j];
|
||||
}
|
||||
idx[j]=maxi;
|
||||
if(a[j*m+j]==0.0)
|
||||
a[j*m+j]=LM_REAL_EPSILON;
|
||||
if(j!=m-1){
|
||||
tmp=LM_CNST(1.0)/(a[j*m+j]);
|
||||
for(i=j+1; i<m; ++i)
|
||||
a[i*m+j]*=tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* The decomposition has now replaced a. Solve the m linear systems using
|
||||
* forward and back substitution
|
||||
*/
|
||||
for(l=0; l<m; ++l){
|
||||
for(i=0; i<m; ++i) x[i]=0.0;
|
||||
x[l]=LM_CNST(1.0);
|
||||
|
||||
for(i=k=0; i<m; ++i){
|
||||
j=idx[i];
|
||||
sum=x[j];
|
||||
x[j]=x[i];
|
||||
if(k!=0)
|
||||
for(j=k-1; j<i; ++j)
|
||||
sum-=a[i*m+j]*x[j];
|
||||
else
|
||||
if(sum!=0.0)
|
||||
k=i+1;
|
||||
x[i]=sum;
|
||||
}
|
||||
|
||||
for(i=m-1; i>=0; --i){
|
||||
sum=x[i];
|
||||
for(j=i+1; j<m; ++j)
|
||||
sum-=a[i*m+j]*x[j];
|
||||
x[i]=sum/a[i*m+i];
|
||||
}
|
||||
|
||||
for(i=0; i<m; ++i)
|
||||
B[i*m+l]=x[i];
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
/*
|
||||
* This function computes in C the covariance matrix corresponding to a least
|
||||
* squares fit. JtJ is the approximate Hessian at the solution (i.e. J^T*J, where
|
||||
* J is the Jacobian at the solution), sumsq is the sum of squared residuals
|
||||
* (i.e. goodnes of fit) at the solution, m is the number of parameters (variables)
|
||||
* and n the number of observations. JtJ can coincide with C.
|
||||
*
|
||||
* if JtJ is of full rank, C is computed as sumsq/(n-m)*(JtJ)^-1
|
||||
* otherwise and if LAPACK is available, C=sumsq/(n-r)*(JtJ)^+
|
||||
* where r is JtJ's rank and ^+ denotes the pseudoinverse
|
||||
* The diagonal of C is made up from the estimates of the variances
|
||||
* of the estimated regression coefficients.
|
||||
* See the documentation of routine E04YCF from the NAG fortran lib
|
||||
*
|
||||
* The function returns the rank of JtJ if successful, 0 on error
|
||||
*
|
||||
* A and C are mxm
|
||||
*
|
||||
*/
|
||||
int LEVMAR_COVAR(LM_REAL *JtJ, LM_REAL *C, LM_REAL sumsq, int m, int n)
|
||||
{
|
||||
register int i;
|
||||
int rnk;
|
||||
LM_REAL fact;
|
||||
|
||||
#ifdef HAVE_LAPACK
|
||||
rnk=LEVMAR_PSEUDOINVERSE(JtJ, C, m);
|
||||
if(!rnk) return 0;
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("LAPACK not available, LU will be used for matrix inversion when computing the covariance; this might be unstable at times")
|
||||
#else
|
||||
#warning LAPACK not available, LU will be used for matrix inversion when computing the covariance; this might be unstable at times
|
||||
#endif // _MSC_VER
|
||||
|
||||
rnk=LEVMAR_LUINVERSE(JtJ, C, m);
|
||||
if(!rnk) return 0;
|
||||
|
||||
rnk=m; /* assume full rank */
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
fact=sumsq/(LM_REAL)(n-rnk);
|
||||
for(i=0; i<m*m; ++i)
|
||||
C[i]*=fact;
|
||||
|
||||
return rnk;
|
||||
}
|
||||
|
||||
/* standard deviation of the best-fit parameter i.
|
||||
* covar is the mxm covariance matrix of the best-fit parameters (see also LEVMAR_COVAR()).
|
||||
*
|
||||
* The standard deviation is computed as \sigma_{i} = \sqrt{C_{ii}}
|
||||
*/
|
||||
LM_REAL LEVMAR_STDDEV(LM_REAL *covar, int m, int i)
|
||||
{
|
||||
return (LM_REAL)sqrt(covar[i*m+i]);
|
||||
}
|
||||
|
||||
/* Pearson's correlation coefficient of the best-fit parameters i and j.
|
||||
* covar is the mxm covariance matrix of the best-fit parameters (see also LEVMAR_COVAR()).
|
||||
*
|
||||
* The coefficient is computed as \rho_{ij} = C_{ij} / sqrt(C_{ii} C_{jj})
|
||||
*/
|
||||
LM_REAL LEVMAR_CORCOEF(LM_REAL *covar, int m, int i, int j)
|
||||
{
|
||||
return (LM_REAL)(covar[i*m+j]/sqrt(covar[i*m+i]*covar[j*m+j]));
|
||||
}
|
||||
|
||||
/* coefficient of determination.
|
||||
* see http://en.wikipedia.org/wiki/Coefficient_of_determination
|
||||
*/
|
||||
LM_REAL LEVMAR_R2(void (*func)(LM_REAL *p, LM_REAL *hx, int m, int n, void *adata),
|
||||
LM_REAL *p, LM_REAL *x, int m, int n, void *adata)
|
||||
{
|
||||
register int i;
|
||||
register LM_REAL tmp;
|
||||
LM_REAL SSerr, // sum of squared errors, i.e. residual sum of squares \sum_i (x_i-hx_i)^2
|
||||
SStot, // \sum_i (x_i-xavg)^2
|
||||
*hx, xavg;
|
||||
|
||||
|
||||
if((hx=(LM_REAL *)malloc(n*sizeof(LM_REAL)))==NULL){
|
||||
fprintf(stderr, RCAT("memory allocation request failed in ", LEVMAR_R2) "()\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* hx=f(p) */
|
||||
(*func)(p, hx, m, n, adata);
|
||||
|
||||
for(i=n, tmp=0.0; i-->0; )
|
||||
tmp+=x[i];
|
||||
xavg=tmp/(LM_REAL)n;
|
||||
|
||||
if(x)
|
||||
for(i=n, SSerr=SStot=0.0; i-->0; ){
|
||||
tmp=x[i]-hx[i];
|
||||
SSerr+=tmp*tmp;
|
||||
|
||||
tmp=x[i]-xavg;
|
||||
SStot+=tmp*tmp;
|
||||
}
|
||||
else /* x==0 */
|
||||
for(i=n, SSerr=SStot=0.0; i-->0; ){
|
||||
tmp=-hx[i];
|
||||
SSerr+=tmp*tmp;
|
||||
|
||||
tmp=-xavg;
|
||||
SStot+=tmp*tmp;
|
||||
}
|
||||
|
||||
free(hx);
|
||||
|
||||
return LM_CNST(1.0) - SSerr/SStot;
|
||||
}
|
||||
|
||||
/* check box constraints for consistency */
|
||||
int LEVMAR_BOX_CHECK(LM_REAL *lb, LM_REAL *ub, int m)
|
||||
{
|
||||
register int i;
|
||||
|
||||
if(!lb || !ub) return 1;
|
||||
|
||||
for(i=0; i<m; ++i)
|
||||
if(lb[i]>ub[i]) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LAPACK
|
||||
|
||||
/* compute the Cholesky decomposition of C in W, s.t. C=W^t W and W is upper triangular */
|
||||
int LEVMAR_CHOLESKY(LM_REAL *C, LM_REAL *W, int m)
|
||||
{
|
||||
register int i, j;
|
||||
int info;
|
||||
|
||||
/* copy weights array C to W so that LAPACK won't destroy it;
|
||||
* C is assumed symmetric, hence no transposition is needed
|
||||
*/
|
||||
for(i=0, j=m*m; i<j; ++i)
|
||||
W[i]=C[i];
|
||||
|
||||
/* Cholesky decomposition */
|
||||
POTF2("L", (int *)&m, W, (int *)&m, (int *)&info);
|
||||
/* error treatment */
|
||||
if(info!=0){
|
||||
if(info<0){
|
||||
fprintf(stderr, "LAPACK error: illegal value for argument %d of dpotf2 in %s\n", -info, LCAT(LEVMAR_CHOLESKY, "()"));
|
||||
}
|
||||
else{
|
||||
fprintf(stderr, "LAPACK error: the leading minor of order %d is not positive definite,\n%s()\n", info,
|
||||
RCAT("and the Cholesky factorization could not be completed in ", LEVMAR_CHOLESKY));
|
||||
}
|
||||
return LM_ERROR;
|
||||
}
|
||||
|
||||
/* the decomposition is in the lower part of W (in column-major order!).
|
||||
* zeroing the upper part makes it lower triangular which is equivalent to
|
||||
* upper triangular in row-major order
|
||||
*/
|
||||
for(i=0; i<m; i++)
|
||||
for(j=i+1; j<m; j++)
|
||||
W[i+j*m]=0.0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_LAPACK */
|
||||
|
||||
|
||||
/* Compute e=x-y for two n-vectors x and y and return the squared L2 norm of e.
|
||||
* e can coincide with either x or y; x can be NULL, in which case it is assumed
|
||||
* to be equal to the zero vector.
|
||||
* Uses loop unrolling and blocking to reduce bookkeeping overhead & pipeline
|
||||
* stalls and increase instruction-level parallelism; see http://www.abarnett.demon.co.uk/tutorial.html
|
||||
*/
|
||||
|
||||
LM_REAL LEVMAR_L2NRMXMY(LM_REAL *e, LM_REAL *x, LM_REAL *y, int n)
|
||||
{
|
||||
const int blocksize=8, bpwr=3; /* 8=2^3 */
|
||||
register int i;
|
||||
int j1, j2, j3, j4, j5, j6, j7;
|
||||
int blockn;
|
||||
register LM_REAL sum0=0.0, sum1=0.0, sum2=0.0, sum3=0.0;
|
||||
|
||||
/* n may not be divisible by blocksize,
|
||||
* go as near as we can first, then tidy up.
|
||||
*/
|
||||
blockn = (n>>bpwr)<<bpwr; /* (n / blocksize) * blocksize; */
|
||||
|
||||
/* unroll the loop in blocks of `blocksize'; looping downwards gains some more speed */
|
||||
if(x){
|
||||
for(i=blockn-1; i>0; i-=blocksize){
|
||||
e[i ]=x[i ]-y[i ]; sum0+=e[i ]*e[i ];
|
||||
j1=i-1; e[j1]=x[j1]-y[j1]; sum1+=e[j1]*e[j1];
|
||||
j2=i-2; e[j2]=x[j2]-y[j2]; sum2+=e[j2]*e[j2];
|
||||
j3=i-3; e[j3]=x[j3]-y[j3]; sum3+=e[j3]*e[j3];
|
||||
j4=i-4; e[j4]=x[j4]-y[j4]; sum0+=e[j4]*e[j4];
|
||||
j5=i-5; e[j5]=x[j5]-y[j5]; sum1+=e[j5]*e[j5];
|
||||
j6=i-6; e[j6]=x[j6]-y[j6]; sum2+=e[j6]*e[j6];
|
||||
j7=i-7; e[j7]=x[j7]-y[j7]; sum3+=e[j7]*e[j7];
|
||||
}
|
||||
|
||||
/*
|
||||
* There may be some left to do.
|
||||
* This could be done as a simple for() loop,
|
||||
* but a switch is faster (and more interesting)
|
||||
*/
|
||||
|
||||
i=blockn;
|
||||
if(i<n){
|
||||
/* Jump into the case at the place that will allow
|
||||
* us to finish off the appropriate number of items.
|
||||
*/
|
||||
|
||||
switch(n - i){
|
||||
case 7 : e[i]=x[i]-y[i]; sum0+=e[i]*e[i]; ++i;
|
||||
case 6 : e[i]=x[i]-y[i]; sum1+=e[i]*e[i]; ++i;
|
||||
case 5 : e[i]=x[i]-y[i]; sum2+=e[i]*e[i]; ++i;
|
||||
case 4 : e[i]=x[i]-y[i]; sum3+=e[i]*e[i]; ++i;
|
||||
case 3 : e[i]=x[i]-y[i]; sum0+=e[i]*e[i]; ++i;
|
||||
case 2 : e[i]=x[i]-y[i]; sum1+=e[i]*e[i]; ++i;
|
||||
case 1 : e[i]=x[i]-y[i]; sum2+=e[i]*e[i]; //++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{ /* x==0 */
|
||||
for(i=blockn-1; i>0; i-=blocksize){
|
||||
e[i ]=-y[i ]; sum0+=e[i ]*e[i ];
|
||||
j1=i-1; e[j1]=-y[j1]; sum1+=e[j1]*e[j1];
|
||||
j2=i-2; e[j2]=-y[j2]; sum2+=e[j2]*e[j2];
|
||||
j3=i-3; e[j3]=-y[j3]; sum3+=e[j3]*e[j3];
|
||||
j4=i-4; e[j4]=-y[j4]; sum0+=e[j4]*e[j4];
|
||||
j5=i-5; e[j5]=-y[j5]; sum1+=e[j5]*e[j5];
|
||||
j6=i-6; e[j6]=-y[j6]; sum2+=e[j6]*e[j6];
|
||||
j7=i-7; e[j7]=-y[j7]; sum3+=e[j7]*e[j7];
|
||||
}
|
||||
|
||||
/*
|
||||
* There may be some left to do.
|
||||
* This could be done as a simple for() loop,
|
||||
* but a switch is faster (and more interesting)
|
||||
*/
|
||||
|
||||
i=blockn;
|
||||
if(i<n){
|
||||
/* Jump into the case at the place that will allow
|
||||
* us to finish off the appropriate number of items.
|
||||
*/
|
||||
|
||||
switch(n - i){
|
||||
case 7 : e[i]=-y[i]; sum0+=e[i]*e[i]; ++i;
|
||||
case 6 : e[i]=-y[i]; sum1+=e[i]*e[i]; ++i;
|
||||
case 5 : e[i]=-y[i]; sum2+=e[i]*e[i]; ++i;
|
||||
case 4 : e[i]=-y[i]; sum3+=e[i]*e[i]; ++i;
|
||||
case 3 : e[i]=-y[i]; sum0+=e[i]*e[i]; ++i;
|
||||
case 2 : e[i]=-y[i]; sum1+=e[i]*e[i]; ++i;
|
||||
case 1 : e[i]=-y[i]; sum2+=e[i]*e[i]; //++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sum0+sum1+sum2+sum3;
|
||||
}
|
||||
|
||||
/* undefine everything. THIS MUST REMAIN AT THE END OF THE FILE */
|
||||
#undef POTF2
|
||||
#undef GESVD
|
||||
#undef GESDD
|
||||
#undef GEMM
|
||||
#undef LEVMAR_PSEUDOINVERSE
|
||||
#undef LEVMAR_LUINVERSE
|
||||
#undef LEVMAR_BOX_CHECK
|
||||
#undef LEVMAR_CHOLESKY
|
||||
#undef LEVMAR_COVAR
|
||||
#undef LEVMAR_STDDEV
|
||||
#undef LEVMAR_CORCOEF
|
||||
#undef LEVMAR_R2
|
||||
#undef LEVMAR_CHKJAC
|
||||
#undef LEVMAR_FDIF_FORW_JAC_APPROX
|
||||
#undef LEVMAR_FDIF_CENT_JAC_APPROX
|
||||
#undef LEVMAR_TRANS_MAT_MAT_MULT
|
||||
#undef LEVMAR_L2NRMXMY
|
||||
30
contrib/lmfit/COPYING
Normal file
30
contrib/lmfit/COPYING
Normal file
@@ -0,0 +1,30 @@
|
||||
The package lmfit is distributed under the FreeBSD License:
|
||||
|
||||
--
|
||||
Copyright (c) 1980-1999 University of Chicago,
|
||||
as operator of Argonne National Laboratory
|
||||
Copyright (c) 2004-2015 Joachim Wuttke, Forschungszentrum Juelich GmbH
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
This software is provided by the copyright holders and contributors "as is"
|
||||
and any express or implied warranties, including, but not limited to, the
|
||||
implied warranties of merchantability and fitness for a particular purpose
|
||||
are disclaimed. In no event shall the copyright holder or contributors
|
||||
be liable for any direct, indirect, incidental, special, exemplary, or
|
||||
consequential damages (including, but not limited to, procurement of
|
||||
substitute goods or services; loss of use, data, or profits; or business
|
||||
interruption) however caused and on any theory of liability, whether in
|
||||
contract, strict liability, or tort (including negligence or otherwise)
|
||||
arising in any way out of the use of this software, even if advised of the
|
||||
possibility of such damage.
|
||||
--
|
||||
53
contrib/lmfit/lmcurve.c
Normal file
53
contrib/lmfit/lmcurve.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Library: lmfit (Levenberg-Marquardt least squares fitting)
|
||||
*
|
||||
* File: lmcurve.c
|
||||
*
|
||||
* Contents: Implements lmcurve, a simplified API for curve fitting
|
||||
* using the generic Levenberg-Marquardt routine lmmin.
|
||||
*
|
||||
* Copyright: Joachim Wuttke, Forschungszentrum Juelich GmbH (2004-2013)
|
||||
*
|
||||
* License: see ../COPYING (FreeBSD)
|
||||
*
|
||||
* Homepage: apps.jcns.fz-juelich.de/lmfit
|
||||
*
|
||||
* Note to programmers: Don't patch and fork, but copy and modify!
|
||||
* If you need to compute residues differently, then please do not patch
|
||||
* lmcurve.h and lmcurve.c, but copy them, and create differently named
|
||||
* versions of lmcurve_data_struct, lmcurve_evaluate, and lmcurve of your own.
|
||||
*/
|
||||
|
||||
#include "lmmin.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
const double *const t;
|
||||
const double *const y;
|
||||
double (*const g) (const double t, const double *par);
|
||||
} lmcurve_data_struct;
|
||||
|
||||
|
||||
void lmcurve_evaluate(
|
||||
const double *const par, const int m_dat, const void *const data,
|
||||
double *const fvec, int *const info)
|
||||
{
|
||||
(void)(info);
|
||||
for (int i = 0; i < m_dat; i++ )
|
||||
fvec[i] =
|
||||
((lmcurve_data_struct*)data)->y[i] -
|
||||
((lmcurve_data_struct*)data)->g(
|
||||
((lmcurve_data_struct*)data)->t[i], par );
|
||||
}
|
||||
|
||||
|
||||
void lmcurve(
|
||||
const int n_par, double *const par, const int m_dat,
|
||||
const double *const t, const double *const y,
|
||||
double (*const g)(const double t, const double *const par),
|
||||
const lm_control_struct *const control, lm_status_struct *const status)
|
||||
{
|
||||
lmcurve_data_struct data = {t, y, g};
|
||||
lmmin(n_par, par, m_dat, NULL, (const void *const) &data,
|
||||
lmcurve_evaluate, control, status);
|
||||
}
|
||||
45
contrib/lmfit/lmcurve.h
Normal file
45
contrib/lmfit/lmcurve.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Library: lmfit (Levenberg-Marquardt least squares fitting)
|
||||
*
|
||||
* File: lmcurve.h
|
||||
*
|
||||
* Contents: Declares lmcurve, a simplified API for curve fitting
|
||||
* using the generic Levenberg-Marquardt routine lmmin.
|
||||
*
|
||||
* Copyright: Joachim Wuttke, Forschungszentrum Juelich GmbH (2004-2013)
|
||||
*
|
||||
* License: see ../COPYING (FreeBSD)
|
||||
*
|
||||
* Homepage: apps.jcns.fz-juelich.de/lmfit
|
||||
*
|
||||
* Note to programmers: Don't patch and fork, but copy and variate!
|
||||
* If you need to compute residues differently, then please do not patch
|
||||
* lmcurve.h, but copy it to a differently named file, and change lmcurve()
|
||||
* into a differently named function declaration, like we have done in
|
||||
* lmcurve_tyd.h.
|
||||
*/
|
||||
|
||||
#ifndef LMCURVE_H
|
||||
#define LMCURVE_H
|
||||
#undef __BEGIN_DECLS
|
||||
#undef __END_DECLS
|
||||
#ifdef __cplusplus
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
#else
|
||||
#define __BEGIN_DECLS /* empty */
|
||||
#define __END_DECLS /* empty */
|
||||
#endif
|
||||
|
||||
#include<lmstruct.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
void lmcurve(
|
||||
const int n_par, double* par, const int m_dat,
|
||||
const double* t, const double* y,
|
||||
double (*g)(const double t, const double* par),
|
||||
const lm_control_struct* control, lm_status_struct* status);
|
||||
|
||||
__END_DECLS
|
||||
#endif /* LMCURVE_H */
|
||||
39
contrib/lmfit/lmcurve_tyd.h
Normal file
39
contrib/lmfit/lmcurve_tyd.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Library: lmfit (Levenberg-Marquardt least squares fitting)
|
||||
*
|
||||
* File: lmcurve_tyd.h
|
||||
*
|
||||
* Contents: Declares lmcurve_tyd(), a variant of lmcurve() that weighs
|
||||
* data points y(t) with the inverse of the standard deviations dy.
|
||||
*
|
||||
* Copyright: Joachim Wuttke, Forschungszentrum Juelich GmbH (2004-2013)
|
||||
*
|
||||
* License: see ../COPYING (FreeBSD)
|
||||
*
|
||||
* Homepage: apps.jcns.fz-juelich.de/lmfit
|
||||
*/
|
||||
|
||||
#ifndef LMCURVETYD_H
|
||||
#define LMCURVETYD_H
|
||||
#undef __BEGIN_DECLS
|
||||
#undef __END_DECLS
|
||||
#ifdef __cplusplus
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
#else
|
||||
#define __BEGIN_DECLS /* empty */
|
||||
#define __END_DECLS /* empty */
|
||||
#endif
|
||||
|
||||
#include <lmstruct.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
void lmcurve_tyd(
|
||||
const int n_par, double* par, const int m_dat,
|
||||
const double* t, const double* y, const double* dy,
|
||||
double (*f)(double t, const double* par),
|
||||
const lm_control_struct* control, lm_status_struct* status);
|
||||
|
||||
__END_DECLS
|
||||
#endif /* LMCURVETYD_H */
|
||||
1283
contrib/lmfit/lmmin.c
Normal file
1283
contrib/lmfit/lmmin.c
Normal file
File diff suppressed because it is too large
Load Diff
84
contrib/lmfit/lmmin.h
Normal file
84
contrib/lmfit/lmmin.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Library: lmfit (Levenberg-Marquardt least squares fitting)
|
||||
*
|
||||
* File: lmmin.h
|
||||
*
|
||||
* Contents: Declarations for Levenberg-Marquardt minimization.
|
||||
*
|
||||
* Copyright: Joachim Wuttke, Forschungszentrum Juelich GmbH (2004-2013)
|
||||
*
|
||||
* License: see ../COPYING (FreeBSD)
|
||||
*
|
||||
* Homepage: apps.jcns.fz-juelich.de/lmfit
|
||||
*/
|
||||
|
||||
#ifndef LMMIN_H
|
||||
#define LMMIN_H
|
||||
#undef __BEGIN_DECLS
|
||||
#undef __END_DECLS
|
||||
#ifdef __cplusplus
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
#else
|
||||
#define __BEGIN_DECLS /* empty */
|
||||
#define __END_DECLS /* empty */
|
||||
#endif
|
||||
|
||||
#include "lmstruct.h"
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Levenberg-Marquardt minimization. */
|
||||
void lmmin(
|
||||
const int n_par, double* par, const int m_dat, const double* y,
|
||||
const void* data,
|
||||
void (*evaluate)(
|
||||
const double* par, const int m_dat, const void* data,
|
||||
double* fvec, int* userbreak),
|
||||
const lm_control_struct* control, lm_status_struct* status);
|
||||
/*
|
||||
* This routine contains the core algorithm of our library.
|
||||
*
|
||||
* It minimizes the sum of the squares of m nonlinear functions
|
||||
* in n variables by a modified Levenberg-Marquardt algorithm.
|
||||
* The function evaluation is done by the user-provided routine 'evaluate'.
|
||||
* The Jacobian is then calculated by a forward-difference approximation.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* n_par is the number of variables (INPUT, positive integer).
|
||||
*
|
||||
* par is the solution vector (INPUT/OUTPUT, array of length n).
|
||||
* On input it must be set to an estimated solution.
|
||||
* On output it yields the final estimate of the solution.
|
||||
*
|
||||
* m_dat is the number of functions to be minimized (INPUT, positive integer).
|
||||
* It must fulfill m>=n.
|
||||
*
|
||||
* y contains data to be fitted. Use a null pointer if there are no data.
|
||||
*
|
||||
* data is a pointer that is ignored by lmmin; it is however forwarded
|
||||
* to the user-supplied functions evaluate and printout.
|
||||
* In a typical application, it contains experimental data to be fitted.
|
||||
*
|
||||
* evaluate is a user-supplied function that calculates the m functions.
|
||||
* Parameters:
|
||||
* n, x, m, data as above.
|
||||
* fvec is an array of length m; on OUTPUT, it must contain the
|
||||
* m function values for the parameter vector x.
|
||||
* userbreak is an integer pointer. When *userbreak is set to a
|
||||
* nonzero value, lmmin will terminate.
|
||||
*
|
||||
* control contains INPUT variables that control the fit algorithm,
|
||||
* as declared and explained in lmstruct.h
|
||||
*
|
||||
* status contains OUTPUT variables that inform about the fit result,
|
||||
* as declared and explained in lmstruct.h
|
||||
*/
|
||||
|
||||
/* Refined calculation of Eucledian norm. */
|
||||
double lm_enorm(const int, const double*);
|
||||
double lm_fnorm(const int, const double*, const double*);
|
||||
|
||||
__END_DECLS
|
||||
#endif /* LMMIN_H */
|
||||
81
contrib/lmfit/lmstruct.h
Normal file
81
contrib/lmfit/lmstruct.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Library: lmfit (Levenberg-Marquardt least squares fitting)
|
||||
*
|
||||
* File: lmstruct.h
|
||||
*
|
||||
* Contents: Declarations of parameter records, used in lmmin.h and lmcurve.h
|
||||
*
|
||||
* Copyright: Joachim Wuttke, Forschungszentrum Juelich GmbH (2004-2013)
|
||||
*
|
||||
* License: see ../COPYING (FreeBSD)
|
||||
*
|
||||
* Homepage: apps.jcns.fz-juelich.de/lmfit
|
||||
*/
|
||||
|
||||
#ifndef LMSTRUCT_H
|
||||
#define LMSTRUCT_H
|
||||
#undef __BEGIN_DECLS
|
||||
#undef __END_DECLS
|
||||
#ifdef __cplusplus
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
#else
|
||||
#define __BEGIN_DECLS /* empty */
|
||||
#define __END_DECLS /* empty */
|
||||
#endif
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Collection of input parameters for fit control. */
|
||||
typedef struct {
|
||||
double ftol; /* Relative error desired in the sum of squares.
|
||||
Termination occurs when both the actual and
|
||||
predicted relative reductions in the sum of squares
|
||||
are at most ftol. */
|
||||
double xtol; /* Relative error between last two approximations.
|
||||
Termination occurs when the relative error between
|
||||
two consecutive iterates is at most xtol. */
|
||||
double gtol; /* Orthogonality desired between fvec and its derivs.
|
||||
Termination occurs when the cosine of the angle
|
||||
between fvec and any column of the Jacobian is at
|
||||
most gtol in absolute value. */
|
||||
double epsilon; /* Step used to calculate the Jacobian, should be
|
||||
slightly larger than the relative error in the
|
||||
user-supplied functions. */
|
||||
double stepbound; /* Used in determining the initial step bound. This
|
||||
bound is set to the product of stepbound and the
|
||||
Euclidean norm of diag*x if nonzero, or else to
|
||||
stepbound itself. In most cases stepbound should lie
|
||||
in the interval (0.1,100.0). Generally, the value
|
||||
100.0 is recommended. */
|
||||
int patience; /* Used to set the maximum number of function evaluations
|
||||
to patience*(number_of_parameters+1). */
|
||||
int scale_diag; /* If 1, the variables will be rescaled internally.
|
||||
Recommended value is 1. */
|
||||
FILE* msgfile; /* Progress messages will be written to this file. */
|
||||
int verbosity; /* OR'ed: 1: print some messages; 2: print Jacobian. */
|
||||
int n_maxpri; /* -1, or max number of parameters to print. */
|
||||
int m_maxpri; /* -1, or max number of residuals to print. */
|
||||
} lm_control_struct;
|
||||
|
||||
/* Collection of output parameters for status info. */
|
||||
typedef struct {
|
||||
double fnorm; /* norm of the residue vector fvec. */
|
||||
int nfev; /* actual number of iterations. */
|
||||
int outcome; /* Status indicator. Nonnegative values are used as index
|
||||
for the message text lm_infmsg, set in lmmin.c. */
|
||||
int userbreak; /* Set when function evaluation requests termination. */
|
||||
} lm_status_struct;
|
||||
|
||||
/* Preset (and recommended) control parameter settings. */
|
||||
extern const lm_control_struct lm_control_double;
|
||||
extern const lm_control_struct lm_control_float;
|
||||
|
||||
/* Preset message texts. */
|
||||
|
||||
extern const char* lm_infmsg[];
|
||||
extern const char* lm_shortmsg[];
|
||||
|
||||
__END_DECLS
|
||||
#endif /* LMSTRUCT_H */
|
||||
@@ -29,7 +29,7 @@ void QwtPlotGappedCurve::drawSeries(QPainter *painter, const QwtScaleMap &xMap,
|
||||
return;
|
||||
|
||||
if (to < 0)
|
||||
to = dataSize() - 1;
|
||||
to = dataSize();
|
||||
|
||||
int i = from;
|
||||
double last = 0;
|
||||
@@ -38,7 +38,11 @@ void QwtPlotGappedCurve::drawSeries(QPainter *painter, const QwtScaleMap &xMap,
|
||||
// First non-missed point will be the start of curve section.
|
||||
double x = sample(i).x();
|
||||
double y = sample(i).y();
|
||||
if ((y < (naValue_ + -0.001) || y > (naValue_ + 0.001)) && x - last <= gapValue_) {
|
||||
double yprev = 0;
|
||||
if (i>0) yprev = sample(i-1).y();
|
||||
|
||||
if ((y < (naValue_ + -0.001) || y > (naValue_ + 0.001)) && (x - last <= gapValue_) &&
|
||||
(yprev < (naValue_ + -0.001) || yprev > (naValue_ + 0.001))) {
|
||||
|
||||
int start = i-1;
|
||||
int end = i;
|
||||
@@ -200,6 +200,8 @@ void QxtSpanSliderPrivate::triggerAction(QAbstractSlider::SliderAction action, b
|
||||
case QAbstractSlider::SliderMove:
|
||||
if ((main && mainControl == QxtSpanSlider::UpperHandle) || (!main && altControl == QxtSpanSlider::UpperHandle))
|
||||
up = true;
|
||||
no = true;
|
||||
break;
|
||||
case QAbstractSlider::SliderNoAction:
|
||||
no = true;
|
||||
break;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user