Files
dragonpilot/selfdrive/locationd/models/generated/live.cpp
dragonpilot 1abc7d7daa dragonpilot beta3
date: 2023-07-26T22:20:36
commit: c6d842c412052be1985b63d683c63be9dcb2b0eb
2023-07-26 22:20:51 +08:00

1988 lines
90 KiB
C++

#include "live.h"
namespace {
#define DIM 22
#define EDIM 21
#define MEDIM 21
typedef void (*Hfun)(double *, double *, double *);
const static double MAHA_THRESH_4 = 7.814727903251177;
const static double MAHA_THRESH_9 = 7.814727903251177;
const static double MAHA_THRESH_10 = 7.814727903251177;
const static double MAHA_THRESH_12 = 7.814727903251177;
const static double MAHA_THRESH_35 = 7.814727903251177;
const static double MAHA_THRESH_32 = 9.487729036781154;
const static double MAHA_THRESH_13 = 7.814727903251177;
const static double MAHA_THRESH_14 = 7.814727903251177;
const static double MAHA_THRESH_33 = 7.814727903251177;
/******************************************************************************
* Code generated with SymPy 1.12 *
* *
* See http://www.sympy.org/ for more information. *
* *
* This file is part of 'ekf' *
******************************************************************************/
void H(double *in_vec, double *out_409344677196790516) {
out_409344677196790516[0] = 0;
out_409344677196790516[1] = -sin(in_vec[1])*sin(in_vec[2])*in_vec[4] - sin(in_vec[1])*cos(in_vec[2])*in_vec[3] - cos(in_vec[1])*in_vec[5];
out_409344677196790516[2] = -sin(in_vec[2])*cos(in_vec[1])*in_vec[3] + cos(in_vec[1])*cos(in_vec[2])*in_vec[4];
out_409344677196790516[3] = cos(in_vec[1])*cos(in_vec[2]);
out_409344677196790516[4] = sin(in_vec[2])*cos(in_vec[1]);
out_409344677196790516[5] = -sin(in_vec[1]);
out_409344677196790516[6] = (sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]))*in_vec[3] + (-sin(in_vec[0])*cos(in_vec[2]) + sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]))*in_vec[4] + cos(in_vec[0])*cos(in_vec[1])*in_vec[5];
out_409344677196790516[7] = -sin(in_vec[0])*sin(in_vec[1])*in_vec[5] + sin(in_vec[0])*sin(in_vec[2])*cos(in_vec[1])*in_vec[4] + sin(in_vec[0])*cos(in_vec[1])*cos(in_vec[2])*in_vec[3];
out_409344677196790516[8] = (-sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) - cos(in_vec[0])*cos(in_vec[2]))*in_vec[3] + (sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) - sin(in_vec[2])*cos(in_vec[0]))*in_vec[4];
out_409344677196790516[9] = sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) - sin(in_vec[2])*cos(in_vec[0]);
out_409344677196790516[10] = sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) + cos(in_vec[0])*cos(in_vec[2]);
out_409344677196790516[11] = sin(in_vec[0])*cos(in_vec[1]);
out_409344677196790516[12] = (-sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) - cos(in_vec[0])*cos(in_vec[2]))*in_vec[4] + (-sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) + sin(in_vec[2])*cos(in_vec[0]))*in_vec[3] - sin(in_vec[0])*cos(in_vec[1])*in_vec[5];
out_409344677196790516[13] = -sin(in_vec[1])*cos(in_vec[0])*in_vec[5] + sin(in_vec[2])*cos(in_vec[0])*cos(in_vec[1])*in_vec[4] + cos(in_vec[0])*cos(in_vec[1])*cos(in_vec[2])*in_vec[3];
out_409344677196790516[14] = (sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]))*in_vec[4] + (sin(in_vec[0])*cos(in_vec[2]) - sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]))*in_vec[3];
out_409344677196790516[15] = sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]);
out_409344677196790516[16] = -sin(in_vec[0])*cos(in_vec[2]) + sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]);
out_409344677196790516[17] = cos(in_vec[0])*cos(in_vec[1]);
}
void err_fun(double *nom_x, double *delta_x, double *out_5410019838797489797) {
out_5410019838797489797[0] = delta_x[0] + nom_x[0];
out_5410019838797489797[1] = delta_x[1] + nom_x[1];
out_5410019838797489797[2] = delta_x[2] + nom_x[2];
out_5410019838797489797[3] = -0.5*delta_x[3]*nom_x[4] - 0.5*delta_x[4]*nom_x[5] - 0.5*delta_x[5]*nom_x[6] + 1.0*nom_x[3];
out_5410019838797489797[4] = 0.5*delta_x[3]*nom_x[3] + 0.5*delta_x[4]*nom_x[6] - 0.5*delta_x[5]*nom_x[5] + 1.0*nom_x[4];
out_5410019838797489797[5] = -0.5*delta_x[3]*nom_x[6] + 0.5*delta_x[4]*nom_x[3] + 0.5*delta_x[5]*nom_x[4] + 1.0*nom_x[5];
out_5410019838797489797[6] = 0.5*delta_x[3]*nom_x[5] - 0.5*delta_x[4]*nom_x[4] + 0.5*delta_x[5]*nom_x[3] + 1.0*nom_x[6];
out_5410019838797489797[7] = delta_x[6] + nom_x[7];
out_5410019838797489797[8] = delta_x[7] + nom_x[8];
out_5410019838797489797[9] = delta_x[8] + nom_x[9];
out_5410019838797489797[10] = delta_x[9] + nom_x[10];
out_5410019838797489797[11] = delta_x[10] + nom_x[11];
out_5410019838797489797[12] = delta_x[11] + nom_x[12];
out_5410019838797489797[13] = delta_x[12] + nom_x[13];
out_5410019838797489797[14] = delta_x[13] + nom_x[14];
out_5410019838797489797[15] = delta_x[14] + nom_x[15];
out_5410019838797489797[16] = delta_x[15] + nom_x[16];
out_5410019838797489797[17] = delta_x[16] + nom_x[17];
out_5410019838797489797[18] = delta_x[17] + nom_x[18];
out_5410019838797489797[19] = delta_x[18] + nom_x[19];
out_5410019838797489797[20] = delta_x[19] + nom_x[20];
out_5410019838797489797[21] = delta_x[20] + nom_x[21];
}
void inv_err_fun(double *nom_x, double *true_x, double *out_5107495764560298202) {
out_5107495764560298202[0] = -nom_x[0] + true_x[0];
out_5107495764560298202[1] = -nom_x[1] + true_x[1];
out_5107495764560298202[2] = -nom_x[2] + true_x[2];
out_5107495764560298202[3] = 2*nom_x[3]*true_x[4] - 2*nom_x[4]*true_x[3] + 2*nom_x[5]*true_x[6] - 2*nom_x[6]*true_x[5];
out_5107495764560298202[4] = 2*nom_x[3]*true_x[5] - 2*nom_x[4]*true_x[6] - 2*nom_x[5]*true_x[3] + 2*nom_x[6]*true_x[4];
out_5107495764560298202[5] = 2*nom_x[3]*true_x[6] + 2*nom_x[4]*true_x[5] - 2*nom_x[5]*true_x[4] - 2*nom_x[6]*true_x[3];
out_5107495764560298202[6] = -nom_x[7] + true_x[7];
out_5107495764560298202[7] = -nom_x[8] + true_x[8];
out_5107495764560298202[8] = -nom_x[9] + true_x[9];
out_5107495764560298202[9] = -nom_x[10] + true_x[10];
out_5107495764560298202[10] = -nom_x[11] + true_x[11];
out_5107495764560298202[11] = -nom_x[12] + true_x[12];
out_5107495764560298202[12] = -nom_x[13] + true_x[13];
out_5107495764560298202[13] = -nom_x[14] + true_x[14];
out_5107495764560298202[14] = -nom_x[15] + true_x[15];
out_5107495764560298202[15] = -nom_x[16] + true_x[16];
out_5107495764560298202[16] = -nom_x[17] + true_x[17];
out_5107495764560298202[17] = -nom_x[18] + true_x[18];
out_5107495764560298202[18] = -nom_x[19] + true_x[19];
out_5107495764560298202[19] = -nom_x[20] + true_x[20];
out_5107495764560298202[20] = -nom_x[21] + true_x[21];
}
void H_mod_fun(double *state, double *out_4893943347815461903) {
out_4893943347815461903[0] = 1.0;
out_4893943347815461903[1] = 0;
out_4893943347815461903[2] = 0;
out_4893943347815461903[3] = 0;
out_4893943347815461903[4] = 0;
out_4893943347815461903[5] = 0;
out_4893943347815461903[6] = 0;
out_4893943347815461903[7] = 0;
out_4893943347815461903[8] = 0;
out_4893943347815461903[9] = 0;
out_4893943347815461903[10] = 0;
out_4893943347815461903[11] = 0;
out_4893943347815461903[12] = 0;
out_4893943347815461903[13] = 0;
out_4893943347815461903[14] = 0;
out_4893943347815461903[15] = 0;
out_4893943347815461903[16] = 0;
out_4893943347815461903[17] = 0;
out_4893943347815461903[18] = 0;
out_4893943347815461903[19] = 0;
out_4893943347815461903[20] = 0;
out_4893943347815461903[21] = 0;
out_4893943347815461903[22] = 1.0;
out_4893943347815461903[23] = 0;
out_4893943347815461903[24] = 0;
out_4893943347815461903[25] = 0;
out_4893943347815461903[26] = 0;
out_4893943347815461903[27] = 0;
out_4893943347815461903[28] = 0;
out_4893943347815461903[29] = 0;
out_4893943347815461903[30] = 0;
out_4893943347815461903[31] = 0;
out_4893943347815461903[32] = 0;
out_4893943347815461903[33] = 0;
out_4893943347815461903[34] = 0;
out_4893943347815461903[35] = 0;
out_4893943347815461903[36] = 0;
out_4893943347815461903[37] = 0;
out_4893943347815461903[38] = 0;
out_4893943347815461903[39] = 0;
out_4893943347815461903[40] = 0;
out_4893943347815461903[41] = 0;
out_4893943347815461903[42] = 0;
out_4893943347815461903[43] = 0;
out_4893943347815461903[44] = 1.0;
out_4893943347815461903[45] = 0;
out_4893943347815461903[46] = 0;
out_4893943347815461903[47] = 0;
out_4893943347815461903[48] = 0;
out_4893943347815461903[49] = 0;
out_4893943347815461903[50] = 0;
out_4893943347815461903[51] = 0;
out_4893943347815461903[52] = 0;
out_4893943347815461903[53] = 0;
out_4893943347815461903[54] = 0;
out_4893943347815461903[55] = 0;
out_4893943347815461903[56] = 0;
out_4893943347815461903[57] = 0;
out_4893943347815461903[58] = 0;
out_4893943347815461903[59] = 0;
out_4893943347815461903[60] = 0;
out_4893943347815461903[61] = 0;
out_4893943347815461903[62] = 0;
out_4893943347815461903[63] = 0;
out_4893943347815461903[64] = 0;
out_4893943347815461903[65] = 0;
out_4893943347815461903[66] = -0.5*state[4];
out_4893943347815461903[67] = -0.5*state[5];
out_4893943347815461903[68] = -0.5*state[6];
out_4893943347815461903[69] = 0;
out_4893943347815461903[70] = 0;
out_4893943347815461903[71] = 0;
out_4893943347815461903[72] = 0;
out_4893943347815461903[73] = 0;
out_4893943347815461903[74] = 0;
out_4893943347815461903[75] = 0;
out_4893943347815461903[76] = 0;
out_4893943347815461903[77] = 0;
out_4893943347815461903[78] = 0;
out_4893943347815461903[79] = 0;
out_4893943347815461903[80] = 0;
out_4893943347815461903[81] = 0;
out_4893943347815461903[82] = 0;
out_4893943347815461903[83] = 0;
out_4893943347815461903[84] = 0;
out_4893943347815461903[85] = 0;
out_4893943347815461903[86] = 0;
out_4893943347815461903[87] = 0.5*state[3];
out_4893943347815461903[88] = 0.5*state[6];
out_4893943347815461903[89] = -0.5*state[5];
out_4893943347815461903[90] = 0;
out_4893943347815461903[91] = 0;
out_4893943347815461903[92] = 0;
out_4893943347815461903[93] = 0;
out_4893943347815461903[94] = 0;
out_4893943347815461903[95] = 0;
out_4893943347815461903[96] = 0;
out_4893943347815461903[97] = 0;
out_4893943347815461903[98] = 0;
out_4893943347815461903[99] = 0;
out_4893943347815461903[100] = 0;
out_4893943347815461903[101] = 0;
out_4893943347815461903[102] = 0;
out_4893943347815461903[103] = 0;
out_4893943347815461903[104] = 0;
out_4893943347815461903[105] = 0;
out_4893943347815461903[106] = 0;
out_4893943347815461903[107] = 0;
out_4893943347815461903[108] = -0.5*state[6];
out_4893943347815461903[109] = 0.5*state[3];
out_4893943347815461903[110] = 0.5*state[4];
out_4893943347815461903[111] = 0;
out_4893943347815461903[112] = 0;
out_4893943347815461903[113] = 0;
out_4893943347815461903[114] = 0;
out_4893943347815461903[115] = 0;
out_4893943347815461903[116] = 0;
out_4893943347815461903[117] = 0;
out_4893943347815461903[118] = 0;
out_4893943347815461903[119] = 0;
out_4893943347815461903[120] = 0;
out_4893943347815461903[121] = 0;
out_4893943347815461903[122] = 0;
out_4893943347815461903[123] = 0;
out_4893943347815461903[124] = 0;
out_4893943347815461903[125] = 0;
out_4893943347815461903[126] = 0;
out_4893943347815461903[127] = 0;
out_4893943347815461903[128] = 0;
out_4893943347815461903[129] = 0.5*state[5];
out_4893943347815461903[130] = -0.5*state[4];
out_4893943347815461903[131] = 0.5*state[3];
out_4893943347815461903[132] = 0;
out_4893943347815461903[133] = 0;
out_4893943347815461903[134] = 0;
out_4893943347815461903[135] = 0;
out_4893943347815461903[136] = 0;
out_4893943347815461903[137] = 0;
out_4893943347815461903[138] = 0;
out_4893943347815461903[139] = 0;
out_4893943347815461903[140] = 0;
out_4893943347815461903[141] = 0;
out_4893943347815461903[142] = 0;
out_4893943347815461903[143] = 0;
out_4893943347815461903[144] = 0;
out_4893943347815461903[145] = 0;
out_4893943347815461903[146] = 0;
out_4893943347815461903[147] = 0;
out_4893943347815461903[148] = 0;
out_4893943347815461903[149] = 0;
out_4893943347815461903[150] = 0;
out_4893943347815461903[151] = 0;
out_4893943347815461903[152] = 0;
out_4893943347815461903[153] = 1.0;
out_4893943347815461903[154] = 0;
out_4893943347815461903[155] = 0;
out_4893943347815461903[156] = 0;
out_4893943347815461903[157] = 0;
out_4893943347815461903[158] = 0;
out_4893943347815461903[159] = 0;
out_4893943347815461903[160] = 0;
out_4893943347815461903[161] = 0;
out_4893943347815461903[162] = 0;
out_4893943347815461903[163] = 0;
out_4893943347815461903[164] = 0;
out_4893943347815461903[165] = 0;
out_4893943347815461903[166] = 0;
out_4893943347815461903[167] = 0;
out_4893943347815461903[168] = 0;
out_4893943347815461903[169] = 0;
out_4893943347815461903[170] = 0;
out_4893943347815461903[171] = 0;
out_4893943347815461903[172] = 0;
out_4893943347815461903[173] = 0;
out_4893943347815461903[174] = 0;
out_4893943347815461903[175] = 1.0;
out_4893943347815461903[176] = 0;
out_4893943347815461903[177] = 0;
out_4893943347815461903[178] = 0;
out_4893943347815461903[179] = 0;
out_4893943347815461903[180] = 0;
out_4893943347815461903[181] = 0;
out_4893943347815461903[182] = 0;
out_4893943347815461903[183] = 0;
out_4893943347815461903[184] = 0;
out_4893943347815461903[185] = 0;
out_4893943347815461903[186] = 0;
out_4893943347815461903[187] = 0;
out_4893943347815461903[188] = 0;
out_4893943347815461903[189] = 0;
out_4893943347815461903[190] = 0;
out_4893943347815461903[191] = 0;
out_4893943347815461903[192] = 0;
out_4893943347815461903[193] = 0;
out_4893943347815461903[194] = 0;
out_4893943347815461903[195] = 0;
out_4893943347815461903[196] = 0;
out_4893943347815461903[197] = 1.0;
out_4893943347815461903[198] = 0;
out_4893943347815461903[199] = 0;
out_4893943347815461903[200] = 0;
out_4893943347815461903[201] = 0;
out_4893943347815461903[202] = 0;
out_4893943347815461903[203] = 0;
out_4893943347815461903[204] = 0;
out_4893943347815461903[205] = 0;
out_4893943347815461903[206] = 0;
out_4893943347815461903[207] = 0;
out_4893943347815461903[208] = 0;
out_4893943347815461903[209] = 0;
out_4893943347815461903[210] = 0;
out_4893943347815461903[211] = 0;
out_4893943347815461903[212] = 0;
out_4893943347815461903[213] = 0;
out_4893943347815461903[214] = 0;
out_4893943347815461903[215] = 0;
out_4893943347815461903[216] = 0;
out_4893943347815461903[217] = 0;
out_4893943347815461903[218] = 0;
out_4893943347815461903[219] = 1.0;
out_4893943347815461903[220] = 0;
out_4893943347815461903[221] = 0;
out_4893943347815461903[222] = 0;
out_4893943347815461903[223] = 0;
out_4893943347815461903[224] = 0;
out_4893943347815461903[225] = 0;
out_4893943347815461903[226] = 0;
out_4893943347815461903[227] = 0;
out_4893943347815461903[228] = 0;
out_4893943347815461903[229] = 0;
out_4893943347815461903[230] = 0;
out_4893943347815461903[231] = 0;
out_4893943347815461903[232] = 0;
out_4893943347815461903[233] = 0;
out_4893943347815461903[234] = 0;
out_4893943347815461903[235] = 0;
out_4893943347815461903[236] = 0;
out_4893943347815461903[237] = 0;
out_4893943347815461903[238] = 0;
out_4893943347815461903[239] = 0;
out_4893943347815461903[240] = 0;
out_4893943347815461903[241] = 1.0;
out_4893943347815461903[242] = 0;
out_4893943347815461903[243] = 0;
out_4893943347815461903[244] = 0;
out_4893943347815461903[245] = 0;
out_4893943347815461903[246] = 0;
out_4893943347815461903[247] = 0;
out_4893943347815461903[248] = 0;
out_4893943347815461903[249] = 0;
out_4893943347815461903[250] = 0;
out_4893943347815461903[251] = 0;
out_4893943347815461903[252] = 0;
out_4893943347815461903[253] = 0;
out_4893943347815461903[254] = 0;
out_4893943347815461903[255] = 0;
out_4893943347815461903[256] = 0;
out_4893943347815461903[257] = 0;
out_4893943347815461903[258] = 0;
out_4893943347815461903[259] = 0;
out_4893943347815461903[260] = 0;
out_4893943347815461903[261] = 0;
out_4893943347815461903[262] = 0;
out_4893943347815461903[263] = 1.0;
out_4893943347815461903[264] = 0;
out_4893943347815461903[265] = 0;
out_4893943347815461903[266] = 0;
out_4893943347815461903[267] = 0;
out_4893943347815461903[268] = 0;
out_4893943347815461903[269] = 0;
out_4893943347815461903[270] = 0;
out_4893943347815461903[271] = 0;
out_4893943347815461903[272] = 0;
out_4893943347815461903[273] = 0;
out_4893943347815461903[274] = 0;
out_4893943347815461903[275] = 0;
out_4893943347815461903[276] = 0;
out_4893943347815461903[277] = 0;
out_4893943347815461903[278] = 0;
out_4893943347815461903[279] = 0;
out_4893943347815461903[280] = 0;
out_4893943347815461903[281] = 0;
out_4893943347815461903[282] = 0;
out_4893943347815461903[283] = 0;
out_4893943347815461903[284] = 0;
out_4893943347815461903[285] = 1.0;
out_4893943347815461903[286] = 0;
out_4893943347815461903[287] = 0;
out_4893943347815461903[288] = 0;
out_4893943347815461903[289] = 0;
out_4893943347815461903[290] = 0;
out_4893943347815461903[291] = 0;
out_4893943347815461903[292] = 0;
out_4893943347815461903[293] = 0;
out_4893943347815461903[294] = 0;
out_4893943347815461903[295] = 0;
out_4893943347815461903[296] = 0;
out_4893943347815461903[297] = 0;
out_4893943347815461903[298] = 0;
out_4893943347815461903[299] = 0;
out_4893943347815461903[300] = 0;
out_4893943347815461903[301] = 0;
out_4893943347815461903[302] = 0;
out_4893943347815461903[303] = 0;
out_4893943347815461903[304] = 0;
out_4893943347815461903[305] = 0;
out_4893943347815461903[306] = 0;
out_4893943347815461903[307] = 1.0;
out_4893943347815461903[308] = 0;
out_4893943347815461903[309] = 0;
out_4893943347815461903[310] = 0;
out_4893943347815461903[311] = 0;
out_4893943347815461903[312] = 0;
out_4893943347815461903[313] = 0;
out_4893943347815461903[314] = 0;
out_4893943347815461903[315] = 0;
out_4893943347815461903[316] = 0;
out_4893943347815461903[317] = 0;
out_4893943347815461903[318] = 0;
out_4893943347815461903[319] = 0;
out_4893943347815461903[320] = 0;
out_4893943347815461903[321] = 0;
out_4893943347815461903[322] = 0;
out_4893943347815461903[323] = 0;
out_4893943347815461903[324] = 0;
out_4893943347815461903[325] = 0;
out_4893943347815461903[326] = 0;
out_4893943347815461903[327] = 0;
out_4893943347815461903[328] = 0;
out_4893943347815461903[329] = 1.0;
out_4893943347815461903[330] = 0;
out_4893943347815461903[331] = 0;
out_4893943347815461903[332] = 0;
out_4893943347815461903[333] = 0;
out_4893943347815461903[334] = 0;
out_4893943347815461903[335] = 0;
out_4893943347815461903[336] = 0;
out_4893943347815461903[337] = 0;
out_4893943347815461903[338] = 0;
out_4893943347815461903[339] = 0;
out_4893943347815461903[340] = 0;
out_4893943347815461903[341] = 0;
out_4893943347815461903[342] = 0;
out_4893943347815461903[343] = 0;
out_4893943347815461903[344] = 0;
out_4893943347815461903[345] = 0;
out_4893943347815461903[346] = 0;
out_4893943347815461903[347] = 0;
out_4893943347815461903[348] = 0;
out_4893943347815461903[349] = 0;
out_4893943347815461903[350] = 0;
out_4893943347815461903[351] = 1.0;
out_4893943347815461903[352] = 0;
out_4893943347815461903[353] = 0;
out_4893943347815461903[354] = 0;
out_4893943347815461903[355] = 0;
out_4893943347815461903[356] = 0;
out_4893943347815461903[357] = 0;
out_4893943347815461903[358] = 0;
out_4893943347815461903[359] = 0;
out_4893943347815461903[360] = 0;
out_4893943347815461903[361] = 0;
out_4893943347815461903[362] = 0;
out_4893943347815461903[363] = 0;
out_4893943347815461903[364] = 0;
out_4893943347815461903[365] = 0;
out_4893943347815461903[366] = 0;
out_4893943347815461903[367] = 0;
out_4893943347815461903[368] = 0;
out_4893943347815461903[369] = 0;
out_4893943347815461903[370] = 0;
out_4893943347815461903[371] = 0;
out_4893943347815461903[372] = 0;
out_4893943347815461903[373] = 1.0;
out_4893943347815461903[374] = 0;
out_4893943347815461903[375] = 0;
out_4893943347815461903[376] = 0;
out_4893943347815461903[377] = 0;
out_4893943347815461903[378] = 0;
out_4893943347815461903[379] = 0;
out_4893943347815461903[380] = 0;
out_4893943347815461903[381] = 0;
out_4893943347815461903[382] = 0;
out_4893943347815461903[383] = 0;
out_4893943347815461903[384] = 0;
out_4893943347815461903[385] = 0;
out_4893943347815461903[386] = 0;
out_4893943347815461903[387] = 0;
out_4893943347815461903[388] = 0;
out_4893943347815461903[389] = 0;
out_4893943347815461903[390] = 0;
out_4893943347815461903[391] = 0;
out_4893943347815461903[392] = 0;
out_4893943347815461903[393] = 0;
out_4893943347815461903[394] = 0;
out_4893943347815461903[395] = 1.0;
out_4893943347815461903[396] = 0;
out_4893943347815461903[397] = 0;
out_4893943347815461903[398] = 0;
out_4893943347815461903[399] = 0;
out_4893943347815461903[400] = 0;
out_4893943347815461903[401] = 0;
out_4893943347815461903[402] = 0;
out_4893943347815461903[403] = 0;
out_4893943347815461903[404] = 0;
out_4893943347815461903[405] = 0;
out_4893943347815461903[406] = 0;
out_4893943347815461903[407] = 0;
out_4893943347815461903[408] = 0;
out_4893943347815461903[409] = 0;
out_4893943347815461903[410] = 0;
out_4893943347815461903[411] = 0;
out_4893943347815461903[412] = 0;
out_4893943347815461903[413] = 0;
out_4893943347815461903[414] = 0;
out_4893943347815461903[415] = 0;
out_4893943347815461903[416] = 0;
out_4893943347815461903[417] = 1.0;
out_4893943347815461903[418] = 0;
out_4893943347815461903[419] = 0;
out_4893943347815461903[420] = 0;
out_4893943347815461903[421] = 0;
out_4893943347815461903[422] = 0;
out_4893943347815461903[423] = 0;
out_4893943347815461903[424] = 0;
out_4893943347815461903[425] = 0;
out_4893943347815461903[426] = 0;
out_4893943347815461903[427] = 0;
out_4893943347815461903[428] = 0;
out_4893943347815461903[429] = 0;
out_4893943347815461903[430] = 0;
out_4893943347815461903[431] = 0;
out_4893943347815461903[432] = 0;
out_4893943347815461903[433] = 0;
out_4893943347815461903[434] = 0;
out_4893943347815461903[435] = 0;
out_4893943347815461903[436] = 0;
out_4893943347815461903[437] = 0;
out_4893943347815461903[438] = 0;
out_4893943347815461903[439] = 1.0;
out_4893943347815461903[440] = 0;
out_4893943347815461903[441] = 0;
out_4893943347815461903[442] = 0;
out_4893943347815461903[443] = 0;
out_4893943347815461903[444] = 0;
out_4893943347815461903[445] = 0;
out_4893943347815461903[446] = 0;
out_4893943347815461903[447] = 0;
out_4893943347815461903[448] = 0;
out_4893943347815461903[449] = 0;
out_4893943347815461903[450] = 0;
out_4893943347815461903[451] = 0;
out_4893943347815461903[452] = 0;
out_4893943347815461903[453] = 0;
out_4893943347815461903[454] = 0;
out_4893943347815461903[455] = 0;
out_4893943347815461903[456] = 0;
out_4893943347815461903[457] = 0;
out_4893943347815461903[458] = 0;
out_4893943347815461903[459] = 0;
out_4893943347815461903[460] = 0;
out_4893943347815461903[461] = 1.0;
}
void f_fun(double *state, double dt, double *out_1490934551927816954) {
out_1490934551927816954[0] = dt*state[7] + state[0];
out_1490934551927816954[1] = dt*state[8] + state[1];
out_1490934551927816954[2] = dt*state[9] + state[2];
out_1490934551927816954[3] = dt*(-0.5*state[4]*state[10] - 0.5*state[5]*state[11] - 0.5*state[6]*state[12]) + state[3];
out_1490934551927816954[4] = dt*(0.5*state[3]*state[10] + 0.5*state[5]*state[12] - 0.5*state[6]*state[11]) + state[4];
out_1490934551927816954[5] = dt*(0.5*state[3]*state[11] - 0.5*state[4]*state[12] + 0.5*state[6]*state[10]) + state[5];
out_1490934551927816954[6] = dt*(0.5*state[3]*state[12] + 0.5*state[4]*state[11] - 0.5*state[5]*state[10]) + state[6];
out_1490934551927816954[7] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[18] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[17] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[16]) + state[7];
out_1490934551927816954[8] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[18] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[16] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[17]) + state[8];
out_1490934551927816954[9] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[17] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]) + state[9];
out_1490934551927816954[10] = state[10];
out_1490934551927816954[11] = state[11];
out_1490934551927816954[12] = state[12];
out_1490934551927816954[13] = state[13];
out_1490934551927816954[14] = state[14];
out_1490934551927816954[15] = state[15];
out_1490934551927816954[16] = state[16];
out_1490934551927816954[17] = state[17];
out_1490934551927816954[18] = state[18];
out_1490934551927816954[19] = state[19];
out_1490934551927816954[20] = state[20];
out_1490934551927816954[21] = state[21];
}
void F_fun(double *state, double dt, double *out_2062859019570548817) {
out_2062859019570548817[0] = 1;
out_2062859019570548817[1] = 0;
out_2062859019570548817[2] = 0;
out_2062859019570548817[3] = 0;
out_2062859019570548817[4] = 0;
out_2062859019570548817[5] = 0;
out_2062859019570548817[6] = dt;
out_2062859019570548817[7] = 0;
out_2062859019570548817[8] = 0;
out_2062859019570548817[9] = 0;
out_2062859019570548817[10] = 0;
out_2062859019570548817[11] = 0;
out_2062859019570548817[12] = 0;
out_2062859019570548817[13] = 0;
out_2062859019570548817[14] = 0;
out_2062859019570548817[15] = 0;
out_2062859019570548817[16] = 0;
out_2062859019570548817[17] = 0;
out_2062859019570548817[18] = 0;
out_2062859019570548817[19] = 0;
out_2062859019570548817[20] = 0;
out_2062859019570548817[21] = 0;
out_2062859019570548817[22] = 1;
out_2062859019570548817[23] = 0;
out_2062859019570548817[24] = 0;
out_2062859019570548817[25] = 0;
out_2062859019570548817[26] = 0;
out_2062859019570548817[27] = 0;
out_2062859019570548817[28] = dt;
out_2062859019570548817[29] = 0;
out_2062859019570548817[30] = 0;
out_2062859019570548817[31] = 0;
out_2062859019570548817[32] = 0;
out_2062859019570548817[33] = 0;
out_2062859019570548817[34] = 0;
out_2062859019570548817[35] = 0;
out_2062859019570548817[36] = 0;
out_2062859019570548817[37] = 0;
out_2062859019570548817[38] = 0;
out_2062859019570548817[39] = 0;
out_2062859019570548817[40] = 0;
out_2062859019570548817[41] = 0;
out_2062859019570548817[42] = 0;
out_2062859019570548817[43] = 0;
out_2062859019570548817[44] = 1;
out_2062859019570548817[45] = 0;
out_2062859019570548817[46] = 0;
out_2062859019570548817[47] = 0;
out_2062859019570548817[48] = 0;
out_2062859019570548817[49] = 0;
out_2062859019570548817[50] = dt;
out_2062859019570548817[51] = 0;
out_2062859019570548817[52] = 0;
out_2062859019570548817[53] = 0;
out_2062859019570548817[54] = 0;
out_2062859019570548817[55] = 0;
out_2062859019570548817[56] = 0;
out_2062859019570548817[57] = 0;
out_2062859019570548817[58] = 0;
out_2062859019570548817[59] = 0;
out_2062859019570548817[60] = 0;
out_2062859019570548817[61] = 0;
out_2062859019570548817[62] = 0;
out_2062859019570548817[63] = 0;
out_2062859019570548817[64] = 0;
out_2062859019570548817[65] = 0;
out_2062859019570548817[66] = 1;
out_2062859019570548817[67] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[11] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[10] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[12]);
out_2062859019570548817[68] = dt*((2*state[3]*state[4] - 2*state[5]*state[6])*state[12] + (-2*state[3]*state[6] - 2*state[4]*state[5])*state[10] + (-pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[11]);
out_2062859019570548817[69] = 0;
out_2062859019570548817[70] = 0;
out_2062859019570548817[71] = 0;
out_2062859019570548817[72] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2));
out_2062859019570548817[73] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]);
out_2062859019570548817[74] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]);
out_2062859019570548817[75] = 0;
out_2062859019570548817[76] = 0;
out_2062859019570548817[77] = 0;
out_2062859019570548817[78] = 0;
out_2062859019570548817[79] = 0;
out_2062859019570548817[80] = 0;
out_2062859019570548817[81] = 0;
out_2062859019570548817[82] = 0;
out_2062859019570548817[83] = 0;
out_2062859019570548817[84] = 0;
out_2062859019570548817[85] = 0;
out_2062859019570548817[86] = 0;
out_2062859019570548817[87] = dt*(-(2*state[3]*state[4] + 2*state[5]*state[6])*state[11] - (-2*state[3]*state[5] + 2*state[4]*state[6])*state[10] - (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[12]);
out_2062859019570548817[88] = 1;
out_2062859019570548817[89] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[12] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[11] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[10]);
out_2062859019570548817[90] = 0;
out_2062859019570548817[91] = 0;
out_2062859019570548817[92] = 0;
out_2062859019570548817[93] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]);
out_2062859019570548817[94] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2));
out_2062859019570548817[95] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]);
out_2062859019570548817[96] = 0;
out_2062859019570548817[97] = 0;
out_2062859019570548817[98] = 0;
out_2062859019570548817[99] = 0;
out_2062859019570548817[100] = 0;
out_2062859019570548817[101] = 0;
out_2062859019570548817[102] = 0;
out_2062859019570548817[103] = 0;
out_2062859019570548817[104] = 0;
out_2062859019570548817[105] = 0;
out_2062859019570548817[106] = 0;
out_2062859019570548817[107] = 0;
out_2062859019570548817[108] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[12] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[10] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[11]);
out_2062859019570548817[109] = dt*((-2*state[3]*state[5] - 2*state[4]*state[6])*state[12] + (2*state[3]*state[6] - 2*state[4]*state[5])*state[11] + (-pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) + pow(state[6], 2))*state[10]);
out_2062859019570548817[110] = 1;
out_2062859019570548817[111] = 0;
out_2062859019570548817[112] = 0;
out_2062859019570548817[113] = 0;
out_2062859019570548817[114] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]);
out_2062859019570548817[115] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]);
out_2062859019570548817[116] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2));
out_2062859019570548817[117] = 0;
out_2062859019570548817[118] = 0;
out_2062859019570548817[119] = 0;
out_2062859019570548817[120] = 0;
out_2062859019570548817[121] = 0;
out_2062859019570548817[122] = 0;
out_2062859019570548817[123] = 0;
out_2062859019570548817[124] = 0;
out_2062859019570548817[125] = 0;
out_2062859019570548817[126] = 0;
out_2062859019570548817[127] = 0;
out_2062859019570548817[128] = 0;
out_2062859019570548817[129] = 0;
out_2062859019570548817[130] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[17] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]);
out_2062859019570548817[131] = dt*((2*state[3]*state[4] - 2*state[5]*state[6])*state[18] + (-2*state[3]*state[6] - 2*state[4]*state[5])*state[16] + (-pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[17]);
out_2062859019570548817[132] = 1;
out_2062859019570548817[133] = 0;
out_2062859019570548817[134] = 0;
out_2062859019570548817[135] = 0;
out_2062859019570548817[136] = 0;
out_2062859019570548817[137] = 0;
out_2062859019570548817[138] = 0;
out_2062859019570548817[139] = 0;
out_2062859019570548817[140] = 0;
out_2062859019570548817[141] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2));
out_2062859019570548817[142] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]);
out_2062859019570548817[143] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]);
out_2062859019570548817[144] = 0;
out_2062859019570548817[145] = 0;
out_2062859019570548817[146] = 0;
out_2062859019570548817[147] = 0;
out_2062859019570548817[148] = 0;
out_2062859019570548817[149] = 0;
out_2062859019570548817[150] = dt*(-(2*state[3]*state[4] + 2*state[5]*state[6])*state[17] - (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] - (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]);
out_2062859019570548817[151] = 0;
out_2062859019570548817[152] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[18] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[17] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[16]);
out_2062859019570548817[153] = 0;
out_2062859019570548817[154] = 1;
out_2062859019570548817[155] = 0;
out_2062859019570548817[156] = 0;
out_2062859019570548817[157] = 0;
out_2062859019570548817[158] = 0;
out_2062859019570548817[159] = 0;
out_2062859019570548817[160] = 0;
out_2062859019570548817[161] = 0;
out_2062859019570548817[162] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]);
out_2062859019570548817[163] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2));
out_2062859019570548817[164] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]);
out_2062859019570548817[165] = 0;
out_2062859019570548817[166] = 0;
out_2062859019570548817[167] = 0;
out_2062859019570548817[168] = 0;
out_2062859019570548817[169] = 0;
out_2062859019570548817[170] = 0;
out_2062859019570548817[171] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[18] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[16] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[17]);
out_2062859019570548817[172] = dt*((-2*state[3]*state[5] - 2*state[4]*state[6])*state[18] + (2*state[3]*state[6] - 2*state[4]*state[5])*state[17] + (-pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) + pow(state[6], 2))*state[16]);
out_2062859019570548817[173] = 0;
out_2062859019570548817[174] = 0;
out_2062859019570548817[175] = 0;
out_2062859019570548817[176] = 1;
out_2062859019570548817[177] = 0;
out_2062859019570548817[178] = 0;
out_2062859019570548817[179] = 0;
out_2062859019570548817[180] = 0;
out_2062859019570548817[181] = 0;
out_2062859019570548817[182] = 0;
out_2062859019570548817[183] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]);
out_2062859019570548817[184] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]);
out_2062859019570548817[185] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2));
out_2062859019570548817[186] = 0;
out_2062859019570548817[187] = 0;
out_2062859019570548817[188] = 0;
out_2062859019570548817[189] = 0;
out_2062859019570548817[190] = 0;
out_2062859019570548817[191] = 0;
out_2062859019570548817[192] = 0;
out_2062859019570548817[193] = 0;
out_2062859019570548817[194] = 0;
out_2062859019570548817[195] = 0;
out_2062859019570548817[196] = 0;
out_2062859019570548817[197] = 0;
out_2062859019570548817[198] = 1;
out_2062859019570548817[199] = 0;
out_2062859019570548817[200] = 0;
out_2062859019570548817[201] = 0;
out_2062859019570548817[202] = 0;
out_2062859019570548817[203] = 0;
out_2062859019570548817[204] = 0;
out_2062859019570548817[205] = 0;
out_2062859019570548817[206] = 0;
out_2062859019570548817[207] = 0;
out_2062859019570548817[208] = 0;
out_2062859019570548817[209] = 0;
out_2062859019570548817[210] = 0;
out_2062859019570548817[211] = 0;
out_2062859019570548817[212] = 0;
out_2062859019570548817[213] = 0;
out_2062859019570548817[214] = 0;
out_2062859019570548817[215] = 0;
out_2062859019570548817[216] = 0;
out_2062859019570548817[217] = 0;
out_2062859019570548817[218] = 0;
out_2062859019570548817[219] = 0;
out_2062859019570548817[220] = 1;
out_2062859019570548817[221] = 0;
out_2062859019570548817[222] = 0;
out_2062859019570548817[223] = 0;
out_2062859019570548817[224] = 0;
out_2062859019570548817[225] = 0;
out_2062859019570548817[226] = 0;
out_2062859019570548817[227] = 0;
out_2062859019570548817[228] = 0;
out_2062859019570548817[229] = 0;
out_2062859019570548817[230] = 0;
out_2062859019570548817[231] = 0;
out_2062859019570548817[232] = 0;
out_2062859019570548817[233] = 0;
out_2062859019570548817[234] = 0;
out_2062859019570548817[235] = 0;
out_2062859019570548817[236] = 0;
out_2062859019570548817[237] = 0;
out_2062859019570548817[238] = 0;
out_2062859019570548817[239] = 0;
out_2062859019570548817[240] = 0;
out_2062859019570548817[241] = 0;
out_2062859019570548817[242] = 1;
out_2062859019570548817[243] = 0;
out_2062859019570548817[244] = 0;
out_2062859019570548817[245] = 0;
out_2062859019570548817[246] = 0;
out_2062859019570548817[247] = 0;
out_2062859019570548817[248] = 0;
out_2062859019570548817[249] = 0;
out_2062859019570548817[250] = 0;
out_2062859019570548817[251] = 0;
out_2062859019570548817[252] = 0;
out_2062859019570548817[253] = 0;
out_2062859019570548817[254] = 0;
out_2062859019570548817[255] = 0;
out_2062859019570548817[256] = 0;
out_2062859019570548817[257] = 0;
out_2062859019570548817[258] = 0;
out_2062859019570548817[259] = 0;
out_2062859019570548817[260] = 0;
out_2062859019570548817[261] = 0;
out_2062859019570548817[262] = 0;
out_2062859019570548817[263] = 0;
out_2062859019570548817[264] = 1;
out_2062859019570548817[265] = 0;
out_2062859019570548817[266] = 0;
out_2062859019570548817[267] = 0;
out_2062859019570548817[268] = 0;
out_2062859019570548817[269] = 0;
out_2062859019570548817[270] = 0;
out_2062859019570548817[271] = 0;
out_2062859019570548817[272] = 0;
out_2062859019570548817[273] = 0;
out_2062859019570548817[274] = 0;
out_2062859019570548817[275] = 0;
out_2062859019570548817[276] = 0;
out_2062859019570548817[277] = 0;
out_2062859019570548817[278] = 0;
out_2062859019570548817[279] = 0;
out_2062859019570548817[280] = 0;
out_2062859019570548817[281] = 0;
out_2062859019570548817[282] = 0;
out_2062859019570548817[283] = 0;
out_2062859019570548817[284] = 0;
out_2062859019570548817[285] = 0;
out_2062859019570548817[286] = 1;
out_2062859019570548817[287] = 0;
out_2062859019570548817[288] = 0;
out_2062859019570548817[289] = 0;
out_2062859019570548817[290] = 0;
out_2062859019570548817[291] = 0;
out_2062859019570548817[292] = 0;
out_2062859019570548817[293] = 0;
out_2062859019570548817[294] = 0;
out_2062859019570548817[295] = 0;
out_2062859019570548817[296] = 0;
out_2062859019570548817[297] = 0;
out_2062859019570548817[298] = 0;
out_2062859019570548817[299] = 0;
out_2062859019570548817[300] = 0;
out_2062859019570548817[301] = 0;
out_2062859019570548817[302] = 0;
out_2062859019570548817[303] = 0;
out_2062859019570548817[304] = 0;
out_2062859019570548817[305] = 0;
out_2062859019570548817[306] = 0;
out_2062859019570548817[307] = 0;
out_2062859019570548817[308] = 1;
out_2062859019570548817[309] = 0;
out_2062859019570548817[310] = 0;
out_2062859019570548817[311] = 0;
out_2062859019570548817[312] = 0;
out_2062859019570548817[313] = 0;
out_2062859019570548817[314] = 0;
out_2062859019570548817[315] = 0;
out_2062859019570548817[316] = 0;
out_2062859019570548817[317] = 0;
out_2062859019570548817[318] = 0;
out_2062859019570548817[319] = 0;
out_2062859019570548817[320] = 0;
out_2062859019570548817[321] = 0;
out_2062859019570548817[322] = 0;
out_2062859019570548817[323] = 0;
out_2062859019570548817[324] = 0;
out_2062859019570548817[325] = 0;
out_2062859019570548817[326] = 0;
out_2062859019570548817[327] = 0;
out_2062859019570548817[328] = 0;
out_2062859019570548817[329] = 0;
out_2062859019570548817[330] = 1;
out_2062859019570548817[331] = 0;
out_2062859019570548817[332] = 0;
out_2062859019570548817[333] = 0;
out_2062859019570548817[334] = 0;
out_2062859019570548817[335] = 0;
out_2062859019570548817[336] = 0;
out_2062859019570548817[337] = 0;
out_2062859019570548817[338] = 0;
out_2062859019570548817[339] = 0;
out_2062859019570548817[340] = 0;
out_2062859019570548817[341] = 0;
out_2062859019570548817[342] = 0;
out_2062859019570548817[343] = 0;
out_2062859019570548817[344] = 0;
out_2062859019570548817[345] = 0;
out_2062859019570548817[346] = 0;
out_2062859019570548817[347] = 0;
out_2062859019570548817[348] = 0;
out_2062859019570548817[349] = 0;
out_2062859019570548817[350] = 0;
out_2062859019570548817[351] = 0;
out_2062859019570548817[352] = 1;
out_2062859019570548817[353] = 0;
out_2062859019570548817[354] = 0;
out_2062859019570548817[355] = 0;
out_2062859019570548817[356] = 0;
out_2062859019570548817[357] = 0;
out_2062859019570548817[358] = 0;
out_2062859019570548817[359] = 0;
out_2062859019570548817[360] = 0;
out_2062859019570548817[361] = 0;
out_2062859019570548817[362] = 0;
out_2062859019570548817[363] = 0;
out_2062859019570548817[364] = 0;
out_2062859019570548817[365] = 0;
out_2062859019570548817[366] = 0;
out_2062859019570548817[367] = 0;
out_2062859019570548817[368] = 0;
out_2062859019570548817[369] = 0;
out_2062859019570548817[370] = 0;
out_2062859019570548817[371] = 0;
out_2062859019570548817[372] = 0;
out_2062859019570548817[373] = 0;
out_2062859019570548817[374] = 1;
out_2062859019570548817[375] = 0;
out_2062859019570548817[376] = 0;
out_2062859019570548817[377] = 0;
out_2062859019570548817[378] = 0;
out_2062859019570548817[379] = 0;
out_2062859019570548817[380] = 0;
out_2062859019570548817[381] = 0;
out_2062859019570548817[382] = 0;
out_2062859019570548817[383] = 0;
out_2062859019570548817[384] = 0;
out_2062859019570548817[385] = 0;
out_2062859019570548817[386] = 0;
out_2062859019570548817[387] = 0;
out_2062859019570548817[388] = 0;
out_2062859019570548817[389] = 0;
out_2062859019570548817[390] = 0;
out_2062859019570548817[391] = 0;
out_2062859019570548817[392] = 0;
out_2062859019570548817[393] = 0;
out_2062859019570548817[394] = 0;
out_2062859019570548817[395] = 0;
out_2062859019570548817[396] = 1;
out_2062859019570548817[397] = 0;
out_2062859019570548817[398] = 0;
out_2062859019570548817[399] = 0;
out_2062859019570548817[400] = 0;
out_2062859019570548817[401] = 0;
out_2062859019570548817[402] = 0;
out_2062859019570548817[403] = 0;
out_2062859019570548817[404] = 0;
out_2062859019570548817[405] = 0;
out_2062859019570548817[406] = 0;
out_2062859019570548817[407] = 0;
out_2062859019570548817[408] = 0;
out_2062859019570548817[409] = 0;
out_2062859019570548817[410] = 0;
out_2062859019570548817[411] = 0;
out_2062859019570548817[412] = 0;
out_2062859019570548817[413] = 0;
out_2062859019570548817[414] = 0;
out_2062859019570548817[415] = 0;
out_2062859019570548817[416] = 0;
out_2062859019570548817[417] = 0;
out_2062859019570548817[418] = 1;
out_2062859019570548817[419] = 0;
out_2062859019570548817[420] = 0;
out_2062859019570548817[421] = 0;
out_2062859019570548817[422] = 0;
out_2062859019570548817[423] = 0;
out_2062859019570548817[424] = 0;
out_2062859019570548817[425] = 0;
out_2062859019570548817[426] = 0;
out_2062859019570548817[427] = 0;
out_2062859019570548817[428] = 0;
out_2062859019570548817[429] = 0;
out_2062859019570548817[430] = 0;
out_2062859019570548817[431] = 0;
out_2062859019570548817[432] = 0;
out_2062859019570548817[433] = 0;
out_2062859019570548817[434] = 0;
out_2062859019570548817[435] = 0;
out_2062859019570548817[436] = 0;
out_2062859019570548817[437] = 0;
out_2062859019570548817[438] = 0;
out_2062859019570548817[439] = 0;
out_2062859019570548817[440] = 1;
}
void h_4(double *state, double *unused, double *out_335431168283599212) {
out_335431168283599212[0] = state[10] + state[13];
out_335431168283599212[1] = state[11] + state[14];
out_335431168283599212[2] = state[12] + state[15];
}
void H_4(double *state, double *unused, double *out_4205541147974148351) {
out_4205541147974148351[0] = 0;
out_4205541147974148351[1] = 0;
out_4205541147974148351[2] = 0;
out_4205541147974148351[3] = 0;
out_4205541147974148351[4] = 0;
out_4205541147974148351[5] = 0;
out_4205541147974148351[6] = 0;
out_4205541147974148351[7] = 0;
out_4205541147974148351[8] = 0;
out_4205541147974148351[9] = 0;
out_4205541147974148351[10] = 1;
out_4205541147974148351[11] = 0;
out_4205541147974148351[12] = 0;
out_4205541147974148351[13] = 1;
out_4205541147974148351[14] = 0;
out_4205541147974148351[15] = 0;
out_4205541147974148351[16] = 0;
out_4205541147974148351[17] = 0;
out_4205541147974148351[18] = 0;
out_4205541147974148351[19] = 0;
out_4205541147974148351[20] = 0;
out_4205541147974148351[21] = 0;
out_4205541147974148351[22] = 0;
out_4205541147974148351[23] = 0;
out_4205541147974148351[24] = 0;
out_4205541147974148351[25] = 0;
out_4205541147974148351[26] = 0;
out_4205541147974148351[27] = 0;
out_4205541147974148351[28] = 0;
out_4205541147974148351[29] = 0;
out_4205541147974148351[30] = 0;
out_4205541147974148351[31] = 0;
out_4205541147974148351[32] = 0;
out_4205541147974148351[33] = 1;
out_4205541147974148351[34] = 0;
out_4205541147974148351[35] = 0;
out_4205541147974148351[36] = 1;
out_4205541147974148351[37] = 0;
out_4205541147974148351[38] = 0;
out_4205541147974148351[39] = 0;
out_4205541147974148351[40] = 0;
out_4205541147974148351[41] = 0;
out_4205541147974148351[42] = 0;
out_4205541147974148351[43] = 0;
out_4205541147974148351[44] = 0;
out_4205541147974148351[45] = 0;
out_4205541147974148351[46] = 0;
out_4205541147974148351[47] = 0;
out_4205541147974148351[48] = 0;
out_4205541147974148351[49] = 0;
out_4205541147974148351[50] = 0;
out_4205541147974148351[51] = 0;
out_4205541147974148351[52] = 0;
out_4205541147974148351[53] = 0;
out_4205541147974148351[54] = 0;
out_4205541147974148351[55] = 0;
out_4205541147974148351[56] = 1;
out_4205541147974148351[57] = 0;
out_4205541147974148351[58] = 0;
out_4205541147974148351[59] = 1;
out_4205541147974148351[60] = 0;
out_4205541147974148351[61] = 0;
out_4205541147974148351[62] = 0;
out_4205541147974148351[63] = 0;
out_4205541147974148351[64] = 0;
out_4205541147974148351[65] = 0;
}
void h_9(double *state, double *unused, double *out_1746837330775165620) {
out_1746837330775165620[0] = state[10];
out_1746837330775165620[1] = state[11];
out_1746837330775165620[2] = state[12];
}
void H_9(double *state, double *unused, double *out_3964351501344557706) {
out_3964351501344557706[0] = 0;
out_3964351501344557706[1] = 0;
out_3964351501344557706[2] = 0;
out_3964351501344557706[3] = 0;
out_3964351501344557706[4] = 0;
out_3964351501344557706[5] = 0;
out_3964351501344557706[6] = 0;
out_3964351501344557706[7] = 0;
out_3964351501344557706[8] = 0;
out_3964351501344557706[9] = 0;
out_3964351501344557706[10] = 1;
out_3964351501344557706[11] = 0;
out_3964351501344557706[12] = 0;
out_3964351501344557706[13] = 0;
out_3964351501344557706[14] = 0;
out_3964351501344557706[15] = 0;
out_3964351501344557706[16] = 0;
out_3964351501344557706[17] = 0;
out_3964351501344557706[18] = 0;
out_3964351501344557706[19] = 0;
out_3964351501344557706[20] = 0;
out_3964351501344557706[21] = 0;
out_3964351501344557706[22] = 0;
out_3964351501344557706[23] = 0;
out_3964351501344557706[24] = 0;
out_3964351501344557706[25] = 0;
out_3964351501344557706[26] = 0;
out_3964351501344557706[27] = 0;
out_3964351501344557706[28] = 0;
out_3964351501344557706[29] = 0;
out_3964351501344557706[30] = 0;
out_3964351501344557706[31] = 0;
out_3964351501344557706[32] = 0;
out_3964351501344557706[33] = 1;
out_3964351501344557706[34] = 0;
out_3964351501344557706[35] = 0;
out_3964351501344557706[36] = 0;
out_3964351501344557706[37] = 0;
out_3964351501344557706[38] = 0;
out_3964351501344557706[39] = 0;
out_3964351501344557706[40] = 0;
out_3964351501344557706[41] = 0;
out_3964351501344557706[42] = 0;
out_3964351501344557706[43] = 0;
out_3964351501344557706[44] = 0;
out_3964351501344557706[45] = 0;
out_3964351501344557706[46] = 0;
out_3964351501344557706[47] = 0;
out_3964351501344557706[48] = 0;
out_3964351501344557706[49] = 0;
out_3964351501344557706[50] = 0;
out_3964351501344557706[51] = 0;
out_3964351501344557706[52] = 0;
out_3964351501344557706[53] = 0;
out_3964351501344557706[54] = 0;
out_3964351501344557706[55] = 0;
out_3964351501344557706[56] = 1;
out_3964351501344557706[57] = 0;
out_3964351501344557706[58] = 0;
out_3964351501344557706[59] = 0;
out_3964351501344557706[60] = 0;
out_3964351501344557706[61] = 0;
out_3964351501344557706[62] = 0;
out_3964351501344557706[63] = 0;
out_3964351501344557706[64] = 0;
out_3964351501344557706[65] = 0;
}
void h_10(double *state, double *unused, double *out_6389141055710814361) {
out_6389141055710814361[0] = 398600500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2] + 398600500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0] + state[16] + state[19];
out_6389141055710814361[1] = 398600500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2] + 398600500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[1] + state[17] + state[20];
out_6389141055710814361[2] = 398600500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1] + 398600500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[2] + state[18] + state[21];
}
void H_10(double *state, double *unused, double *out_394910773077939482) {
out_394910773077939482[0] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*pow(state[0], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2));
out_394910773077939482[1] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[1], 2) + 398600500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0]*state[1];
out_394910773077939482[2] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[2], 2) + 398600500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0]*state[2];
out_394910773077939482[3] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5];
out_394910773077939482[4] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6];
out_394910773077939482[5] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3];
out_394910773077939482[6] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4];
out_394910773077939482[7] = 0;
out_394910773077939482[8] = 0;
out_394910773077939482[9] = 0;
out_394910773077939482[10] = 0;
out_394910773077939482[11] = 0;
out_394910773077939482[12] = 0;
out_394910773077939482[13] = 0;
out_394910773077939482[14] = 0;
out_394910773077939482[15] = 0;
out_394910773077939482[16] = 1;
out_394910773077939482[17] = 0;
out_394910773077939482[18] = 0;
out_394910773077939482[19] = 1;
out_394910773077939482[20] = 0;
out_394910773077939482[21] = 0;
out_394910773077939482[22] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[0], 2) + 398600500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[0]*state[1];
out_394910773077939482[23] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*pow(state[1], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2));
out_394910773077939482[24] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[2], 2) + 398600500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[1]*state[2];
out_394910773077939482[25] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4];
out_394910773077939482[26] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3];
out_394910773077939482[27] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6];
out_394910773077939482[28] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5];
out_394910773077939482[29] = 0;
out_394910773077939482[30] = 0;
out_394910773077939482[31] = 0;
out_394910773077939482[32] = 0;
out_394910773077939482[33] = 0;
out_394910773077939482[34] = 0;
out_394910773077939482[35] = 0;
out_394910773077939482[36] = 0;
out_394910773077939482[37] = 0;
out_394910773077939482[38] = 0;
out_394910773077939482[39] = 1;
out_394910773077939482[40] = 0;
out_394910773077939482[41] = 0;
out_394910773077939482[42] = 1;
out_394910773077939482[43] = 0;
out_394910773077939482[44] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[0], 2) + 398600500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[0]*state[2];
out_394910773077939482[45] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[1], 2) + 398600500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[1]*state[2];
out_394910773077939482[46] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*pow(state[2], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2));
out_394910773077939482[47] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3];
out_394910773077939482[48] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4];
out_394910773077939482[49] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5];
out_394910773077939482[50] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6];
out_394910773077939482[51] = 0;
out_394910773077939482[52] = 0;
out_394910773077939482[53] = 0;
out_394910773077939482[54] = 0;
out_394910773077939482[55] = 0;
out_394910773077939482[56] = 0;
out_394910773077939482[57] = 0;
out_394910773077939482[58] = 0;
out_394910773077939482[59] = 0;
out_394910773077939482[60] = 0;
out_394910773077939482[61] = 0;
out_394910773077939482[62] = 1;
out_394910773077939482[63] = 0;
out_394910773077939482[64] = 0;
out_394910773077939482[65] = 1;
}
void h_12(double *state, double *unused, double *out_4800955541602290447) {
out_4800955541602290447[0] = state[0];
out_4800955541602290447[1] = state[1];
out_4800955541602290447[2] = state[2];
}
void H_12(double *state, double *unused, double *out_813915260057813444) {
out_813915260057813444[0] = 1;
out_813915260057813444[1] = 0;
out_813915260057813444[2] = 0;
out_813915260057813444[3] = 0;
out_813915260057813444[4] = 0;
out_813915260057813444[5] = 0;
out_813915260057813444[6] = 0;
out_813915260057813444[7] = 0;
out_813915260057813444[8] = 0;
out_813915260057813444[9] = 0;
out_813915260057813444[10] = 0;
out_813915260057813444[11] = 0;
out_813915260057813444[12] = 0;
out_813915260057813444[13] = 0;
out_813915260057813444[14] = 0;
out_813915260057813444[15] = 0;
out_813915260057813444[16] = 0;
out_813915260057813444[17] = 0;
out_813915260057813444[18] = 0;
out_813915260057813444[19] = 0;
out_813915260057813444[20] = 0;
out_813915260057813444[21] = 0;
out_813915260057813444[22] = 0;
out_813915260057813444[23] = 1;
out_813915260057813444[24] = 0;
out_813915260057813444[25] = 0;
out_813915260057813444[26] = 0;
out_813915260057813444[27] = 0;
out_813915260057813444[28] = 0;
out_813915260057813444[29] = 0;
out_813915260057813444[30] = 0;
out_813915260057813444[31] = 0;
out_813915260057813444[32] = 0;
out_813915260057813444[33] = 0;
out_813915260057813444[34] = 0;
out_813915260057813444[35] = 0;
out_813915260057813444[36] = 0;
out_813915260057813444[37] = 0;
out_813915260057813444[38] = 0;
out_813915260057813444[39] = 0;
out_813915260057813444[40] = 0;
out_813915260057813444[41] = 0;
out_813915260057813444[42] = 0;
out_813915260057813444[43] = 0;
out_813915260057813444[44] = 0;
out_813915260057813444[45] = 0;
out_813915260057813444[46] = 1;
out_813915260057813444[47] = 0;
out_813915260057813444[48] = 0;
out_813915260057813444[49] = 0;
out_813915260057813444[50] = 0;
out_813915260057813444[51] = 0;
out_813915260057813444[52] = 0;
out_813915260057813444[53] = 0;
out_813915260057813444[54] = 0;
out_813915260057813444[55] = 0;
out_813915260057813444[56] = 0;
out_813915260057813444[57] = 0;
out_813915260057813444[58] = 0;
out_813915260057813444[59] = 0;
out_813915260057813444[60] = 0;
out_813915260057813444[61] = 0;
out_813915260057813444[62] = 0;
out_813915260057813444[63] = 0;
out_813915260057813444[64] = 0;
out_813915260057813444[65] = 0;
}
void h_35(double *state, double *unused, double *out_8655348954820926857) {
out_8655348954820926857[0] = state[7];
out_8655348954820926857[1] = state[8];
out_8655348954820926857[2] = state[9];
}
void H_35(double *state, double *unused, double *out_838879090601540975) {
out_838879090601540975[0] = 0;
out_838879090601540975[1] = 0;
out_838879090601540975[2] = 0;
out_838879090601540975[3] = 0;
out_838879090601540975[4] = 0;
out_838879090601540975[5] = 0;
out_838879090601540975[6] = 0;
out_838879090601540975[7] = 1;
out_838879090601540975[8] = 0;
out_838879090601540975[9] = 0;
out_838879090601540975[10] = 0;
out_838879090601540975[11] = 0;
out_838879090601540975[12] = 0;
out_838879090601540975[13] = 0;
out_838879090601540975[14] = 0;
out_838879090601540975[15] = 0;
out_838879090601540975[16] = 0;
out_838879090601540975[17] = 0;
out_838879090601540975[18] = 0;
out_838879090601540975[19] = 0;
out_838879090601540975[20] = 0;
out_838879090601540975[21] = 0;
out_838879090601540975[22] = 0;
out_838879090601540975[23] = 0;
out_838879090601540975[24] = 0;
out_838879090601540975[25] = 0;
out_838879090601540975[26] = 0;
out_838879090601540975[27] = 0;
out_838879090601540975[28] = 0;
out_838879090601540975[29] = 0;
out_838879090601540975[30] = 1;
out_838879090601540975[31] = 0;
out_838879090601540975[32] = 0;
out_838879090601540975[33] = 0;
out_838879090601540975[34] = 0;
out_838879090601540975[35] = 0;
out_838879090601540975[36] = 0;
out_838879090601540975[37] = 0;
out_838879090601540975[38] = 0;
out_838879090601540975[39] = 0;
out_838879090601540975[40] = 0;
out_838879090601540975[41] = 0;
out_838879090601540975[42] = 0;
out_838879090601540975[43] = 0;
out_838879090601540975[44] = 0;
out_838879090601540975[45] = 0;
out_838879090601540975[46] = 0;
out_838879090601540975[47] = 0;
out_838879090601540975[48] = 0;
out_838879090601540975[49] = 0;
out_838879090601540975[50] = 0;
out_838879090601540975[51] = 0;
out_838879090601540975[52] = 0;
out_838879090601540975[53] = 1;
out_838879090601540975[54] = 0;
out_838879090601540975[55] = 0;
out_838879090601540975[56] = 0;
out_838879090601540975[57] = 0;
out_838879090601540975[58] = 0;
out_838879090601540975[59] = 0;
out_838879090601540975[60] = 0;
out_838879090601540975[61] = 0;
out_838879090601540975[62] = 0;
out_838879090601540975[63] = 0;
out_838879090601540975[64] = 0;
out_838879090601540975[65] = 0;
}
void h_32(double *state, double *unused, double *out_7002226014671976453) {
out_7002226014671976453[0] = state[3];
out_7002226014671976453[1] = state[4];
out_7002226014671976453[2] = state[5];
out_7002226014671976453[3] = state[6];
}
void H_32(double *state, double *unused, double *out_707714305660800506) {
out_707714305660800506[0] = 0;
out_707714305660800506[1] = 0;
out_707714305660800506[2] = 0;
out_707714305660800506[3] = 1;
out_707714305660800506[4] = 0;
out_707714305660800506[5] = 0;
out_707714305660800506[6] = 0;
out_707714305660800506[7] = 0;
out_707714305660800506[8] = 0;
out_707714305660800506[9] = 0;
out_707714305660800506[10] = 0;
out_707714305660800506[11] = 0;
out_707714305660800506[12] = 0;
out_707714305660800506[13] = 0;
out_707714305660800506[14] = 0;
out_707714305660800506[15] = 0;
out_707714305660800506[16] = 0;
out_707714305660800506[17] = 0;
out_707714305660800506[18] = 0;
out_707714305660800506[19] = 0;
out_707714305660800506[20] = 0;
out_707714305660800506[21] = 0;
out_707714305660800506[22] = 0;
out_707714305660800506[23] = 0;
out_707714305660800506[24] = 0;
out_707714305660800506[25] = 0;
out_707714305660800506[26] = 1;
out_707714305660800506[27] = 0;
out_707714305660800506[28] = 0;
out_707714305660800506[29] = 0;
out_707714305660800506[30] = 0;
out_707714305660800506[31] = 0;
out_707714305660800506[32] = 0;
out_707714305660800506[33] = 0;
out_707714305660800506[34] = 0;
out_707714305660800506[35] = 0;
out_707714305660800506[36] = 0;
out_707714305660800506[37] = 0;
out_707714305660800506[38] = 0;
out_707714305660800506[39] = 0;
out_707714305660800506[40] = 0;
out_707714305660800506[41] = 0;
out_707714305660800506[42] = 0;
out_707714305660800506[43] = 0;
out_707714305660800506[44] = 0;
out_707714305660800506[45] = 0;
out_707714305660800506[46] = 0;
out_707714305660800506[47] = 0;
out_707714305660800506[48] = 0;
out_707714305660800506[49] = 1;
out_707714305660800506[50] = 0;
out_707714305660800506[51] = 0;
out_707714305660800506[52] = 0;
out_707714305660800506[53] = 0;
out_707714305660800506[54] = 0;
out_707714305660800506[55] = 0;
out_707714305660800506[56] = 0;
out_707714305660800506[57] = 0;
out_707714305660800506[58] = 0;
out_707714305660800506[59] = 0;
out_707714305660800506[60] = 0;
out_707714305660800506[61] = 0;
out_707714305660800506[62] = 0;
out_707714305660800506[63] = 0;
out_707714305660800506[64] = 0;
out_707714305660800506[65] = 0;
out_707714305660800506[66] = 0;
out_707714305660800506[67] = 0;
out_707714305660800506[68] = 0;
out_707714305660800506[69] = 0;
out_707714305660800506[70] = 0;
out_707714305660800506[71] = 0;
out_707714305660800506[72] = 1;
out_707714305660800506[73] = 0;
out_707714305660800506[74] = 0;
out_707714305660800506[75] = 0;
out_707714305660800506[76] = 0;
out_707714305660800506[77] = 0;
out_707714305660800506[78] = 0;
out_707714305660800506[79] = 0;
out_707714305660800506[80] = 0;
out_707714305660800506[81] = 0;
out_707714305660800506[82] = 0;
out_707714305660800506[83] = 0;
out_707714305660800506[84] = 0;
out_707714305660800506[85] = 0;
out_707714305660800506[86] = 0;
out_707714305660800506[87] = 0;
}
void h_13(double *state, double *unused, double *out_6173959503153832213) {
out_6173959503153832213[0] = (-2*state[3]*state[5] + 2*state[4]*state[6])*state[9] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[8] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[7];
out_6173959503153832213[1] = (2*state[3]*state[4] + 2*state[5]*state[6])*state[9] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[7] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[8];
out_6173959503153832213[2] = (-2*state[3]*state[4] + 2*state[5]*state[6])*state[8] + (2*state[3]*state[5] + 2*state[4]*state[6])*state[7] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[9];
}
void H_13(double *state, double *unused, double *out_1842862337219813003) {
out_1842862337219813003[0] = 0;
out_1842862337219813003[1] = 0;
out_1842862337219813003[2] = 0;
out_1842862337219813003[3] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8];
out_1842862337219813003[4] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
out_1842862337219813003[5] = -2*state[3]*state[9] + 2*state[4]*state[8] - 2*state[5]*state[7];
out_1842862337219813003[6] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7];
out_1842862337219813003[7] = pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2);
out_1842862337219813003[8] = 2*state[3]*state[6] + 2*state[4]*state[5];
out_1842862337219813003[9] = -2*state[3]*state[5] + 2*state[4]*state[6];
out_1842862337219813003[10] = 0;
out_1842862337219813003[11] = 0;
out_1842862337219813003[12] = 0;
out_1842862337219813003[13] = 0;
out_1842862337219813003[14] = 0;
out_1842862337219813003[15] = 0;
out_1842862337219813003[16] = 0;
out_1842862337219813003[17] = 0;
out_1842862337219813003[18] = 0;
out_1842862337219813003[19] = 0;
out_1842862337219813003[20] = 0;
out_1842862337219813003[21] = 0;
out_1842862337219813003[22] = 0;
out_1842862337219813003[23] = 0;
out_1842862337219813003[24] = 0;
out_1842862337219813003[25] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7];
out_1842862337219813003[26] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7];
out_1842862337219813003[27] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
out_1842862337219813003[28] = -2*state[3]*state[7] + 2*state[5]*state[9] - 2*state[6]*state[8];
out_1842862337219813003[29] = -2*state[3]*state[6] + 2*state[4]*state[5];
out_1842862337219813003[30] = pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2);
out_1842862337219813003[31] = 2*state[3]*state[4] + 2*state[5]*state[6];
out_1842862337219813003[32] = 0;
out_1842862337219813003[33] = 0;
out_1842862337219813003[34] = 0;
out_1842862337219813003[35] = 0;
out_1842862337219813003[36] = 0;
out_1842862337219813003[37] = 0;
out_1842862337219813003[38] = 0;
out_1842862337219813003[39] = 0;
out_1842862337219813003[40] = 0;
out_1842862337219813003[41] = 0;
out_1842862337219813003[42] = 0;
out_1842862337219813003[43] = 0;
out_1842862337219813003[44] = 0;
out_1842862337219813003[45] = 0;
out_1842862337219813003[46] = 0;
out_1842862337219813003[47] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7];
out_1842862337219813003[48] = -2*state[3]*state[8] - 2*state[4]*state[9] + 2*state[6]*state[7];
out_1842862337219813003[49] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8];
out_1842862337219813003[50] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
out_1842862337219813003[51] = 2*state[3]*state[5] + 2*state[4]*state[6];
out_1842862337219813003[52] = -2*state[3]*state[4] + 2*state[5]*state[6];
out_1842862337219813003[53] = pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2);
out_1842862337219813003[54] = 0;
out_1842862337219813003[55] = 0;
out_1842862337219813003[56] = 0;
out_1842862337219813003[57] = 0;
out_1842862337219813003[58] = 0;
out_1842862337219813003[59] = 0;
out_1842862337219813003[60] = 0;
out_1842862337219813003[61] = 0;
out_1842862337219813003[62] = 0;
out_1842862337219813003[63] = 0;
out_1842862337219813003[64] = 0;
out_1842862337219813003[65] = 0;
}
void h_14(double *state, double *unused, double *out_1746837330775165620) {
out_1746837330775165620[0] = state[10];
out_1746837330775165620[1] = state[11];
out_1746837330775165620[2] = state[12];
}
void H_14(double *state, double *unused, double *out_3964351501344557706) {
out_3964351501344557706[0] = 0;
out_3964351501344557706[1] = 0;
out_3964351501344557706[2] = 0;
out_3964351501344557706[3] = 0;
out_3964351501344557706[4] = 0;
out_3964351501344557706[5] = 0;
out_3964351501344557706[6] = 0;
out_3964351501344557706[7] = 0;
out_3964351501344557706[8] = 0;
out_3964351501344557706[9] = 0;
out_3964351501344557706[10] = 1;
out_3964351501344557706[11] = 0;
out_3964351501344557706[12] = 0;
out_3964351501344557706[13] = 0;
out_3964351501344557706[14] = 0;
out_3964351501344557706[15] = 0;
out_3964351501344557706[16] = 0;
out_3964351501344557706[17] = 0;
out_3964351501344557706[18] = 0;
out_3964351501344557706[19] = 0;
out_3964351501344557706[20] = 0;
out_3964351501344557706[21] = 0;
out_3964351501344557706[22] = 0;
out_3964351501344557706[23] = 0;
out_3964351501344557706[24] = 0;
out_3964351501344557706[25] = 0;
out_3964351501344557706[26] = 0;
out_3964351501344557706[27] = 0;
out_3964351501344557706[28] = 0;
out_3964351501344557706[29] = 0;
out_3964351501344557706[30] = 0;
out_3964351501344557706[31] = 0;
out_3964351501344557706[32] = 0;
out_3964351501344557706[33] = 1;
out_3964351501344557706[34] = 0;
out_3964351501344557706[35] = 0;
out_3964351501344557706[36] = 0;
out_3964351501344557706[37] = 0;
out_3964351501344557706[38] = 0;
out_3964351501344557706[39] = 0;
out_3964351501344557706[40] = 0;
out_3964351501344557706[41] = 0;
out_3964351501344557706[42] = 0;
out_3964351501344557706[43] = 0;
out_3964351501344557706[44] = 0;
out_3964351501344557706[45] = 0;
out_3964351501344557706[46] = 0;
out_3964351501344557706[47] = 0;
out_3964351501344557706[48] = 0;
out_3964351501344557706[49] = 0;
out_3964351501344557706[50] = 0;
out_3964351501344557706[51] = 0;
out_3964351501344557706[52] = 0;
out_3964351501344557706[53] = 0;
out_3964351501344557706[54] = 0;
out_3964351501344557706[55] = 0;
out_3964351501344557706[56] = 1;
out_3964351501344557706[57] = 0;
out_3964351501344557706[58] = 0;
out_3964351501344557706[59] = 0;
out_3964351501344557706[60] = 0;
out_3964351501344557706[61] = 0;
out_3964351501344557706[62] = 0;
out_3964351501344557706[63] = 0;
out_3964351501344557706[64] = 0;
out_3964351501344557706[65] = 0;
}
void h_33(double *state, double *unused, double *out_5949943105988094266) {
out_5949943105988094266[0] = state[16];
out_5949943105988094266[1] = state[17];
out_5949943105988094266[2] = state[18];
}
void H_33(double *state, double *unused, double *out_2311677914037316629) {
out_2311677914037316629[0] = 0;
out_2311677914037316629[1] = 0;
out_2311677914037316629[2] = 0;
out_2311677914037316629[3] = 0;
out_2311677914037316629[4] = 0;
out_2311677914037316629[5] = 0;
out_2311677914037316629[6] = 0;
out_2311677914037316629[7] = 0;
out_2311677914037316629[8] = 0;
out_2311677914037316629[9] = 0;
out_2311677914037316629[10] = 0;
out_2311677914037316629[11] = 0;
out_2311677914037316629[12] = 0;
out_2311677914037316629[13] = 0;
out_2311677914037316629[14] = 0;
out_2311677914037316629[15] = 0;
out_2311677914037316629[16] = 1;
out_2311677914037316629[17] = 0;
out_2311677914037316629[18] = 0;
out_2311677914037316629[19] = 0;
out_2311677914037316629[20] = 0;
out_2311677914037316629[21] = 0;
out_2311677914037316629[22] = 0;
out_2311677914037316629[23] = 0;
out_2311677914037316629[24] = 0;
out_2311677914037316629[25] = 0;
out_2311677914037316629[26] = 0;
out_2311677914037316629[27] = 0;
out_2311677914037316629[28] = 0;
out_2311677914037316629[29] = 0;
out_2311677914037316629[30] = 0;
out_2311677914037316629[31] = 0;
out_2311677914037316629[32] = 0;
out_2311677914037316629[33] = 0;
out_2311677914037316629[34] = 0;
out_2311677914037316629[35] = 0;
out_2311677914037316629[36] = 0;
out_2311677914037316629[37] = 0;
out_2311677914037316629[38] = 0;
out_2311677914037316629[39] = 1;
out_2311677914037316629[40] = 0;
out_2311677914037316629[41] = 0;
out_2311677914037316629[42] = 0;
out_2311677914037316629[43] = 0;
out_2311677914037316629[44] = 0;
out_2311677914037316629[45] = 0;
out_2311677914037316629[46] = 0;
out_2311677914037316629[47] = 0;
out_2311677914037316629[48] = 0;
out_2311677914037316629[49] = 0;
out_2311677914037316629[50] = 0;
out_2311677914037316629[51] = 0;
out_2311677914037316629[52] = 0;
out_2311677914037316629[53] = 0;
out_2311677914037316629[54] = 0;
out_2311677914037316629[55] = 0;
out_2311677914037316629[56] = 0;
out_2311677914037316629[57] = 0;
out_2311677914037316629[58] = 0;
out_2311677914037316629[59] = 0;
out_2311677914037316629[60] = 0;
out_2311677914037316629[61] = 0;
out_2311677914037316629[62] = 1;
out_2311677914037316629[63] = 0;
out_2311677914037316629[64] = 0;
out_2311677914037316629[65] = 0;
}
#include <eigen3/Eigen/Dense>
#include <iostream>
typedef Eigen::Matrix<double, DIM, DIM, Eigen::RowMajor> DDM;
typedef Eigen::Matrix<double, EDIM, EDIM, Eigen::RowMajor> EEM;
typedef Eigen::Matrix<double, DIM, EDIM, Eigen::RowMajor> DEM;
void predict(double *in_x, double *in_P, double *in_Q, double dt) {
typedef Eigen::Matrix<double, MEDIM, MEDIM, Eigen::RowMajor> RRM;
double nx[DIM] = {0};
double in_F[EDIM*EDIM] = {0};
// functions from sympy
f_fun(in_x, dt, nx);
F_fun(in_x, dt, in_F);
EEM F(in_F);
EEM P(in_P);
EEM Q(in_Q);
RRM F_main = F.topLeftCorner(MEDIM, MEDIM);
P.topLeftCorner(MEDIM, MEDIM) = (F_main * P.topLeftCorner(MEDIM, MEDIM)) * F_main.transpose();
P.topRightCorner(MEDIM, EDIM - MEDIM) = F_main * P.topRightCorner(MEDIM, EDIM - MEDIM);
P.bottomLeftCorner(EDIM - MEDIM, MEDIM) = P.bottomLeftCorner(EDIM - MEDIM, MEDIM) * F_main.transpose();
P = P + dt*Q;
// copy out state
memcpy(in_x, nx, DIM * sizeof(double));
memcpy(in_P, P.data(), EDIM * EDIM * sizeof(double));
}
// note: extra_args dim only correct when null space projecting
// otherwise 1
template <int ZDIM, int EADIM, bool MAHA_TEST>
void update(double *in_x, double *in_P, Hfun h_fun, Hfun H_fun, Hfun Hea_fun, double *in_z, double *in_R, double *in_ea, double MAHA_THRESHOLD) {
typedef Eigen::Matrix<double, ZDIM, ZDIM, Eigen::RowMajor> ZZM;
typedef Eigen::Matrix<double, ZDIM, DIM, Eigen::RowMajor> ZDM;
typedef Eigen::Matrix<double, Eigen::Dynamic, EDIM, Eigen::RowMajor> XEM;
//typedef Eigen::Matrix<double, EDIM, ZDIM, Eigen::RowMajor> EZM;
typedef Eigen::Matrix<double, Eigen::Dynamic, 1> X1M;
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> XXM;
double in_hx[ZDIM] = {0};
double in_H[ZDIM * DIM] = {0};
double in_H_mod[EDIM * DIM] = {0};
double delta_x[EDIM] = {0};
double x_new[DIM] = {0};
// state x, P
Eigen::Matrix<double, ZDIM, 1> z(in_z);
EEM P(in_P);
ZZM pre_R(in_R);
// functions from sympy
h_fun(in_x, in_ea, in_hx);
H_fun(in_x, in_ea, in_H);
ZDM pre_H(in_H);
// get y (y = z - hx)
Eigen::Matrix<double, ZDIM, 1> pre_y(in_hx); pre_y = z - pre_y;
X1M y; XXM H; XXM R;
if (Hea_fun){
typedef Eigen::Matrix<double, ZDIM, EADIM, Eigen::RowMajor> ZAM;
double in_Hea[ZDIM * EADIM] = {0};
Hea_fun(in_x, in_ea, in_Hea);
ZAM Hea(in_Hea);
XXM A = Hea.transpose().fullPivLu().kernel();
y = A.transpose() * pre_y;
H = A.transpose() * pre_H;
R = A.transpose() * pre_R * A;
} else {
y = pre_y;
H = pre_H;
R = pre_R;
}
// get modified H
H_mod_fun(in_x, in_H_mod);
DEM H_mod(in_H_mod);
XEM H_err = H * H_mod;
// Do mahalobis distance test
if (MAHA_TEST){
XXM a = (H_err * P * H_err.transpose() + R).inverse();
double maha_dist = y.transpose() * a * y;
if (maha_dist > MAHA_THRESHOLD){
R = 1.0e16 * R;
}
}
// Outlier resilient weighting
double weight = 1;//(1.5)/(1 + y.squaredNorm()/R.sum());
// kalman gains and I_KH
XXM S = ((H_err * P) * H_err.transpose()) + R/weight;
XEM KT = S.fullPivLu().solve(H_err * P.transpose());
//EZM K = KT.transpose(); TODO: WHY DOES THIS NOT COMPILE?
//EZM K = S.fullPivLu().solve(H_err * P.transpose()).transpose();
//std::cout << "Here is the matrix rot:\n" << K << std::endl;
EEM I_KH = Eigen::Matrix<double, EDIM, EDIM>::Identity() - (KT.transpose() * H_err);
// update state by injecting dx
Eigen::Matrix<double, EDIM, 1> dx(delta_x);
dx = (KT.transpose() * y);
memcpy(delta_x, dx.data(), EDIM * sizeof(double));
err_fun(in_x, delta_x, x_new);
Eigen::Matrix<double, DIM, 1> x(x_new);
// update cov
P = ((I_KH * P) * I_KH.transpose()) + ((KT.transpose() * R) * KT);
// copy out state
memcpy(in_x, x.data(), DIM * sizeof(double));
memcpy(in_P, P.data(), EDIM * EDIM * sizeof(double));
memcpy(in_z, y.data(), y.rows() * sizeof(double));
}
}
extern "C" {
void live_update_4(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
update<3, 3, 0>(in_x, in_P, h_4, H_4, NULL, in_z, in_R, in_ea, MAHA_THRESH_4);
}
void live_update_9(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
update<3, 3, 0>(in_x, in_P, h_9, H_9, NULL, in_z, in_R, in_ea, MAHA_THRESH_9);
}
void live_update_10(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
update<3, 3, 0>(in_x, in_P, h_10, H_10, NULL, in_z, in_R, in_ea, MAHA_THRESH_10);
}
void live_update_12(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
update<3, 3, 0>(in_x, in_P, h_12, H_12, NULL, in_z, in_R, in_ea, MAHA_THRESH_12);
}
void live_update_35(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
update<3, 3, 0>(in_x, in_P, h_35, H_35, NULL, in_z, in_R, in_ea, MAHA_THRESH_35);
}
void live_update_32(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
update<4, 3, 0>(in_x, in_P, h_32, H_32, NULL, in_z, in_R, in_ea, MAHA_THRESH_32);
}
void live_update_13(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
update<3, 3, 0>(in_x, in_P, h_13, H_13, NULL, in_z, in_R, in_ea, MAHA_THRESH_13);
}
void live_update_14(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
update<3, 3, 0>(in_x, in_P, h_14, H_14, NULL, in_z, in_R, in_ea, MAHA_THRESH_14);
}
void live_update_33(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
update<3, 3, 0>(in_x, in_P, h_33, H_33, NULL, in_z, in_R, in_ea, MAHA_THRESH_33);
}
void live_H(double *in_vec, double *out_409344677196790516) {
H(in_vec, out_409344677196790516);
}
void live_err_fun(double *nom_x, double *delta_x, double *out_5410019838797489797) {
err_fun(nom_x, delta_x, out_5410019838797489797);
}
void live_inv_err_fun(double *nom_x, double *true_x, double *out_5107495764560298202) {
inv_err_fun(nom_x, true_x, out_5107495764560298202);
}
void live_H_mod_fun(double *state, double *out_4893943347815461903) {
H_mod_fun(state, out_4893943347815461903);
}
void live_f_fun(double *state, double dt, double *out_1490934551927816954) {
f_fun(state, dt, out_1490934551927816954);
}
void live_F_fun(double *state, double dt, double *out_2062859019570548817) {
F_fun(state, dt, out_2062859019570548817);
}
void live_h_4(double *state, double *unused, double *out_335431168283599212) {
h_4(state, unused, out_335431168283599212);
}
void live_H_4(double *state, double *unused, double *out_4205541147974148351) {
H_4(state, unused, out_4205541147974148351);
}
void live_h_9(double *state, double *unused, double *out_1746837330775165620) {
h_9(state, unused, out_1746837330775165620);
}
void live_H_9(double *state, double *unused, double *out_3964351501344557706) {
H_9(state, unused, out_3964351501344557706);
}
void live_h_10(double *state, double *unused, double *out_6389141055710814361) {
h_10(state, unused, out_6389141055710814361);
}
void live_H_10(double *state, double *unused, double *out_394910773077939482) {
H_10(state, unused, out_394910773077939482);
}
void live_h_12(double *state, double *unused, double *out_4800955541602290447) {
h_12(state, unused, out_4800955541602290447);
}
void live_H_12(double *state, double *unused, double *out_813915260057813444) {
H_12(state, unused, out_813915260057813444);
}
void live_h_35(double *state, double *unused, double *out_8655348954820926857) {
h_35(state, unused, out_8655348954820926857);
}
void live_H_35(double *state, double *unused, double *out_838879090601540975) {
H_35(state, unused, out_838879090601540975);
}
void live_h_32(double *state, double *unused, double *out_7002226014671976453) {
h_32(state, unused, out_7002226014671976453);
}
void live_H_32(double *state, double *unused, double *out_707714305660800506) {
H_32(state, unused, out_707714305660800506);
}
void live_h_13(double *state, double *unused, double *out_6173959503153832213) {
h_13(state, unused, out_6173959503153832213);
}
void live_H_13(double *state, double *unused, double *out_1842862337219813003) {
H_13(state, unused, out_1842862337219813003);
}
void live_h_14(double *state, double *unused, double *out_1746837330775165620) {
h_14(state, unused, out_1746837330775165620);
}
void live_H_14(double *state, double *unused, double *out_3964351501344557706) {
H_14(state, unused, out_3964351501344557706);
}
void live_h_33(double *state, double *unused, double *out_5949943105988094266) {
h_33(state, unused, out_5949943105988094266);
}
void live_H_33(double *state, double *unused, double *out_2311677914037316629) {
H_33(state, unused, out_2311677914037316629);
}
void live_predict(double *in_x, double *in_P, double *in_Q, double dt) {
predict(in_x, in_P, in_Q, dt);
}
}
const EKF live = {
.name = "live",
.kinds = { 4, 9, 10, 12, 35, 32, 13, 14, 33 },
.feature_kinds = { },
.f_fun = live_f_fun,
.F_fun = live_F_fun,
.err_fun = live_err_fun,
.inv_err_fun = live_inv_err_fun,
.H_mod_fun = live_H_mod_fun,
.predict = live_predict,
.hs = {
{ 4, live_h_4 },
{ 9, live_h_9 },
{ 10, live_h_10 },
{ 12, live_h_12 },
{ 35, live_h_35 },
{ 32, live_h_32 },
{ 13, live_h_13 },
{ 14, live_h_14 },
{ 33, live_h_33 },
},
.Hs = {
{ 4, live_H_4 },
{ 9, live_H_9 },
{ 10, live_H_10 },
{ 12, live_H_12 },
{ 35, live_H_35 },
{ 32, live_H_32 },
{ 13, live_H_13 },
{ 14, live_H_14 },
{ 33, live_H_33 },
},
.updates = {
{ 4, live_update_4 },
{ 9, live_update_9 },
{ 10, live_update_10 },
{ 12, live_update_12 },
{ 35, live_update_35 },
{ 32, live_update_32 },
{ 13, live_update_13 },
{ 14, live_update_14 },
{ 33, live_update_33 },
},
.Hes = {
},
.sets = {
},
.extra_routines = {
{ "H", live_H },
},
};
ekf_init(live);