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.

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