Files
StarPilot/selfdrive/locationd/models/generated/live.cpp
T
2025-04-25 15:19:44 -07: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_2218966030140716596) {
out_2218966030140716596[0] = 0;
out_2218966030140716596[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_2218966030140716596[2] = -sin(in_vec[2])*cos(in_vec[1])*in_vec[3] + cos(in_vec[1])*cos(in_vec[2])*in_vec[4];
out_2218966030140716596[3] = cos(in_vec[1])*cos(in_vec[2]);
out_2218966030140716596[4] = sin(in_vec[2])*cos(in_vec[1]);
out_2218966030140716596[5] = -sin(in_vec[1]);
out_2218966030140716596[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_2218966030140716596[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_2218966030140716596[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_2218966030140716596[9] = sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) - sin(in_vec[2])*cos(in_vec[0]);
out_2218966030140716596[10] = sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) + cos(in_vec[0])*cos(in_vec[2]);
out_2218966030140716596[11] = sin(in_vec[0])*cos(in_vec[1]);
out_2218966030140716596[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_2218966030140716596[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_2218966030140716596[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_2218966030140716596[15] = sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]);
out_2218966030140716596[16] = -sin(in_vec[0])*cos(in_vec[2]) + sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]);
out_2218966030140716596[17] = cos(in_vec[0])*cos(in_vec[1]);
}
void err_fun(double *nom_x, double *delta_x, double *out_6852548703017149274) {
out_6852548703017149274[0] = delta_x[0] + nom_x[0];
out_6852548703017149274[1] = delta_x[1] + nom_x[1];
out_6852548703017149274[2] = delta_x[2] + nom_x[2];
out_6852548703017149274[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_6852548703017149274[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_6852548703017149274[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_6852548703017149274[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_6852548703017149274[7] = delta_x[6] + nom_x[7];
out_6852548703017149274[8] = delta_x[7] + nom_x[8];
out_6852548703017149274[9] = delta_x[8] + nom_x[9];
out_6852548703017149274[10] = delta_x[9] + nom_x[10];
out_6852548703017149274[11] = delta_x[10] + nom_x[11];
out_6852548703017149274[12] = delta_x[11] + nom_x[12];
out_6852548703017149274[13] = delta_x[12] + nom_x[13];
out_6852548703017149274[14] = delta_x[13] + nom_x[14];
out_6852548703017149274[15] = delta_x[14] + nom_x[15];
out_6852548703017149274[16] = delta_x[15] + nom_x[16];
out_6852548703017149274[17] = delta_x[16] + nom_x[17];
out_6852548703017149274[18] = delta_x[17] + nom_x[18];
out_6852548703017149274[19] = delta_x[18] + nom_x[19];
out_6852548703017149274[20] = delta_x[19] + nom_x[20];
out_6852548703017149274[21] = delta_x[20] + nom_x[21];
}
void inv_err_fun(double *nom_x, double *true_x, double *out_34828013283855821) {
out_34828013283855821[0] = -nom_x[0] + true_x[0];
out_34828013283855821[1] = -nom_x[1] + true_x[1];
out_34828013283855821[2] = -nom_x[2] + true_x[2];
out_34828013283855821[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_34828013283855821[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_34828013283855821[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_34828013283855821[6] = -nom_x[7] + true_x[7];
out_34828013283855821[7] = -nom_x[8] + true_x[8];
out_34828013283855821[8] = -nom_x[9] + true_x[9];
out_34828013283855821[9] = -nom_x[10] + true_x[10];
out_34828013283855821[10] = -nom_x[11] + true_x[11];
out_34828013283855821[11] = -nom_x[12] + true_x[12];
out_34828013283855821[12] = -nom_x[13] + true_x[13];
out_34828013283855821[13] = -nom_x[14] + true_x[14];
out_34828013283855821[14] = -nom_x[15] + true_x[15];
out_34828013283855821[15] = -nom_x[16] + true_x[16];
out_34828013283855821[16] = -nom_x[17] + true_x[17];
out_34828013283855821[17] = -nom_x[18] + true_x[18];
out_34828013283855821[18] = -nom_x[19] + true_x[19];
out_34828013283855821[19] = -nom_x[20] + true_x[20];
out_34828013283855821[20] = -nom_x[21] + true_x[21];
}
void H_mod_fun(double *state, double *out_4107758241515201544) {
out_4107758241515201544[0] = 1.0;
out_4107758241515201544[1] = 0;
out_4107758241515201544[2] = 0;
out_4107758241515201544[3] = 0;
out_4107758241515201544[4] = 0;
out_4107758241515201544[5] = 0;
out_4107758241515201544[6] = 0;
out_4107758241515201544[7] = 0;
out_4107758241515201544[8] = 0;
out_4107758241515201544[9] = 0;
out_4107758241515201544[10] = 0;
out_4107758241515201544[11] = 0;
out_4107758241515201544[12] = 0;
out_4107758241515201544[13] = 0;
out_4107758241515201544[14] = 0;
out_4107758241515201544[15] = 0;
out_4107758241515201544[16] = 0;
out_4107758241515201544[17] = 0;
out_4107758241515201544[18] = 0;
out_4107758241515201544[19] = 0;
out_4107758241515201544[20] = 0;
out_4107758241515201544[21] = 0;
out_4107758241515201544[22] = 1.0;
out_4107758241515201544[23] = 0;
out_4107758241515201544[24] = 0;
out_4107758241515201544[25] = 0;
out_4107758241515201544[26] = 0;
out_4107758241515201544[27] = 0;
out_4107758241515201544[28] = 0;
out_4107758241515201544[29] = 0;
out_4107758241515201544[30] = 0;
out_4107758241515201544[31] = 0;
out_4107758241515201544[32] = 0;
out_4107758241515201544[33] = 0;
out_4107758241515201544[34] = 0;
out_4107758241515201544[35] = 0;
out_4107758241515201544[36] = 0;
out_4107758241515201544[37] = 0;
out_4107758241515201544[38] = 0;
out_4107758241515201544[39] = 0;
out_4107758241515201544[40] = 0;
out_4107758241515201544[41] = 0;
out_4107758241515201544[42] = 0;
out_4107758241515201544[43] = 0;
out_4107758241515201544[44] = 1.0;
out_4107758241515201544[45] = 0;
out_4107758241515201544[46] = 0;
out_4107758241515201544[47] = 0;
out_4107758241515201544[48] = 0;
out_4107758241515201544[49] = 0;
out_4107758241515201544[50] = 0;
out_4107758241515201544[51] = 0;
out_4107758241515201544[52] = 0;
out_4107758241515201544[53] = 0;
out_4107758241515201544[54] = 0;
out_4107758241515201544[55] = 0;
out_4107758241515201544[56] = 0;
out_4107758241515201544[57] = 0;
out_4107758241515201544[58] = 0;
out_4107758241515201544[59] = 0;
out_4107758241515201544[60] = 0;
out_4107758241515201544[61] = 0;
out_4107758241515201544[62] = 0;
out_4107758241515201544[63] = 0;
out_4107758241515201544[64] = 0;
out_4107758241515201544[65] = 0;
out_4107758241515201544[66] = -0.5*state[4];
out_4107758241515201544[67] = -0.5*state[5];
out_4107758241515201544[68] = -0.5*state[6];
out_4107758241515201544[69] = 0;
out_4107758241515201544[70] = 0;
out_4107758241515201544[71] = 0;
out_4107758241515201544[72] = 0;
out_4107758241515201544[73] = 0;
out_4107758241515201544[74] = 0;
out_4107758241515201544[75] = 0;
out_4107758241515201544[76] = 0;
out_4107758241515201544[77] = 0;
out_4107758241515201544[78] = 0;
out_4107758241515201544[79] = 0;
out_4107758241515201544[80] = 0;
out_4107758241515201544[81] = 0;
out_4107758241515201544[82] = 0;
out_4107758241515201544[83] = 0;
out_4107758241515201544[84] = 0;
out_4107758241515201544[85] = 0;
out_4107758241515201544[86] = 0;
out_4107758241515201544[87] = 0.5*state[3];
out_4107758241515201544[88] = 0.5*state[6];
out_4107758241515201544[89] = -0.5*state[5];
out_4107758241515201544[90] = 0;
out_4107758241515201544[91] = 0;
out_4107758241515201544[92] = 0;
out_4107758241515201544[93] = 0;
out_4107758241515201544[94] = 0;
out_4107758241515201544[95] = 0;
out_4107758241515201544[96] = 0;
out_4107758241515201544[97] = 0;
out_4107758241515201544[98] = 0;
out_4107758241515201544[99] = 0;
out_4107758241515201544[100] = 0;
out_4107758241515201544[101] = 0;
out_4107758241515201544[102] = 0;
out_4107758241515201544[103] = 0;
out_4107758241515201544[104] = 0;
out_4107758241515201544[105] = 0;
out_4107758241515201544[106] = 0;
out_4107758241515201544[107] = 0;
out_4107758241515201544[108] = -0.5*state[6];
out_4107758241515201544[109] = 0.5*state[3];
out_4107758241515201544[110] = 0.5*state[4];
out_4107758241515201544[111] = 0;
out_4107758241515201544[112] = 0;
out_4107758241515201544[113] = 0;
out_4107758241515201544[114] = 0;
out_4107758241515201544[115] = 0;
out_4107758241515201544[116] = 0;
out_4107758241515201544[117] = 0;
out_4107758241515201544[118] = 0;
out_4107758241515201544[119] = 0;
out_4107758241515201544[120] = 0;
out_4107758241515201544[121] = 0;
out_4107758241515201544[122] = 0;
out_4107758241515201544[123] = 0;
out_4107758241515201544[124] = 0;
out_4107758241515201544[125] = 0;
out_4107758241515201544[126] = 0;
out_4107758241515201544[127] = 0;
out_4107758241515201544[128] = 0;
out_4107758241515201544[129] = 0.5*state[5];
out_4107758241515201544[130] = -0.5*state[4];
out_4107758241515201544[131] = 0.5*state[3];
out_4107758241515201544[132] = 0;
out_4107758241515201544[133] = 0;
out_4107758241515201544[134] = 0;
out_4107758241515201544[135] = 0;
out_4107758241515201544[136] = 0;
out_4107758241515201544[137] = 0;
out_4107758241515201544[138] = 0;
out_4107758241515201544[139] = 0;
out_4107758241515201544[140] = 0;
out_4107758241515201544[141] = 0;
out_4107758241515201544[142] = 0;
out_4107758241515201544[143] = 0;
out_4107758241515201544[144] = 0;
out_4107758241515201544[145] = 0;
out_4107758241515201544[146] = 0;
out_4107758241515201544[147] = 0;
out_4107758241515201544[148] = 0;
out_4107758241515201544[149] = 0;
out_4107758241515201544[150] = 0;
out_4107758241515201544[151] = 0;
out_4107758241515201544[152] = 0;
out_4107758241515201544[153] = 1.0;
out_4107758241515201544[154] = 0;
out_4107758241515201544[155] = 0;
out_4107758241515201544[156] = 0;
out_4107758241515201544[157] = 0;
out_4107758241515201544[158] = 0;
out_4107758241515201544[159] = 0;
out_4107758241515201544[160] = 0;
out_4107758241515201544[161] = 0;
out_4107758241515201544[162] = 0;
out_4107758241515201544[163] = 0;
out_4107758241515201544[164] = 0;
out_4107758241515201544[165] = 0;
out_4107758241515201544[166] = 0;
out_4107758241515201544[167] = 0;
out_4107758241515201544[168] = 0;
out_4107758241515201544[169] = 0;
out_4107758241515201544[170] = 0;
out_4107758241515201544[171] = 0;
out_4107758241515201544[172] = 0;
out_4107758241515201544[173] = 0;
out_4107758241515201544[174] = 0;
out_4107758241515201544[175] = 1.0;
out_4107758241515201544[176] = 0;
out_4107758241515201544[177] = 0;
out_4107758241515201544[178] = 0;
out_4107758241515201544[179] = 0;
out_4107758241515201544[180] = 0;
out_4107758241515201544[181] = 0;
out_4107758241515201544[182] = 0;
out_4107758241515201544[183] = 0;
out_4107758241515201544[184] = 0;
out_4107758241515201544[185] = 0;
out_4107758241515201544[186] = 0;
out_4107758241515201544[187] = 0;
out_4107758241515201544[188] = 0;
out_4107758241515201544[189] = 0;
out_4107758241515201544[190] = 0;
out_4107758241515201544[191] = 0;
out_4107758241515201544[192] = 0;
out_4107758241515201544[193] = 0;
out_4107758241515201544[194] = 0;
out_4107758241515201544[195] = 0;
out_4107758241515201544[196] = 0;
out_4107758241515201544[197] = 1.0;
out_4107758241515201544[198] = 0;
out_4107758241515201544[199] = 0;
out_4107758241515201544[200] = 0;
out_4107758241515201544[201] = 0;
out_4107758241515201544[202] = 0;
out_4107758241515201544[203] = 0;
out_4107758241515201544[204] = 0;
out_4107758241515201544[205] = 0;
out_4107758241515201544[206] = 0;
out_4107758241515201544[207] = 0;
out_4107758241515201544[208] = 0;
out_4107758241515201544[209] = 0;
out_4107758241515201544[210] = 0;
out_4107758241515201544[211] = 0;
out_4107758241515201544[212] = 0;
out_4107758241515201544[213] = 0;
out_4107758241515201544[214] = 0;
out_4107758241515201544[215] = 0;
out_4107758241515201544[216] = 0;
out_4107758241515201544[217] = 0;
out_4107758241515201544[218] = 0;
out_4107758241515201544[219] = 1.0;
out_4107758241515201544[220] = 0;
out_4107758241515201544[221] = 0;
out_4107758241515201544[222] = 0;
out_4107758241515201544[223] = 0;
out_4107758241515201544[224] = 0;
out_4107758241515201544[225] = 0;
out_4107758241515201544[226] = 0;
out_4107758241515201544[227] = 0;
out_4107758241515201544[228] = 0;
out_4107758241515201544[229] = 0;
out_4107758241515201544[230] = 0;
out_4107758241515201544[231] = 0;
out_4107758241515201544[232] = 0;
out_4107758241515201544[233] = 0;
out_4107758241515201544[234] = 0;
out_4107758241515201544[235] = 0;
out_4107758241515201544[236] = 0;
out_4107758241515201544[237] = 0;
out_4107758241515201544[238] = 0;
out_4107758241515201544[239] = 0;
out_4107758241515201544[240] = 0;
out_4107758241515201544[241] = 1.0;
out_4107758241515201544[242] = 0;
out_4107758241515201544[243] = 0;
out_4107758241515201544[244] = 0;
out_4107758241515201544[245] = 0;
out_4107758241515201544[246] = 0;
out_4107758241515201544[247] = 0;
out_4107758241515201544[248] = 0;
out_4107758241515201544[249] = 0;
out_4107758241515201544[250] = 0;
out_4107758241515201544[251] = 0;
out_4107758241515201544[252] = 0;
out_4107758241515201544[253] = 0;
out_4107758241515201544[254] = 0;
out_4107758241515201544[255] = 0;
out_4107758241515201544[256] = 0;
out_4107758241515201544[257] = 0;
out_4107758241515201544[258] = 0;
out_4107758241515201544[259] = 0;
out_4107758241515201544[260] = 0;
out_4107758241515201544[261] = 0;
out_4107758241515201544[262] = 0;
out_4107758241515201544[263] = 1.0;
out_4107758241515201544[264] = 0;
out_4107758241515201544[265] = 0;
out_4107758241515201544[266] = 0;
out_4107758241515201544[267] = 0;
out_4107758241515201544[268] = 0;
out_4107758241515201544[269] = 0;
out_4107758241515201544[270] = 0;
out_4107758241515201544[271] = 0;
out_4107758241515201544[272] = 0;
out_4107758241515201544[273] = 0;
out_4107758241515201544[274] = 0;
out_4107758241515201544[275] = 0;
out_4107758241515201544[276] = 0;
out_4107758241515201544[277] = 0;
out_4107758241515201544[278] = 0;
out_4107758241515201544[279] = 0;
out_4107758241515201544[280] = 0;
out_4107758241515201544[281] = 0;
out_4107758241515201544[282] = 0;
out_4107758241515201544[283] = 0;
out_4107758241515201544[284] = 0;
out_4107758241515201544[285] = 1.0;
out_4107758241515201544[286] = 0;
out_4107758241515201544[287] = 0;
out_4107758241515201544[288] = 0;
out_4107758241515201544[289] = 0;
out_4107758241515201544[290] = 0;
out_4107758241515201544[291] = 0;
out_4107758241515201544[292] = 0;
out_4107758241515201544[293] = 0;
out_4107758241515201544[294] = 0;
out_4107758241515201544[295] = 0;
out_4107758241515201544[296] = 0;
out_4107758241515201544[297] = 0;
out_4107758241515201544[298] = 0;
out_4107758241515201544[299] = 0;
out_4107758241515201544[300] = 0;
out_4107758241515201544[301] = 0;
out_4107758241515201544[302] = 0;
out_4107758241515201544[303] = 0;
out_4107758241515201544[304] = 0;
out_4107758241515201544[305] = 0;
out_4107758241515201544[306] = 0;
out_4107758241515201544[307] = 1.0;
out_4107758241515201544[308] = 0;
out_4107758241515201544[309] = 0;
out_4107758241515201544[310] = 0;
out_4107758241515201544[311] = 0;
out_4107758241515201544[312] = 0;
out_4107758241515201544[313] = 0;
out_4107758241515201544[314] = 0;
out_4107758241515201544[315] = 0;
out_4107758241515201544[316] = 0;
out_4107758241515201544[317] = 0;
out_4107758241515201544[318] = 0;
out_4107758241515201544[319] = 0;
out_4107758241515201544[320] = 0;
out_4107758241515201544[321] = 0;
out_4107758241515201544[322] = 0;
out_4107758241515201544[323] = 0;
out_4107758241515201544[324] = 0;
out_4107758241515201544[325] = 0;
out_4107758241515201544[326] = 0;
out_4107758241515201544[327] = 0;
out_4107758241515201544[328] = 0;
out_4107758241515201544[329] = 1.0;
out_4107758241515201544[330] = 0;
out_4107758241515201544[331] = 0;
out_4107758241515201544[332] = 0;
out_4107758241515201544[333] = 0;
out_4107758241515201544[334] = 0;
out_4107758241515201544[335] = 0;
out_4107758241515201544[336] = 0;
out_4107758241515201544[337] = 0;
out_4107758241515201544[338] = 0;
out_4107758241515201544[339] = 0;
out_4107758241515201544[340] = 0;
out_4107758241515201544[341] = 0;
out_4107758241515201544[342] = 0;
out_4107758241515201544[343] = 0;
out_4107758241515201544[344] = 0;
out_4107758241515201544[345] = 0;
out_4107758241515201544[346] = 0;
out_4107758241515201544[347] = 0;
out_4107758241515201544[348] = 0;
out_4107758241515201544[349] = 0;
out_4107758241515201544[350] = 0;
out_4107758241515201544[351] = 1.0;
out_4107758241515201544[352] = 0;
out_4107758241515201544[353] = 0;
out_4107758241515201544[354] = 0;
out_4107758241515201544[355] = 0;
out_4107758241515201544[356] = 0;
out_4107758241515201544[357] = 0;
out_4107758241515201544[358] = 0;
out_4107758241515201544[359] = 0;
out_4107758241515201544[360] = 0;
out_4107758241515201544[361] = 0;
out_4107758241515201544[362] = 0;
out_4107758241515201544[363] = 0;
out_4107758241515201544[364] = 0;
out_4107758241515201544[365] = 0;
out_4107758241515201544[366] = 0;
out_4107758241515201544[367] = 0;
out_4107758241515201544[368] = 0;
out_4107758241515201544[369] = 0;
out_4107758241515201544[370] = 0;
out_4107758241515201544[371] = 0;
out_4107758241515201544[372] = 0;
out_4107758241515201544[373] = 1.0;
out_4107758241515201544[374] = 0;
out_4107758241515201544[375] = 0;
out_4107758241515201544[376] = 0;
out_4107758241515201544[377] = 0;
out_4107758241515201544[378] = 0;
out_4107758241515201544[379] = 0;
out_4107758241515201544[380] = 0;
out_4107758241515201544[381] = 0;
out_4107758241515201544[382] = 0;
out_4107758241515201544[383] = 0;
out_4107758241515201544[384] = 0;
out_4107758241515201544[385] = 0;
out_4107758241515201544[386] = 0;
out_4107758241515201544[387] = 0;
out_4107758241515201544[388] = 0;
out_4107758241515201544[389] = 0;
out_4107758241515201544[390] = 0;
out_4107758241515201544[391] = 0;
out_4107758241515201544[392] = 0;
out_4107758241515201544[393] = 0;
out_4107758241515201544[394] = 0;
out_4107758241515201544[395] = 1.0;
out_4107758241515201544[396] = 0;
out_4107758241515201544[397] = 0;
out_4107758241515201544[398] = 0;
out_4107758241515201544[399] = 0;
out_4107758241515201544[400] = 0;
out_4107758241515201544[401] = 0;
out_4107758241515201544[402] = 0;
out_4107758241515201544[403] = 0;
out_4107758241515201544[404] = 0;
out_4107758241515201544[405] = 0;
out_4107758241515201544[406] = 0;
out_4107758241515201544[407] = 0;
out_4107758241515201544[408] = 0;
out_4107758241515201544[409] = 0;
out_4107758241515201544[410] = 0;
out_4107758241515201544[411] = 0;
out_4107758241515201544[412] = 0;
out_4107758241515201544[413] = 0;
out_4107758241515201544[414] = 0;
out_4107758241515201544[415] = 0;
out_4107758241515201544[416] = 0;
out_4107758241515201544[417] = 1.0;
out_4107758241515201544[418] = 0;
out_4107758241515201544[419] = 0;
out_4107758241515201544[420] = 0;
out_4107758241515201544[421] = 0;
out_4107758241515201544[422] = 0;
out_4107758241515201544[423] = 0;
out_4107758241515201544[424] = 0;
out_4107758241515201544[425] = 0;
out_4107758241515201544[426] = 0;
out_4107758241515201544[427] = 0;
out_4107758241515201544[428] = 0;
out_4107758241515201544[429] = 0;
out_4107758241515201544[430] = 0;
out_4107758241515201544[431] = 0;
out_4107758241515201544[432] = 0;
out_4107758241515201544[433] = 0;
out_4107758241515201544[434] = 0;
out_4107758241515201544[435] = 0;
out_4107758241515201544[436] = 0;
out_4107758241515201544[437] = 0;
out_4107758241515201544[438] = 0;
out_4107758241515201544[439] = 1.0;
out_4107758241515201544[440] = 0;
out_4107758241515201544[441] = 0;
out_4107758241515201544[442] = 0;
out_4107758241515201544[443] = 0;
out_4107758241515201544[444] = 0;
out_4107758241515201544[445] = 0;
out_4107758241515201544[446] = 0;
out_4107758241515201544[447] = 0;
out_4107758241515201544[448] = 0;
out_4107758241515201544[449] = 0;
out_4107758241515201544[450] = 0;
out_4107758241515201544[451] = 0;
out_4107758241515201544[452] = 0;
out_4107758241515201544[453] = 0;
out_4107758241515201544[454] = 0;
out_4107758241515201544[455] = 0;
out_4107758241515201544[456] = 0;
out_4107758241515201544[457] = 0;
out_4107758241515201544[458] = 0;
out_4107758241515201544[459] = 0;
out_4107758241515201544[460] = 0;
out_4107758241515201544[461] = 1.0;
}
void f_fun(double *state, double dt, double *out_6656309816970046103) {
out_6656309816970046103[0] = dt*state[7] + state[0];
out_6656309816970046103[1] = dt*state[8] + state[1];
out_6656309816970046103[2] = dt*state[9] + state[2];
out_6656309816970046103[3] = dt*(-0.5*state[4]*state[10] - 0.5*state[5]*state[11] - 0.5*state[6]*state[12]) + state[3];
out_6656309816970046103[4] = dt*(0.5*state[3]*state[10] + 0.5*state[5]*state[12] - 0.5*state[6]*state[11]) + state[4];
out_6656309816970046103[5] = dt*(0.5*state[3]*state[11] - 0.5*state[4]*state[12] + 0.5*state[6]*state[10]) + state[5];
out_6656309816970046103[6] = dt*(0.5*state[3]*state[12] + 0.5*state[4]*state[11] - 0.5*state[5]*state[10]) + state[6];
out_6656309816970046103[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_6656309816970046103[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_6656309816970046103[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_6656309816970046103[10] = state[10];
out_6656309816970046103[11] = state[11];
out_6656309816970046103[12] = state[12];
out_6656309816970046103[13] = state[13];
out_6656309816970046103[14] = state[14];
out_6656309816970046103[15] = state[15];
out_6656309816970046103[16] = state[16];
out_6656309816970046103[17] = state[17];
out_6656309816970046103[18] = state[18];
out_6656309816970046103[19] = state[19];
out_6656309816970046103[20] = state[20];
out_6656309816970046103[21] = state[21];
}
void F_fun(double *state, double dt, double *out_80746007831088834) {
out_80746007831088834[0] = 1;
out_80746007831088834[1] = 0;
out_80746007831088834[2] = 0;
out_80746007831088834[3] = 0;
out_80746007831088834[4] = 0;
out_80746007831088834[5] = 0;
out_80746007831088834[6] = dt;
out_80746007831088834[7] = 0;
out_80746007831088834[8] = 0;
out_80746007831088834[9] = 0;
out_80746007831088834[10] = 0;
out_80746007831088834[11] = 0;
out_80746007831088834[12] = 0;
out_80746007831088834[13] = 0;
out_80746007831088834[14] = 0;
out_80746007831088834[15] = 0;
out_80746007831088834[16] = 0;
out_80746007831088834[17] = 0;
out_80746007831088834[18] = 0;
out_80746007831088834[19] = 0;
out_80746007831088834[20] = 0;
out_80746007831088834[21] = 0;
out_80746007831088834[22] = 1;
out_80746007831088834[23] = 0;
out_80746007831088834[24] = 0;
out_80746007831088834[25] = 0;
out_80746007831088834[26] = 0;
out_80746007831088834[27] = 0;
out_80746007831088834[28] = dt;
out_80746007831088834[29] = 0;
out_80746007831088834[30] = 0;
out_80746007831088834[31] = 0;
out_80746007831088834[32] = 0;
out_80746007831088834[33] = 0;
out_80746007831088834[34] = 0;
out_80746007831088834[35] = 0;
out_80746007831088834[36] = 0;
out_80746007831088834[37] = 0;
out_80746007831088834[38] = 0;
out_80746007831088834[39] = 0;
out_80746007831088834[40] = 0;
out_80746007831088834[41] = 0;
out_80746007831088834[42] = 0;
out_80746007831088834[43] = 0;
out_80746007831088834[44] = 1;
out_80746007831088834[45] = 0;
out_80746007831088834[46] = 0;
out_80746007831088834[47] = 0;
out_80746007831088834[48] = 0;
out_80746007831088834[49] = 0;
out_80746007831088834[50] = dt;
out_80746007831088834[51] = 0;
out_80746007831088834[52] = 0;
out_80746007831088834[53] = 0;
out_80746007831088834[54] = 0;
out_80746007831088834[55] = 0;
out_80746007831088834[56] = 0;
out_80746007831088834[57] = 0;
out_80746007831088834[58] = 0;
out_80746007831088834[59] = 0;
out_80746007831088834[60] = 0;
out_80746007831088834[61] = 0;
out_80746007831088834[62] = 0;
out_80746007831088834[63] = 0;
out_80746007831088834[64] = 0;
out_80746007831088834[65] = 0;
out_80746007831088834[66] = 1;
out_80746007831088834[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_80746007831088834[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_80746007831088834[69] = 0;
out_80746007831088834[70] = 0;
out_80746007831088834[71] = 0;
out_80746007831088834[72] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2));
out_80746007831088834[73] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]);
out_80746007831088834[74] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]);
out_80746007831088834[75] = 0;
out_80746007831088834[76] = 0;
out_80746007831088834[77] = 0;
out_80746007831088834[78] = 0;
out_80746007831088834[79] = 0;
out_80746007831088834[80] = 0;
out_80746007831088834[81] = 0;
out_80746007831088834[82] = 0;
out_80746007831088834[83] = 0;
out_80746007831088834[84] = 0;
out_80746007831088834[85] = 0;
out_80746007831088834[86] = 0;
out_80746007831088834[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_80746007831088834[88] = 1;
out_80746007831088834[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_80746007831088834[90] = 0;
out_80746007831088834[91] = 0;
out_80746007831088834[92] = 0;
out_80746007831088834[93] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]);
out_80746007831088834[94] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2));
out_80746007831088834[95] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]);
out_80746007831088834[96] = 0;
out_80746007831088834[97] = 0;
out_80746007831088834[98] = 0;
out_80746007831088834[99] = 0;
out_80746007831088834[100] = 0;
out_80746007831088834[101] = 0;
out_80746007831088834[102] = 0;
out_80746007831088834[103] = 0;
out_80746007831088834[104] = 0;
out_80746007831088834[105] = 0;
out_80746007831088834[106] = 0;
out_80746007831088834[107] = 0;
out_80746007831088834[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_80746007831088834[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_80746007831088834[110] = 1;
out_80746007831088834[111] = 0;
out_80746007831088834[112] = 0;
out_80746007831088834[113] = 0;
out_80746007831088834[114] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]);
out_80746007831088834[115] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]);
out_80746007831088834[116] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2));
out_80746007831088834[117] = 0;
out_80746007831088834[118] = 0;
out_80746007831088834[119] = 0;
out_80746007831088834[120] = 0;
out_80746007831088834[121] = 0;
out_80746007831088834[122] = 0;
out_80746007831088834[123] = 0;
out_80746007831088834[124] = 0;
out_80746007831088834[125] = 0;
out_80746007831088834[126] = 0;
out_80746007831088834[127] = 0;
out_80746007831088834[128] = 0;
out_80746007831088834[129] = 0;
out_80746007831088834[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_80746007831088834[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_80746007831088834[132] = 1;
out_80746007831088834[133] = 0;
out_80746007831088834[134] = 0;
out_80746007831088834[135] = 0;
out_80746007831088834[136] = 0;
out_80746007831088834[137] = 0;
out_80746007831088834[138] = 0;
out_80746007831088834[139] = 0;
out_80746007831088834[140] = 0;
out_80746007831088834[141] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2));
out_80746007831088834[142] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]);
out_80746007831088834[143] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]);
out_80746007831088834[144] = 0;
out_80746007831088834[145] = 0;
out_80746007831088834[146] = 0;
out_80746007831088834[147] = 0;
out_80746007831088834[148] = 0;
out_80746007831088834[149] = 0;
out_80746007831088834[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_80746007831088834[151] = 0;
out_80746007831088834[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_80746007831088834[153] = 0;
out_80746007831088834[154] = 1;
out_80746007831088834[155] = 0;
out_80746007831088834[156] = 0;
out_80746007831088834[157] = 0;
out_80746007831088834[158] = 0;
out_80746007831088834[159] = 0;
out_80746007831088834[160] = 0;
out_80746007831088834[161] = 0;
out_80746007831088834[162] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]);
out_80746007831088834[163] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2));
out_80746007831088834[164] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]);
out_80746007831088834[165] = 0;
out_80746007831088834[166] = 0;
out_80746007831088834[167] = 0;
out_80746007831088834[168] = 0;
out_80746007831088834[169] = 0;
out_80746007831088834[170] = 0;
out_80746007831088834[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_80746007831088834[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_80746007831088834[173] = 0;
out_80746007831088834[174] = 0;
out_80746007831088834[175] = 0;
out_80746007831088834[176] = 1;
out_80746007831088834[177] = 0;
out_80746007831088834[178] = 0;
out_80746007831088834[179] = 0;
out_80746007831088834[180] = 0;
out_80746007831088834[181] = 0;
out_80746007831088834[182] = 0;
out_80746007831088834[183] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]);
out_80746007831088834[184] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]);
out_80746007831088834[185] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2));
out_80746007831088834[186] = 0;
out_80746007831088834[187] = 0;
out_80746007831088834[188] = 0;
out_80746007831088834[189] = 0;
out_80746007831088834[190] = 0;
out_80746007831088834[191] = 0;
out_80746007831088834[192] = 0;
out_80746007831088834[193] = 0;
out_80746007831088834[194] = 0;
out_80746007831088834[195] = 0;
out_80746007831088834[196] = 0;
out_80746007831088834[197] = 0;
out_80746007831088834[198] = 1;
out_80746007831088834[199] = 0;
out_80746007831088834[200] = 0;
out_80746007831088834[201] = 0;
out_80746007831088834[202] = 0;
out_80746007831088834[203] = 0;
out_80746007831088834[204] = 0;
out_80746007831088834[205] = 0;
out_80746007831088834[206] = 0;
out_80746007831088834[207] = 0;
out_80746007831088834[208] = 0;
out_80746007831088834[209] = 0;
out_80746007831088834[210] = 0;
out_80746007831088834[211] = 0;
out_80746007831088834[212] = 0;
out_80746007831088834[213] = 0;
out_80746007831088834[214] = 0;
out_80746007831088834[215] = 0;
out_80746007831088834[216] = 0;
out_80746007831088834[217] = 0;
out_80746007831088834[218] = 0;
out_80746007831088834[219] = 0;
out_80746007831088834[220] = 1;
out_80746007831088834[221] = 0;
out_80746007831088834[222] = 0;
out_80746007831088834[223] = 0;
out_80746007831088834[224] = 0;
out_80746007831088834[225] = 0;
out_80746007831088834[226] = 0;
out_80746007831088834[227] = 0;
out_80746007831088834[228] = 0;
out_80746007831088834[229] = 0;
out_80746007831088834[230] = 0;
out_80746007831088834[231] = 0;
out_80746007831088834[232] = 0;
out_80746007831088834[233] = 0;
out_80746007831088834[234] = 0;
out_80746007831088834[235] = 0;
out_80746007831088834[236] = 0;
out_80746007831088834[237] = 0;
out_80746007831088834[238] = 0;
out_80746007831088834[239] = 0;
out_80746007831088834[240] = 0;
out_80746007831088834[241] = 0;
out_80746007831088834[242] = 1;
out_80746007831088834[243] = 0;
out_80746007831088834[244] = 0;
out_80746007831088834[245] = 0;
out_80746007831088834[246] = 0;
out_80746007831088834[247] = 0;
out_80746007831088834[248] = 0;
out_80746007831088834[249] = 0;
out_80746007831088834[250] = 0;
out_80746007831088834[251] = 0;
out_80746007831088834[252] = 0;
out_80746007831088834[253] = 0;
out_80746007831088834[254] = 0;
out_80746007831088834[255] = 0;
out_80746007831088834[256] = 0;
out_80746007831088834[257] = 0;
out_80746007831088834[258] = 0;
out_80746007831088834[259] = 0;
out_80746007831088834[260] = 0;
out_80746007831088834[261] = 0;
out_80746007831088834[262] = 0;
out_80746007831088834[263] = 0;
out_80746007831088834[264] = 1;
out_80746007831088834[265] = 0;
out_80746007831088834[266] = 0;
out_80746007831088834[267] = 0;
out_80746007831088834[268] = 0;
out_80746007831088834[269] = 0;
out_80746007831088834[270] = 0;
out_80746007831088834[271] = 0;
out_80746007831088834[272] = 0;
out_80746007831088834[273] = 0;
out_80746007831088834[274] = 0;
out_80746007831088834[275] = 0;
out_80746007831088834[276] = 0;
out_80746007831088834[277] = 0;
out_80746007831088834[278] = 0;
out_80746007831088834[279] = 0;
out_80746007831088834[280] = 0;
out_80746007831088834[281] = 0;
out_80746007831088834[282] = 0;
out_80746007831088834[283] = 0;
out_80746007831088834[284] = 0;
out_80746007831088834[285] = 0;
out_80746007831088834[286] = 1;
out_80746007831088834[287] = 0;
out_80746007831088834[288] = 0;
out_80746007831088834[289] = 0;
out_80746007831088834[290] = 0;
out_80746007831088834[291] = 0;
out_80746007831088834[292] = 0;
out_80746007831088834[293] = 0;
out_80746007831088834[294] = 0;
out_80746007831088834[295] = 0;
out_80746007831088834[296] = 0;
out_80746007831088834[297] = 0;
out_80746007831088834[298] = 0;
out_80746007831088834[299] = 0;
out_80746007831088834[300] = 0;
out_80746007831088834[301] = 0;
out_80746007831088834[302] = 0;
out_80746007831088834[303] = 0;
out_80746007831088834[304] = 0;
out_80746007831088834[305] = 0;
out_80746007831088834[306] = 0;
out_80746007831088834[307] = 0;
out_80746007831088834[308] = 1;
out_80746007831088834[309] = 0;
out_80746007831088834[310] = 0;
out_80746007831088834[311] = 0;
out_80746007831088834[312] = 0;
out_80746007831088834[313] = 0;
out_80746007831088834[314] = 0;
out_80746007831088834[315] = 0;
out_80746007831088834[316] = 0;
out_80746007831088834[317] = 0;
out_80746007831088834[318] = 0;
out_80746007831088834[319] = 0;
out_80746007831088834[320] = 0;
out_80746007831088834[321] = 0;
out_80746007831088834[322] = 0;
out_80746007831088834[323] = 0;
out_80746007831088834[324] = 0;
out_80746007831088834[325] = 0;
out_80746007831088834[326] = 0;
out_80746007831088834[327] = 0;
out_80746007831088834[328] = 0;
out_80746007831088834[329] = 0;
out_80746007831088834[330] = 1;
out_80746007831088834[331] = 0;
out_80746007831088834[332] = 0;
out_80746007831088834[333] = 0;
out_80746007831088834[334] = 0;
out_80746007831088834[335] = 0;
out_80746007831088834[336] = 0;
out_80746007831088834[337] = 0;
out_80746007831088834[338] = 0;
out_80746007831088834[339] = 0;
out_80746007831088834[340] = 0;
out_80746007831088834[341] = 0;
out_80746007831088834[342] = 0;
out_80746007831088834[343] = 0;
out_80746007831088834[344] = 0;
out_80746007831088834[345] = 0;
out_80746007831088834[346] = 0;
out_80746007831088834[347] = 0;
out_80746007831088834[348] = 0;
out_80746007831088834[349] = 0;
out_80746007831088834[350] = 0;
out_80746007831088834[351] = 0;
out_80746007831088834[352] = 1;
out_80746007831088834[353] = 0;
out_80746007831088834[354] = 0;
out_80746007831088834[355] = 0;
out_80746007831088834[356] = 0;
out_80746007831088834[357] = 0;
out_80746007831088834[358] = 0;
out_80746007831088834[359] = 0;
out_80746007831088834[360] = 0;
out_80746007831088834[361] = 0;
out_80746007831088834[362] = 0;
out_80746007831088834[363] = 0;
out_80746007831088834[364] = 0;
out_80746007831088834[365] = 0;
out_80746007831088834[366] = 0;
out_80746007831088834[367] = 0;
out_80746007831088834[368] = 0;
out_80746007831088834[369] = 0;
out_80746007831088834[370] = 0;
out_80746007831088834[371] = 0;
out_80746007831088834[372] = 0;
out_80746007831088834[373] = 0;
out_80746007831088834[374] = 1;
out_80746007831088834[375] = 0;
out_80746007831088834[376] = 0;
out_80746007831088834[377] = 0;
out_80746007831088834[378] = 0;
out_80746007831088834[379] = 0;
out_80746007831088834[380] = 0;
out_80746007831088834[381] = 0;
out_80746007831088834[382] = 0;
out_80746007831088834[383] = 0;
out_80746007831088834[384] = 0;
out_80746007831088834[385] = 0;
out_80746007831088834[386] = 0;
out_80746007831088834[387] = 0;
out_80746007831088834[388] = 0;
out_80746007831088834[389] = 0;
out_80746007831088834[390] = 0;
out_80746007831088834[391] = 0;
out_80746007831088834[392] = 0;
out_80746007831088834[393] = 0;
out_80746007831088834[394] = 0;
out_80746007831088834[395] = 0;
out_80746007831088834[396] = 1;
out_80746007831088834[397] = 0;
out_80746007831088834[398] = 0;
out_80746007831088834[399] = 0;
out_80746007831088834[400] = 0;
out_80746007831088834[401] = 0;
out_80746007831088834[402] = 0;
out_80746007831088834[403] = 0;
out_80746007831088834[404] = 0;
out_80746007831088834[405] = 0;
out_80746007831088834[406] = 0;
out_80746007831088834[407] = 0;
out_80746007831088834[408] = 0;
out_80746007831088834[409] = 0;
out_80746007831088834[410] = 0;
out_80746007831088834[411] = 0;
out_80746007831088834[412] = 0;
out_80746007831088834[413] = 0;
out_80746007831088834[414] = 0;
out_80746007831088834[415] = 0;
out_80746007831088834[416] = 0;
out_80746007831088834[417] = 0;
out_80746007831088834[418] = 1;
out_80746007831088834[419] = 0;
out_80746007831088834[420] = 0;
out_80746007831088834[421] = 0;
out_80746007831088834[422] = 0;
out_80746007831088834[423] = 0;
out_80746007831088834[424] = 0;
out_80746007831088834[425] = 0;
out_80746007831088834[426] = 0;
out_80746007831088834[427] = 0;
out_80746007831088834[428] = 0;
out_80746007831088834[429] = 0;
out_80746007831088834[430] = 0;
out_80746007831088834[431] = 0;
out_80746007831088834[432] = 0;
out_80746007831088834[433] = 0;
out_80746007831088834[434] = 0;
out_80746007831088834[435] = 0;
out_80746007831088834[436] = 0;
out_80746007831088834[437] = 0;
out_80746007831088834[438] = 0;
out_80746007831088834[439] = 0;
out_80746007831088834[440] = 1;
}
void h_4(double *state, double *unused, double *out_3708977988177987000) {
out_3708977988177987000[0] = state[10] + state[13];
out_3708977988177987000[1] = state[11] + state[14];
out_3708977988177987000[2] = state[12] + state[15];
}
void H_4(double *state, double *unused, double *out_5228477197578876073) {
out_5228477197578876073[0] = 0;
out_5228477197578876073[1] = 0;
out_5228477197578876073[2] = 0;
out_5228477197578876073[3] = 0;
out_5228477197578876073[4] = 0;
out_5228477197578876073[5] = 0;
out_5228477197578876073[6] = 0;
out_5228477197578876073[7] = 0;
out_5228477197578876073[8] = 0;
out_5228477197578876073[9] = 0;
out_5228477197578876073[10] = 1;
out_5228477197578876073[11] = 0;
out_5228477197578876073[12] = 0;
out_5228477197578876073[13] = 1;
out_5228477197578876073[14] = 0;
out_5228477197578876073[15] = 0;
out_5228477197578876073[16] = 0;
out_5228477197578876073[17] = 0;
out_5228477197578876073[18] = 0;
out_5228477197578876073[19] = 0;
out_5228477197578876073[20] = 0;
out_5228477197578876073[21] = 0;
out_5228477197578876073[22] = 0;
out_5228477197578876073[23] = 0;
out_5228477197578876073[24] = 0;
out_5228477197578876073[25] = 0;
out_5228477197578876073[26] = 0;
out_5228477197578876073[27] = 0;
out_5228477197578876073[28] = 0;
out_5228477197578876073[29] = 0;
out_5228477197578876073[30] = 0;
out_5228477197578876073[31] = 0;
out_5228477197578876073[32] = 0;
out_5228477197578876073[33] = 1;
out_5228477197578876073[34] = 0;
out_5228477197578876073[35] = 0;
out_5228477197578876073[36] = 1;
out_5228477197578876073[37] = 0;
out_5228477197578876073[38] = 0;
out_5228477197578876073[39] = 0;
out_5228477197578876073[40] = 0;
out_5228477197578876073[41] = 0;
out_5228477197578876073[42] = 0;
out_5228477197578876073[43] = 0;
out_5228477197578876073[44] = 0;
out_5228477197578876073[45] = 0;
out_5228477197578876073[46] = 0;
out_5228477197578876073[47] = 0;
out_5228477197578876073[48] = 0;
out_5228477197578876073[49] = 0;
out_5228477197578876073[50] = 0;
out_5228477197578876073[51] = 0;
out_5228477197578876073[52] = 0;
out_5228477197578876073[53] = 0;
out_5228477197578876073[54] = 0;
out_5228477197578876073[55] = 0;
out_5228477197578876073[56] = 1;
out_5228477197578876073[57] = 0;
out_5228477197578876073[58] = 0;
out_5228477197578876073[59] = 1;
out_5228477197578876073[60] = 0;
out_5228477197578876073[61] = 0;
out_5228477197578876073[62] = 0;
out_5228477197578876073[63] = 0;
out_5228477197578876073[64] = 0;
out_5228477197578876073[65] = 0;
}
void h_9(double *state, double *unused, double *out_1694555683566656782) {
out_1694555683566656782[0] = state[10];
out_1694555683566656782[1] = state[11];
out_1694555683566656782[2] = state[12];
}
void H_9(double *state, double *unused, double *out_5931047940866228073) {
out_5931047940866228073[0] = 0;
out_5931047940866228073[1] = 0;
out_5931047940866228073[2] = 0;
out_5931047940866228073[3] = 0;
out_5931047940866228073[4] = 0;
out_5931047940866228073[5] = 0;
out_5931047940866228073[6] = 0;
out_5931047940866228073[7] = 0;
out_5931047940866228073[8] = 0;
out_5931047940866228073[9] = 0;
out_5931047940866228073[10] = 1;
out_5931047940866228073[11] = 0;
out_5931047940866228073[12] = 0;
out_5931047940866228073[13] = 0;
out_5931047940866228073[14] = 0;
out_5931047940866228073[15] = 0;
out_5931047940866228073[16] = 0;
out_5931047940866228073[17] = 0;
out_5931047940866228073[18] = 0;
out_5931047940866228073[19] = 0;
out_5931047940866228073[20] = 0;
out_5931047940866228073[21] = 0;
out_5931047940866228073[22] = 0;
out_5931047940866228073[23] = 0;
out_5931047940866228073[24] = 0;
out_5931047940866228073[25] = 0;
out_5931047940866228073[26] = 0;
out_5931047940866228073[27] = 0;
out_5931047940866228073[28] = 0;
out_5931047940866228073[29] = 0;
out_5931047940866228073[30] = 0;
out_5931047940866228073[31] = 0;
out_5931047940866228073[32] = 0;
out_5931047940866228073[33] = 1;
out_5931047940866228073[34] = 0;
out_5931047940866228073[35] = 0;
out_5931047940866228073[36] = 0;
out_5931047940866228073[37] = 0;
out_5931047940866228073[38] = 0;
out_5931047940866228073[39] = 0;
out_5931047940866228073[40] = 0;
out_5931047940866228073[41] = 0;
out_5931047940866228073[42] = 0;
out_5931047940866228073[43] = 0;
out_5931047940866228073[44] = 0;
out_5931047940866228073[45] = 0;
out_5931047940866228073[46] = 0;
out_5931047940866228073[47] = 0;
out_5931047940866228073[48] = 0;
out_5931047940866228073[49] = 0;
out_5931047940866228073[50] = 0;
out_5931047940866228073[51] = 0;
out_5931047940866228073[52] = 0;
out_5931047940866228073[53] = 0;
out_5931047940866228073[54] = 0;
out_5931047940866228073[55] = 0;
out_5931047940866228073[56] = 1;
out_5931047940866228073[57] = 0;
out_5931047940866228073[58] = 0;
out_5931047940866228073[59] = 0;
out_5931047940866228073[60] = 0;
out_5931047940866228073[61] = 0;
out_5931047940866228073[62] = 0;
out_5931047940866228073[63] = 0;
out_5931047940866228073[64] = 0;
out_5931047940866228073[65] = 0;
}
void h_10(double *state, double *unused, double *out_7331102441041093151) {
out_7331102441041093151[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_7331102441041093151[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_7331102441041093151[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_5698089998383746497) {
out_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[7] = 0;
out_5698089998383746497[8] = 0;
out_5698089998383746497[9] = 0;
out_5698089998383746497[10] = 0;
out_5698089998383746497[11] = 0;
out_5698089998383746497[12] = 0;
out_5698089998383746497[13] = 0;
out_5698089998383746497[14] = 0;
out_5698089998383746497[15] = 0;
out_5698089998383746497[16] = 1;
out_5698089998383746497[17] = 0;
out_5698089998383746497[18] = 0;
out_5698089998383746497[19] = 1;
out_5698089998383746497[20] = 0;
out_5698089998383746497[21] = 0;
out_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[29] = 0;
out_5698089998383746497[30] = 0;
out_5698089998383746497[31] = 0;
out_5698089998383746497[32] = 0;
out_5698089998383746497[33] = 0;
out_5698089998383746497[34] = 0;
out_5698089998383746497[35] = 0;
out_5698089998383746497[36] = 0;
out_5698089998383746497[37] = 0;
out_5698089998383746497[38] = 0;
out_5698089998383746497[39] = 1;
out_5698089998383746497[40] = 0;
out_5698089998383746497[41] = 0;
out_5698089998383746497[42] = 1;
out_5698089998383746497[43] = 0;
out_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[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_5698089998383746497[51] = 0;
out_5698089998383746497[52] = 0;
out_5698089998383746497[53] = 0;
out_5698089998383746497[54] = 0;
out_5698089998383746497[55] = 0;
out_5698089998383746497[56] = 0;
out_5698089998383746497[57] = 0;
out_5698089998383746497[58] = 0;
out_5698089998383746497[59] = 0;
out_5698089998383746497[60] = 0;
out_5698089998383746497[61] = 0;
out_5698089998383746497[62] = 1;
out_5698089998383746497[63] = 0;
out_5698089998383746497[64] = 0;
out_5698089998383746497[65] = 1;
}
void h_12(double *state, double *unused, double *out_2025459526882919185) {
out_2025459526882919185[0] = state[0];
out_2025459526882919185[1] = state[1];
out_2025459526882919185[2] = state[2];
}
void H_12(double *state, double *unused, double *out_5551138562448225051) {
out_5551138562448225051[0] = 1;
out_5551138562448225051[1] = 0;
out_5551138562448225051[2] = 0;
out_5551138562448225051[3] = 0;
out_5551138562448225051[4] = 0;
out_5551138562448225051[5] = 0;
out_5551138562448225051[6] = 0;
out_5551138562448225051[7] = 0;
out_5551138562448225051[8] = 0;
out_5551138562448225051[9] = 0;
out_5551138562448225051[10] = 0;
out_5551138562448225051[11] = 0;
out_5551138562448225051[12] = 0;
out_5551138562448225051[13] = 0;
out_5551138562448225051[14] = 0;
out_5551138562448225051[15] = 0;
out_5551138562448225051[16] = 0;
out_5551138562448225051[17] = 0;
out_5551138562448225051[18] = 0;
out_5551138562448225051[19] = 0;
out_5551138562448225051[20] = 0;
out_5551138562448225051[21] = 0;
out_5551138562448225051[22] = 0;
out_5551138562448225051[23] = 1;
out_5551138562448225051[24] = 0;
out_5551138562448225051[25] = 0;
out_5551138562448225051[26] = 0;
out_5551138562448225051[27] = 0;
out_5551138562448225051[28] = 0;
out_5551138562448225051[29] = 0;
out_5551138562448225051[30] = 0;
out_5551138562448225051[31] = 0;
out_5551138562448225051[32] = 0;
out_5551138562448225051[33] = 0;
out_5551138562448225051[34] = 0;
out_5551138562448225051[35] = 0;
out_5551138562448225051[36] = 0;
out_5551138562448225051[37] = 0;
out_5551138562448225051[38] = 0;
out_5551138562448225051[39] = 0;
out_5551138562448225051[40] = 0;
out_5551138562448225051[41] = 0;
out_5551138562448225051[42] = 0;
out_5551138562448225051[43] = 0;
out_5551138562448225051[44] = 0;
out_5551138562448225051[45] = 0;
out_5551138562448225051[46] = 1;
out_5551138562448225051[47] = 0;
out_5551138562448225051[48] = 0;
out_5551138562448225051[49] = 0;
out_5551138562448225051[50] = 0;
out_5551138562448225051[51] = 0;
out_5551138562448225051[52] = 0;
out_5551138562448225051[53] = 0;
out_5551138562448225051[54] = 0;
out_5551138562448225051[55] = 0;
out_5551138562448225051[56] = 0;
out_5551138562448225051[57] = 0;
out_5551138562448225051[58] = 0;
out_5551138562448225051[59] = 0;
out_5551138562448225051[60] = 0;
out_5551138562448225051[61] = 0;
out_5551138562448225051[62] = 0;
out_5551138562448225051[63] = 0;
out_5551138562448225051[64] = 0;
out_5551138562448225051[65] = 0;
}
void h_35(double *state, double *unused, double *out_1095160992943407657) {
out_1095160992943407657[0] = state[7];
out_1095160992943407657[1] = state[8];
out_1095160992943407657[2] = state[9];
}
void H_35(double *state, double *unused, double *out_8595139254951483449) {
out_8595139254951483449[0] = 0;
out_8595139254951483449[1] = 0;
out_8595139254951483449[2] = 0;
out_8595139254951483449[3] = 0;
out_8595139254951483449[4] = 0;
out_8595139254951483449[5] = 0;
out_8595139254951483449[6] = 0;
out_8595139254951483449[7] = 1;
out_8595139254951483449[8] = 0;
out_8595139254951483449[9] = 0;
out_8595139254951483449[10] = 0;
out_8595139254951483449[11] = 0;
out_8595139254951483449[12] = 0;
out_8595139254951483449[13] = 0;
out_8595139254951483449[14] = 0;
out_8595139254951483449[15] = 0;
out_8595139254951483449[16] = 0;
out_8595139254951483449[17] = 0;
out_8595139254951483449[18] = 0;
out_8595139254951483449[19] = 0;
out_8595139254951483449[20] = 0;
out_8595139254951483449[21] = 0;
out_8595139254951483449[22] = 0;
out_8595139254951483449[23] = 0;
out_8595139254951483449[24] = 0;
out_8595139254951483449[25] = 0;
out_8595139254951483449[26] = 0;
out_8595139254951483449[27] = 0;
out_8595139254951483449[28] = 0;
out_8595139254951483449[29] = 0;
out_8595139254951483449[30] = 1;
out_8595139254951483449[31] = 0;
out_8595139254951483449[32] = 0;
out_8595139254951483449[33] = 0;
out_8595139254951483449[34] = 0;
out_8595139254951483449[35] = 0;
out_8595139254951483449[36] = 0;
out_8595139254951483449[37] = 0;
out_8595139254951483449[38] = 0;
out_8595139254951483449[39] = 0;
out_8595139254951483449[40] = 0;
out_8595139254951483449[41] = 0;
out_8595139254951483449[42] = 0;
out_8595139254951483449[43] = 0;
out_8595139254951483449[44] = 0;
out_8595139254951483449[45] = 0;
out_8595139254951483449[46] = 0;
out_8595139254951483449[47] = 0;
out_8595139254951483449[48] = 0;
out_8595139254951483449[49] = 0;
out_8595139254951483449[50] = 0;
out_8595139254951483449[51] = 0;
out_8595139254951483449[52] = 0;
out_8595139254951483449[53] = 1;
out_8595139254951483449[54] = 0;
out_8595139254951483449[55] = 0;
out_8595139254951483449[56] = 0;
out_8595139254951483449[57] = 0;
out_8595139254951483449[58] = 0;
out_8595139254951483449[59] = 0;
out_8595139254951483449[60] = 0;
out_8595139254951483449[61] = 0;
out_8595139254951483449[62] = 0;
out_8595139254951483449[63] = 0;
out_8595139254951483449[64] = 0;
out_8595139254951483449[65] = 0;
}
void h_32(double *state, double *unused, double *out_93682492082407536) {
out_93682492082407536[0] = state[3];
out_93682492082407536[1] = state[4];
out_93682492082407536[2] = state[5];
out_93682492082407536[3] = state[6];
}
void H_32(double *state, double *unused, double *out_8726304039892223918) {
out_8726304039892223918[0] = 0;
out_8726304039892223918[1] = 0;
out_8726304039892223918[2] = 0;
out_8726304039892223918[3] = 1;
out_8726304039892223918[4] = 0;
out_8726304039892223918[5] = 0;
out_8726304039892223918[6] = 0;
out_8726304039892223918[7] = 0;
out_8726304039892223918[8] = 0;
out_8726304039892223918[9] = 0;
out_8726304039892223918[10] = 0;
out_8726304039892223918[11] = 0;
out_8726304039892223918[12] = 0;
out_8726304039892223918[13] = 0;
out_8726304039892223918[14] = 0;
out_8726304039892223918[15] = 0;
out_8726304039892223918[16] = 0;
out_8726304039892223918[17] = 0;
out_8726304039892223918[18] = 0;
out_8726304039892223918[19] = 0;
out_8726304039892223918[20] = 0;
out_8726304039892223918[21] = 0;
out_8726304039892223918[22] = 0;
out_8726304039892223918[23] = 0;
out_8726304039892223918[24] = 0;
out_8726304039892223918[25] = 0;
out_8726304039892223918[26] = 1;
out_8726304039892223918[27] = 0;
out_8726304039892223918[28] = 0;
out_8726304039892223918[29] = 0;
out_8726304039892223918[30] = 0;
out_8726304039892223918[31] = 0;
out_8726304039892223918[32] = 0;
out_8726304039892223918[33] = 0;
out_8726304039892223918[34] = 0;
out_8726304039892223918[35] = 0;
out_8726304039892223918[36] = 0;
out_8726304039892223918[37] = 0;
out_8726304039892223918[38] = 0;
out_8726304039892223918[39] = 0;
out_8726304039892223918[40] = 0;
out_8726304039892223918[41] = 0;
out_8726304039892223918[42] = 0;
out_8726304039892223918[43] = 0;
out_8726304039892223918[44] = 0;
out_8726304039892223918[45] = 0;
out_8726304039892223918[46] = 0;
out_8726304039892223918[47] = 0;
out_8726304039892223918[48] = 0;
out_8726304039892223918[49] = 1;
out_8726304039892223918[50] = 0;
out_8726304039892223918[51] = 0;
out_8726304039892223918[52] = 0;
out_8726304039892223918[53] = 0;
out_8726304039892223918[54] = 0;
out_8726304039892223918[55] = 0;
out_8726304039892223918[56] = 0;
out_8726304039892223918[57] = 0;
out_8726304039892223918[58] = 0;
out_8726304039892223918[59] = 0;
out_8726304039892223918[60] = 0;
out_8726304039892223918[61] = 0;
out_8726304039892223918[62] = 0;
out_8726304039892223918[63] = 0;
out_8726304039892223918[64] = 0;
out_8726304039892223918[65] = 0;
out_8726304039892223918[66] = 0;
out_8726304039892223918[67] = 0;
out_8726304039892223918[68] = 0;
out_8726304039892223918[69] = 0;
out_8726304039892223918[70] = 0;
out_8726304039892223918[71] = 0;
out_8726304039892223918[72] = 1;
out_8726304039892223918[73] = 0;
out_8726304039892223918[74] = 0;
out_8726304039892223918[75] = 0;
out_8726304039892223918[76] = 0;
out_8726304039892223918[77] = 0;
out_8726304039892223918[78] = 0;
out_8726304039892223918[79] = 0;
out_8726304039892223918[80] = 0;
out_8726304039892223918[81] = 0;
out_8726304039892223918[82] = 0;
out_8726304039892223918[83] = 0;
out_8726304039892223918[84] = 0;
out_8726304039892223918[85] = 0;
out_8726304039892223918[86] = 0;
out_8726304039892223918[87] = 0;
}
void h_13(double *state, double *unused, double *out_28859758738527916) {
out_28859758738527916[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_28859758738527916[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_28859758738527916[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_2932076430800306298) {
out_2932076430800306298[0] = 0;
out_2932076430800306298[1] = 0;
out_2932076430800306298[2] = 0;
out_2932076430800306298[3] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8];
out_2932076430800306298[4] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
out_2932076430800306298[5] = -2*state[3]*state[9] + 2*state[4]*state[8] - 2*state[5]*state[7];
out_2932076430800306298[6] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7];
out_2932076430800306298[7] = pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2);
out_2932076430800306298[8] = 2*state[3]*state[6] + 2*state[4]*state[5];
out_2932076430800306298[9] = -2*state[3]*state[5] + 2*state[4]*state[6];
out_2932076430800306298[10] = 0;
out_2932076430800306298[11] = 0;
out_2932076430800306298[12] = 0;
out_2932076430800306298[13] = 0;
out_2932076430800306298[14] = 0;
out_2932076430800306298[15] = 0;
out_2932076430800306298[16] = 0;
out_2932076430800306298[17] = 0;
out_2932076430800306298[18] = 0;
out_2932076430800306298[19] = 0;
out_2932076430800306298[20] = 0;
out_2932076430800306298[21] = 0;
out_2932076430800306298[22] = 0;
out_2932076430800306298[23] = 0;
out_2932076430800306298[24] = 0;
out_2932076430800306298[25] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7];
out_2932076430800306298[26] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7];
out_2932076430800306298[27] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
out_2932076430800306298[28] = -2*state[3]*state[7] + 2*state[5]*state[9] - 2*state[6]*state[8];
out_2932076430800306298[29] = -2*state[3]*state[6] + 2*state[4]*state[5];
out_2932076430800306298[30] = pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2);
out_2932076430800306298[31] = 2*state[3]*state[4] + 2*state[5]*state[6];
out_2932076430800306298[32] = 0;
out_2932076430800306298[33] = 0;
out_2932076430800306298[34] = 0;
out_2932076430800306298[35] = 0;
out_2932076430800306298[36] = 0;
out_2932076430800306298[37] = 0;
out_2932076430800306298[38] = 0;
out_2932076430800306298[39] = 0;
out_2932076430800306298[40] = 0;
out_2932076430800306298[41] = 0;
out_2932076430800306298[42] = 0;
out_2932076430800306298[43] = 0;
out_2932076430800306298[44] = 0;
out_2932076430800306298[45] = 0;
out_2932076430800306298[46] = 0;
out_2932076430800306298[47] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7];
out_2932076430800306298[48] = -2*state[3]*state[8] - 2*state[4]*state[9] + 2*state[6]*state[7];
out_2932076430800306298[49] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8];
out_2932076430800306298[50] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
out_2932076430800306298[51] = 2*state[3]*state[5] + 2*state[4]*state[6];
out_2932076430800306298[52] = -2*state[3]*state[4] + 2*state[5]*state[6];
out_2932076430800306298[53] = pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2);
out_2932076430800306298[54] = 0;
out_2932076430800306298[55] = 0;
out_2932076430800306298[56] = 0;
out_2932076430800306298[57] = 0;
out_2932076430800306298[58] = 0;
out_2932076430800306298[59] = 0;
out_2932076430800306298[60] = 0;
out_2932076430800306298[61] = 0;
out_2932076430800306298[62] = 0;
out_2932076430800306298[63] = 0;
out_2932076430800306298[64] = 0;
out_2932076430800306298[65] = 0;
}
void h_14(double *state, double *unused, double *out_1694555683566656782) {
out_1694555683566656782[0] = state[10];
out_1694555683566656782[1] = state[11];
out_1694555683566656782[2] = state[12];
}
void H_14(double *state, double *unused, double *out_5931047940866228073) {
out_5931047940866228073[0] = 0;
out_5931047940866228073[1] = 0;
out_5931047940866228073[2] = 0;
out_5931047940866228073[3] = 0;
out_5931047940866228073[4] = 0;
out_5931047940866228073[5] = 0;
out_5931047940866228073[6] = 0;
out_5931047940866228073[7] = 0;
out_5931047940866228073[8] = 0;
out_5931047940866228073[9] = 0;
out_5931047940866228073[10] = 1;
out_5931047940866228073[11] = 0;
out_5931047940866228073[12] = 0;
out_5931047940866228073[13] = 0;
out_5931047940866228073[14] = 0;
out_5931047940866228073[15] = 0;
out_5931047940866228073[16] = 0;
out_5931047940866228073[17] = 0;
out_5931047940866228073[18] = 0;
out_5931047940866228073[19] = 0;
out_5931047940866228073[20] = 0;
out_5931047940866228073[21] = 0;
out_5931047940866228073[22] = 0;
out_5931047940866228073[23] = 0;
out_5931047940866228073[24] = 0;
out_5931047940866228073[25] = 0;
out_5931047940866228073[26] = 0;
out_5931047940866228073[27] = 0;
out_5931047940866228073[28] = 0;
out_5931047940866228073[29] = 0;
out_5931047940866228073[30] = 0;
out_5931047940866228073[31] = 0;
out_5931047940866228073[32] = 0;
out_5931047940866228073[33] = 1;
out_5931047940866228073[34] = 0;
out_5931047940866228073[35] = 0;
out_5931047940866228073[36] = 0;
out_5931047940866228073[37] = 0;
out_5931047940866228073[38] = 0;
out_5931047940866228073[39] = 0;
out_5931047940866228073[40] = 0;
out_5931047940866228073[41] = 0;
out_5931047940866228073[42] = 0;
out_5931047940866228073[43] = 0;
out_5931047940866228073[44] = 0;
out_5931047940866228073[45] = 0;
out_5931047940866228073[46] = 0;
out_5931047940866228073[47] = 0;
out_5931047940866228073[48] = 0;
out_5931047940866228073[49] = 0;
out_5931047940866228073[50] = 0;
out_5931047940866228073[51] = 0;
out_5931047940866228073[52] = 0;
out_5931047940866228073[53] = 0;
out_5931047940866228073[54] = 0;
out_5931047940866228073[55] = 0;
out_5931047940866228073[56] = 1;
out_5931047940866228073[57] = 0;
out_5931047940866228073[58] = 0;
out_5931047940866228073[59] = 0;
out_5931047940866228073[60] = 0;
out_5931047940866228073[61] = 0;
out_5931047940866228073[62] = 0;
out_5931047940866228073[63] = 0;
out_5931047940866228073[64] = 0;
out_5931047940866228073[65] = 0;
}
void h_33(double *state, double *unused, double *out_1918865990187428285) {
out_1918865990187428285[0] = state[16];
out_1918865990187428285[1] = state[17];
out_1918865990187428285[2] = state[18];
}
void H_33(double *state, double *unused, double *out_6701047814119210563) {
out_6701047814119210563[0] = 0;
out_6701047814119210563[1] = 0;
out_6701047814119210563[2] = 0;
out_6701047814119210563[3] = 0;
out_6701047814119210563[4] = 0;
out_6701047814119210563[5] = 0;
out_6701047814119210563[6] = 0;
out_6701047814119210563[7] = 0;
out_6701047814119210563[8] = 0;
out_6701047814119210563[9] = 0;
out_6701047814119210563[10] = 0;
out_6701047814119210563[11] = 0;
out_6701047814119210563[12] = 0;
out_6701047814119210563[13] = 0;
out_6701047814119210563[14] = 0;
out_6701047814119210563[15] = 0;
out_6701047814119210563[16] = 1;
out_6701047814119210563[17] = 0;
out_6701047814119210563[18] = 0;
out_6701047814119210563[19] = 0;
out_6701047814119210563[20] = 0;
out_6701047814119210563[21] = 0;
out_6701047814119210563[22] = 0;
out_6701047814119210563[23] = 0;
out_6701047814119210563[24] = 0;
out_6701047814119210563[25] = 0;
out_6701047814119210563[26] = 0;
out_6701047814119210563[27] = 0;
out_6701047814119210563[28] = 0;
out_6701047814119210563[29] = 0;
out_6701047814119210563[30] = 0;
out_6701047814119210563[31] = 0;
out_6701047814119210563[32] = 0;
out_6701047814119210563[33] = 0;
out_6701047814119210563[34] = 0;
out_6701047814119210563[35] = 0;
out_6701047814119210563[36] = 0;
out_6701047814119210563[37] = 0;
out_6701047814119210563[38] = 0;
out_6701047814119210563[39] = 1;
out_6701047814119210563[40] = 0;
out_6701047814119210563[41] = 0;
out_6701047814119210563[42] = 0;
out_6701047814119210563[43] = 0;
out_6701047814119210563[44] = 0;
out_6701047814119210563[45] = 0;
out_6701047814119210563[46] = 0;
out_6701047814119210563[47] = 0;
out_6701047814119210563[48] = 0;
out_6701047814119210563[49] = 0;
out_6701047814119210563[50] = 0;
out_6701047814119210563[51] = 0;
out_6701047814119210563[52] = 0;
out_6701047814119210563[53] = 0;
out_6701047814119210563[54] = 0;
out_6701047814119210563[55] = 0;
out_6701047814119210563[56] = 0;
out_6701047814119210563[57] = 0;
out_6701047814119210563[58] = 0;
out_6701047814119210563[59] = 0;
out_6701047814119210563[60] = 0;
out_6701047814119210563[61] = 0;
out_6701047814119210563[62] = 1;
out_6701047814119210563[63] = 0;
out_6701047814119210563[64] = 0;
out_6701047814119210563[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_2218966030140716596) {
H(in_vec, out_2218966030140716596);
}
void live_err_fun(double *nom_x, double *delta_x, double *out_6852548703017149274) {
err_fun(nom_x, delta_x, out_6852548703017149274);
}
void live_inv_err_fun(double *nom_x, double *true_x, double *out_34828013283855821) {
inv_err_fun(nom_x, true_x, out_34828013283855821);
}
void live_H_mod_fun(double *state, double *out_4107758241515201544) {
H_mod_fun(state, out_4107758241515201544);
}
void live_f_fun(double *state, double dt, double *out_6656309816970046103) {
f_fun(state, dt, out_6656309816970046103);
}
void live_F_fun(double *state, double dt, double *out_80746007831088834) {
F_fun(state, dt, out_80746007831088834);
}
void live_h_4(double *state, double *unused, double *out_3708977988177987000) {
h_4(state, unused, out_3708977988177987000);
}
void live_H_4(double *state, double *unused, double *out_5228477197578876073) {
H_4(state, unused, out_5228477197578876073);
}
void live_h_9(double *state, double *unused, double *out_1694555683566656782) {
h_9(state, unused, out_1694555683566656782);
}
void live_H_9(double *state, double *unused, double *out_5931047940866228073) {
H_9(state, unused, out_5931047940866228073);
}
void live_h_10(double *state, double *unused, double *out_7331102441041093151) {
h_10(state, unused, out_7331102441041093151);
}
void live_H_10(double *state, double *unused, double *out_5698089998383746497) {
H_10(state, unused, out_5698089998383746497);
}
void live_h_12(double *state, double *unused, double *out_2025459526882919185) {
h_12(state, unused, out_2025459526882919185);
}
void live_H_12(double *state, double *unused, double *out_5551138562448225051) {
H_12(state, unused, out_5551138562448225051);
}
void live_h_35(double *state, double *unused, double *out_1095160992943407657) {
h_35(state, unused, out_1095160992943407657);
}
void live_H_35(double *state, double *unused, double *out_8595139254951483449) {
H_35(state, unused, out_8595139254951483449);
}
void live_h_32(double *state, double *unused, double *out_93682492082407536) {
h_32(state, unused, out_93682492082407536);
}
void live_H_32(double *state, double *unused, double *out_8726304039892223918) {
H_32(state, unused, out_8726304039892223918);
}
void live_h_13(double *state, double *unused, double *out_28859758738527916) {
h_13(state, unused, out_28859758738527916);
}
void live_H_13(double *state, double *unused, double *out_2932076430800306298) {
H_13(state, unused, out_2932076430800306298);
}
void live_h_14(double *state, double *unused, double *out_1694555683566656782) {
h_14(state, unused, out_1694555683566656782);
}
void live_H_14(double *state, double *unused, double *out_5931047940866228073) {
H_14(state, unused, out_5931047940866228073);
}
void live_h_33(double *state, double *unused, double *out_1918865990187428285) {
h_33(state, unused, out_1918865990187428285);
}
void live_H_33(double *state, double *unused, double *out_6701047814119210563) {
H_33(state, unused, out_6701047814119210563);
}
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_lib_init(live)