dragonpilot - 基於 openpilot 的開源駕駛輔助系統
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1987 lines
90 KiB

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