function obj = coef_f_q_sym_pnp_func_new(in1,in2,in3)
coefs_tq1_1 = in2(1);
coefs_tq1_2 = in2(4);
coefs_tq2_1 = in2(2);
coefs_tq1_3 = in2(7);
coefs_tq2_2 = in2(5);
coefs_tq3_1 = in2(3);
coefs_tq1_4 = in2(10);
coefs_tq2_3 = in2(8);
coefs_tq3_2 = in2(6);
coefs_tq1_5 = in2(13);
coefs_tq2_4 = in2(11);
coefs_tq3_3 = in2(9);
coefs_tq1_6 = in2(16);
coefs_tq2_5 = in2(14);
coefs_tq3_4 = in2(12);
coefs_tq1_7 = in2(19);
coefs_tq2_6 = in2(17);
coefs_tq3_5 = in2(15);
coefs_tq1_8 = in2(22);
coefs_tq2_7 = in2(20);
coefs_tq3_6 = in2(18);
coefs_tq1_9 = in2(25);
coefs_tq2_8 = in2(23);
coefs_tq3_7 = in2(21);
coefs_tq2_9 = in2(26);
coefs_tq3_8 = in2(24);
coefs_tq3_9 = in2(27);
coefs_tq1_10 = in2(28);
coefs_tq2_10 = in2(29);
coefs_tq3_10 = in2(30);
coef_Jacob1_qt_syms1 = in3(1);
coef_Jacob1_qt_syms2 = in3(5);
coef_Jacob2_qt_syms1 = in3(2);
coef_Jacob1_qt_syms3 = in3(9);
coef_Jacob2_qt_syms2 = in3(6);
coef_Jacob3_qt_syms1 = in3(3);
coef_Jacob1_qt_syms4 = in3(13);
coef_Jacob2_qt_syms3 = in3(10);
coef_Jacob3_qt_syms2 = in3(7);
coef_Jacob4_qt_syms1 = in3(4);
coef_Jacob1_qt_syms5 = in3(17);
coef_Jacob2_qt_syms4 = in3(14);
coef_Jacob3_qt_syms3 = in3(11);
coef_Jacob4_qt_syms2 = in3(8);
coef_Jacob1_qt_syms6 = in3(21);
coef_Jacob2_qt_syms5 = in3(18);
coef_Jacob3_qt_syms4 = in3(15);
coef_Jacob4_qt_syms3 = in3(12);
coef_Jacob1_qt_syms7 = in3(25);
coef_Jacob2_qt_syms6 = in3(22);
coef_Jacob3_qt_syms5 = in3(19);
coef_Jacob4_qt_syms4 = in3(16);
coef_Jacob1_qt_syms8 = in3(29);
coef_Jacob2_qt_syms7 = in3(26);
coef_Jacob3_qt_syms6 = in3(23);
coef_Jacob4_qt_syms5 = in3(20);
coef_Jacob1_qt_syms9 = in3(33);
coef_Jacob2_qt_syms8 = in3(30);
coef_Jacob3_qt_syms7 = in3(27);
coef_Jacob4_qt_syms6 = in3(24);
coef_Jacob2_qt_syms9 = in3(34);
coef_Jacob3_qt_syms8 = in3(31);
coef_Jacob4_qt_syms7 = in3(28);
coef_Jacob3_qt_syms9 = in3(35);
coef_Jacob4_qt_syms8 = in3(32);
coef_Jacob4_qt_syms9 = in3(36);
coef_Jacob1_qt_syms10 = in3(37);
coef_Jacob1_qt_syms11 = in3(41);
coef_Jacob1_qt_syms20 = in3(77);
coef_Jacob2_qt_syms10 = in3(38);
coef_Jacob1_qt_syms12 = in3(45);
coef_Jacob1_qt_syms21 = in3(81);
coef_Jacob1_qt_syms30 = in3(117);
coef_Jacob2_qt_syms11 = in3(42);
coef_Jacob2_qt_syms20 = in3(78);
coef_Jacob3_qt_syms10 = in3(39);
coef_Jacob1_qt_syms13 = in3(49);
coef_Jacob1_qt_syms22 = in3(85);
coef_Jacob1_qt_syms31 = in3(121);
coef_Jacob2_qt_syms12 = in3(46);
coef_Jacob2_qt_syms21 = in3(82);
coef_Jacob2_qt_syms30 = in3(118);
coef_Jacob3_qt_syms11 = in3(43);
coef_Jacob3_qt_syms20 = in3(79);
coef_Jacob4_qt_syms10 = in3(40);
coef_Jacob1_qt_syms14 = in3(53);
coef_Jacob1_qt_syms23 = in3(89);
coef_Jacob1_qt_syms32 = in3(125);
coef_Jacob2_qt_syms13 = in3(50);
coef_Jacob2_qt_syms22 = in3(86);
coef_Jacob2_qt_syms31 = in3(122);
coef_Jacob3_qt_syms12 = in3(47);
coef_Jacob3_qt_syms21 = in3(83);
coef_Jacob3_qt_syms30 = in3(119);
coef_Jacob4_qt_syms11 = in3(44);
coef_Jacob4_qt_syms20 = in3(80);
coef_Jacob1_qt_syms15 = in3(57);
coef_Jacob1_qt_syms24 = in3(93);
coef_Jacob2_qt_syms14 = in3(54);
coef_Jacob2_qt_syms23 = in3(90);
coef_Jacob2_qt_syms32 = in3(126);
coef_Jacob3_qt_syms13 = in3(51);
coef_Jacob3_qt_syms22 = in3(87);
coef_Jacob3_qt_syms31 = in3(123);
coef_Jacob4_qt_syms12 = in3(48);
coef_Jacob4_qt_syms21 = in3(84);
coef_Jacob4_qt_syms30 = in3(120);
coef_Jacob1_qt_syms16 = in3(61);
coef_Jacob1_qt_syms25 = in3(97);
coef_Jacob2_qt_syms15 = in3(58);
coef_Jacob2_qt_syms24 = in3(94);
coef_Jacob3_qt_syms14 = in3(55);
coef_Jacob3_qt_syms23 = in3(91);
coef_Jacob3_qt_syms32 = in3(127);
coef_Jacob4_qt_syms13 = in3(52);
coef_Jacob4_qt_syms22 = in3(88);
coef_Jacob4_qt_syms31 = in3(124);
coef_Jacob1_qt_syms17 = in3(65);
coef_Jacob1_qt_syms26 = in3(101);
coef_Jacob2_qt_syms16 = in3(62);
coef_Jacob2_qt_syms25 = in3(98);
coef_Jacob3_qt_syms15 = in3(59);
coef_Jacob3_qt_syms24 = in3(95);
coef_Jacob4_qt_syms14 = in3(56);
coef_Jacob4_qt_syms23 = in3(92);
coef_Jacob4_qt_syms32 = in3(128);
coef_Jacob1_qt_syms18 = in3(69);
coef_Jacob1_qt_syms27 = in3(105);
coef_Jacob2_qt_syms17 = in3(66);
coef_Jacob2_qt_syms26 = in3(102);
coef_Jacob3_qt_syms16 = in3(63);
coef_Jacob3_qt_syms25 = in3(99);
coef_Jacob4_qt_syms15 = in3(60);
coef_Jacob4_qt_syms24 = in3(96);
coef_Jacob1_qt_syms19 = in3(73);
coef_Jacob1_qt_syms28 = in3(109);
coef_Jacob2_qt_syms18 = in3(70);
coef_Jacob2_qt_syms27 = in3(106);
coef_Jacob3_qt_syms17 = in3(67);
coef_Jacob3_qt_syms26 = in3(103);
coef_Jacob4_qt_syms16 = in3(64);
coef_Jacob4_qt_syms25 = in3(100);
coef_Jacob1_qt_syms29 = in3(113);
coef_Jacob2_qt_syms19 = in3(74);
coef_Jacob2_qt_syms28 = in3(110);
coef_Jacob3_qt_syms18 = in3(71);
coef_Jacob3_qt_syms27 = in3(107);
coef_Jacob4_qt_syms17 = in3(68);
coef_Jacob4_qt_syms26 = in3(104);
coef_Jacob2_qt_syms29 = in3(114);
coef_Jacob3_qt_syms19 = in3(75);
coef_Jacob3_qt_syms28 = in3(111);
coef_Jacob4_qt_syms18 = in3(72);
coef_Jacob4_qt_syms27 = in3(108);
coef_Jacob3_qt_syms29 = in3(115);
coef_Jacob4_qt_syms19 = in3(76);
coef_Jacob4_qt_syms28 = in3(112);
coef_Jacob4_qt_syms29 = in3(116);
pinvG1_1 = in1(1);
pinvG1_2 = in1(4);
pinvG2_1 = in1(2);
pinvG1_3 = in1(7);
pinvG2_2 = in1(5);
pinvG3_1 = in1(3);
pinvG2_3 = in1(8);
pinvG3_2 = in1(6);
pinvG3_3 = in1(9);
obj = reshape([coefs_tq1_1.*coef_Jacob1_qt_syms7.*pinvG1_1+coefs_tq1_1.*coef_Jacob1_qt_syms8.*pinvG2_1+coefs_tq2_1.*coef_Jacob1_qt_syms7.*pinvG1_2+coefs_tq1_1.*coef_Jacob1_qt_syms9.*pinvG3_1+coefs_tq2_1.*coef_Jacob1_qt_syms8.*pinvG2_2+coefs_tq3_1.*coef_Jacob1_qt_syms7.*pinvG1_3+coefs_tq2_1.*coef_Jacob1_qt_syms9.*pinvG3_2+coefs_tq3_1.*coef_Jacob1_qt_syms8.*pinvG2_3+coefs_tq3_1.*coef_Jacob1_qt_syms9.*pinvG3_3,coefs_tq1_1.*coef_Jacob2_qt_syms7.*pinvG1_1+coefs_tq1_1.*coef_Jacob2_qt_syms8.*pinvG2_1+coefs_tq2_1.*coef_Jacob2_qt_syms7.*pinvG1_2+coefs_tq1_1.*coef_Jacob2_qt_syms9.*pinvG3_1+coefs_tq2_1.*coef_Jacob2_qt_syms8.*pinvG2_2+coefs_tq3_1.*coef_Jacob2_qt_syms7.*pinvG1_3+coefs_tq2_1.*coef_Jacob2_qt_syms9.*pinvG3_2+coefs_tq3_1.*coef_Jacob2_qt_syms8.*pinvG2_3+coefs_tq3_1.*coef_Jacob2_qt_syms9.*pinvG3_3,coefs_tq1_1.*coef_Jacob3_qt_syms7.*pinvG1_1+coefs_tq1_1.*coef_Jacob3_qt_syms8.*pinvG2_1+coefs_tq2_1.*coef_Jacob3_qt_syms7.*pinvG1_2+coefs_tq1_1.*coef_Jacob3_qt_syms9.*pinvG3_1+coefs_tq2_1.*coef_Jacob3_qt_syms8.*pinvG2_2+coefs_tq3_1.*coef_Jacob3_qt_syms7.*pinvG1_3+coefs_tq2_1.*coef_Jacob3_qt_syms9.*pinvG3_2+coefs_tq3_1.*coef_Jacob3_qt_syms8.*pinvG2_3+coefs_tq3_1.*coef_Jacob3_qt_syms9.*pinvG3_3,coefs_tq1_1.*coef_Jacob4_qt_syms7.*pinvG1_1+coefs_tq1_1.*coef_Jacob4_qt_syms8.*pinvG2_1+coefs_tq2_1.*coef_Jacob4_qt_syms7.*pinvG1_2+coefs_tq1_1.*coef_Jacob4_qt_syms9.*pinvG3_1+coefs_tq2_1.*coef_Jacob4_qt_syms8.*pinvG2_2+coefs_tq3_1.*coef_Jacob4_qt_syms7.*pinvG1_3+coefs_tq2_1.*coef_Jacob4_qt_syms9.*pinvG3_2+coefs_tq3_1.*coef_Jacob4_qt_syms8.*pinvG2_3+coefs_tq3_1.*coef_Jacob4_qt_syms9.*pinvG3_3,coefs_tq1_2.*coef_Jacob1_qt_syms7.*pinvG1_1+coefs_tq1_2.*coef_Jacob1_qt_syms8.*pinvG2_1+coefs_tq2_2.*coef_Jacob1_qt_syms7.*pinvG1_2+coefs_tq1_2.*coef_Jacob1_qt_syms9.*pinvG3_1+coefs_tq2_2.*coef_Jacob1_qt_syms8.*pinvG2_2+coefs_tq3_2.*coef_Jacob1_qt_syms7.*pinvG1_3+coefs_tq2_2.*coef_Jacob1_qt_syms9.*pinvG3_2+coefs_tq3_2.*coef_Jacob1_qt_syms8.*pinvG2_3+coefs_tq3_2.*coef_Jacob1_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob1_qt_syms17.*pinvG1_1+coefs_tq1_1.*coef_Jacob1_qt_syms18.*pinvG2_1+coefs_tq2_1.*coef_Jacob1_qt_syms17.*pinvG1_2+coefs_tq1_1.*coef_Jacob1_qt_syms19.*pinvG3_1+coefs_tq2_1.*coef_Jacob1_qt_syms18.*pinvG2_2+coefs_tq3_1.*coef_Jacob1_qt_syms17.*pinvG1_3+coefs_tq2_1.*coef_Jacob1_qt_syms19.*pinvG3_2+coefs_tq3_1.*coef_Jacob1_qt_syms18.*pinvG2_3+coefs_tq3_1.*coef_Jacob1_qt_syms19.*pinvG3_3,coefs_tq1_2.*coef_Jacob2_qt_syms7.*pinvG1_1+coefs_tq1_2.*coef_Jacob2_qt_syms8.*pinvG2_1+coefs_tq2_2.*coef_Jacob2_qt_syms7.*pinvG1_2+coefs_tq1_2.*coef_Jacob2_qt_syms9.*pinvG3_1+coefs_tq2_2.*coef_Jacob2_qt_syms8.*pinvG2_2+coefs_tq3_2.*coef_Jacob2_qt_syms7.*pinvG1_3+coefs_tq2_2.*coef_Jacob2_qt_syms9.*pinvG3_2+coefs_tq3_2.*coef_Jacob2_qt_syms8.*pinvG2_3+coefs_tq3_2.*coef_Jacob2_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob2_qt_syms17.*pinvG1_1+coefs_tq1_1.*coef_Jacob2_qt_syms18.*pinvG2_1+coefs_tq2_1.*coef_Jacob2_qt_syms17.*pinvG1_2+coefs_tq1_1.*coef_Jacob2_qt_syms19.*pinvG3_1+coefs_tq2_1.*coef_Jacob2_qt_syms18.*pinvG2_2+coefs_tq3_1.*coef_Jacob2_qt_syms17.*pinvG1_3+coefs_tq2_1.*coef_Jacob2_qt_syms19.*pinvG3_2+coefs_tq3_1.*coef_Jacob2_qt_syms18.*pinvG2_3+coefs_tq3_1.*coef_Jacob2_qt_syms19.*pinvG3_3,coefs_tq1_2.*coef_Jacob3_qt_syms7.*pinvG1_1+coefs_tq1_2.*coef_Jacob3_qt_syms8.*pinvG2_1+coefs_tq2_2.*coef_Jacob3_qt_syms7.*pinvG1_2+coefs_tq1_2.*coef_Jacob3_qt_syms9.*pinvG3_1+coefs_tq2_2.*coef_Jacob3_qt_syms8.*pinvG2_2+coefs_tq3_2.*coef_Jacob3_qt_syms7.*pinvG1_3+coefs_tq2_2.*coef_Jacob3_qt_syms9.*pinvG3_2+coefs_tq3_2.*coef_Jacob3_qt_syms8.*pinvG2_3+coefs_tq3_2.*coef_Jacob3_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob3_qt_syms17.*pinvG1_1+coefs_tq1_1.*coef_Jacob3_qt_syms18.*pinvG2_1+coefs_tq2_1.*coef_Jacob3_qt_syms17.*pinvG1_2+coefs_tq1_1.*coef_Jacob3_qt_syms19.*pinvG3_1+coefs_tq2_1.*coef_Jacob3_qt_syms18.*pinvG2_2+coefs_tq3_1.*coef_Jacob3_qt_syms17.*pinvG1_3+coefs_tq2_1.*coef_Jacob3_qt_syms19.*pinvG3_2+coefs_tq3_1.*coef_Jacob3_qt_syms18.*pinvG2_3+coefs_tq3_1.*coef_Jacob3_qt_syms19.*pinvG3_3,coefs_tq1_2.*coef_Jacob4_qt_syms7.*pinvG1_1+coefs_tq1_2.*coef_Jacob4_qt_syms8.*pinvG2_1+coefs_tq2_2.*coef_Jacob4_qt_syms7.*pinvG1_2+coefs_tq1_2.*coef_Jacob4_qt_syms9.*pinvG3_1+coefs_tq2_2.*coef_Jacob4_qt_syms8.*pinvG2_2+coefs_tq3_2.*coef_Jacob4_qt_syms7.*pinvG1_3+coefs_tq2_2.*coef_Jacob4_qt_syms9.*pinvG3_2+coefs_tq3_2.*coef_Jacob4_qt_syms8.*pinvG2_3+coefs_tq3_2.*coef_Jacob4_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob4_qt_syms17.*pinvG1_1+coefs_tq1_1.*coef_Jacob4_qt_syms18.*pinvG2_1+coefs_tq2_1.*coef_Jacob4_qt_syms17.*pinvG1_2+coefs_tq1_1.*coef_Jacob4_qt_syms19.*pinvG3_1+coefs_tq2_1.*coef_Jacob4_qt_syms18.*pinvG2_2+coefs_tq3_1.*coef_Jacob4_qt_syms17.*pinvG1_3+coefs_tq2_1.*coef_Jacob4_qt_syms19.*pinvG3_2+coefs_tq3_1.*coef_Jacob4_qt_syms18.*pinvG2_3+coefs_tq3_1.*coef_Jacob4_qt_syms19.*pinvG3_3,coefs_tq1_3.*coef_Jacob1_qt_syms7.*pinvG1_1+coefs_tq1_3.*coef_Jacob1_qt_syms8.*pinvG2_1+coefs_tq2_3.*coef_Jacob1_qt_syms7.*pinvG1_2+coefs_tq1_3.*coef_Jacob1_qt_syms9.*pinvG3_1+coefs_tq2_3.*coef_Jacob1_qt_syms8.*pinvG2_2+coefs_tq3_3.*coef_Jacob1_qt_syms7.*pinvG1_3+coefs_tq2_3.*coef_Jacob1_qt_syms9.*pinvG3_2+coefs_tq3_3.*coef_Jacob1_qt_syms8.*pinvG2_3+coefs_tq3_3.*coef_Jacob1_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob1_qt_syms24.*pinvG1_1+coefs_tq1_1.*coef_Jacob1_qt_syms25.*pinvG2_1+coefs_tq2_1.*coef_Jacob1_qt_syms24.*pinvG1_2+coefs_tq1_1.*coef_Jacob1_qt_syms26.*pinvG3_1+coefs_tq2_1.*coef_Jacob1_qt_syms25.*pinvG2_2+coefs_tq3_1.*coef_Jacob1_qt_syms24.*pinvG1_3+coefs_tq2_1.*coef_Jacob1_qt_syms26.*pinvG3_2+coefs_tq3_1.*coef_Jacob1_qt_syms25.*pinvG2_3+coefs_tq3_1.*coef_Jacob1_qt_syms26.*pinvG3_3,coefs_tq1_3.*coef_Jacob2_qt_syms7.*pinvG1_1+coefs_tq1_3.*coef_Jacob2_qt_syms8.*pinvG2_1+coefs_tq2_3.*coef_Jacob2_qt_syms7.*pinvG1_2+coefs_tq1_3.*coef_Jacob2_qt_syms9.*pinvG3_1+coefs_tq2_3.*coef_Jacob2_qt_syms8.*pinvG2_2+coefs_tq3_3.*coef_Jacob2_qt_syms7.*pinvG1_3+coefs_tq2_3.*coef_Jacob2_qt_syms9.*pinvG3_2+coefs_tq3_3.*coef_Jacob2_qt_syms8.*pinvG2_3+coefs_tq3_3.*coef_Jacob2_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob2_qt_syms24.*pinvG1_1+coefs_tq1_1.*coef_Jacob2_qt_syms25.*pinvG2_1+coefs_tq2_1.*coef_Jacob2_qt_syms24.*pinvG1_2+coefs_tq1_1.*coef_Jacob2_qt_syms26.*pinvG3_1+coefs_tq2_1.*coef_Jacob2_qt_syms25.*pinvG2_2+coefs_tq3_1.*coef_Jacob2_qt_syms24.*pinvG1_3+coefs_tq2_1.*coef_Jacob2_qt_syms26.*pinvG3_2+coefs_tq3_1.*coef_Jacob2_qt_syms25.*pinvG2_3+coefs_tq3_1.*coef_Jacob2_qt_syms26.*pinvG3_3,coefs_tq1_3.*coef_Jacob3_qt_syms7.*pinvG1_1+coefs_tq1_3.*coef_Jacob3_qt_syms8.*pinvG2_1+coefs_tq2_3.*coef_Jacob3_qt_syms7.*pinvG1_2+coefs_tq1_3.*coef_Jacob3_qt_syms9.*pinvG3_1+coefs_tq2_3.*coef_Jacob3_qt_syms8.*pinvG2_2+coefs_tq3_3.*coef_Jacob3_qt_syms7.*pinvG1_3+coefs_tq2_3.*coef_Jacob3_qt_syms9.*pinvG3_2+coefs_tq3_3.*coef_Jacob3_qt_syms8.*pinvG2_3+coefs_tq3_3.*coef_Jacob3_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob3_qt_syms24.*pinvG1_1+coefs_tq1_1.*coef_Jacob3_qt_syms25.*pinvG2_1+coefs_tq2_1.*coef_Jacob3_qt_syms24.*pinvG1_2+coefs_tq1_1.*coef_Jacob3_qt_syms26.*pinvG3_1+coefs_tq2_1.*coef_Jacob3_qt_syms25.*pinvG2_2+coefs_tq3_1.*coef_Jacob3_qt_syms24.*pinvG1_3+coefs_tq2_1.*coef_Jacob3_qt_syms26.*pinvG3_2+coefs_tq3_1.*coef_Jacob3_qt_syms25.*pinvG2_3+coefs_tq3_1.*coef_Jacob3_qt_syms26.*pinvG3_3,coefs_tq1_3.*coef_Jacob4_qt_syms7.*pinvG1_1+coefs_tq1_3.*coef_Jacob4_qt_syms8.*pinvG2_1+coefs_tq2_3.*coef_Jacob4_qt_syms7.*pinvG1_2+coefs_tq1_3.*coef_Jacob4_qt_syms9.*pinvG3_1+coefs_tq2_3.*coef_Jacob4_qt_syms8.*pinvG2_2+coefs_tq3_3.*coef_Jacob4_qt_syms7.*pinvG1_3+coefs_tq2_3.*coef_Jacob4_qt_syms9.*pinvG3_2+coefs_tq3_3.*coef_Jacob4_qt_syms8.*pinvG2_3+coefs_tq3_3.*coef_Jacob4_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob4_qt_syms24.*pinvG1_1+coefs_tq1_1.*coef_Jacob4_qt_syms25.*pinvG2_1+coefs_tq2_1.*coef_Jacob4_qt_syms24.*pinvG1_2+coefs_tq1_1.*coef_Jacob4_qt_syms26.*pinvG3_1+coefs_tq2_1.*coef_Jacob4_qt_syms25.*pinvG2_2+coefs_tq3_1.*coef_Jacob4_qt_syms24.*pinvG1_3+coefs_tq2_1.*coef_Jacob4_qt_syms26.*pinvG3_2+coefs_tq3_1.*coef_Jacob4_qt_syms25.*pinvG2_3+coefs_tq3_1.*coef_Jacob4_qt_syms26.*pinvG3_3,coefs_tq1_4.*coef_Jacob1_qt_syms7.*pinvG1_1+coefs_tq1_4.*coef_Jacob1_qt_syms8.*pinvG2_1+coefs_tq2_4.*coef_Jacob1_qt_syms7.*pinvG1_2+coefs_tq1_4.*coef_Jacob1_qt_syms9.*pinvG3_1+coefs_tq2_4.*coef_Jacob1_qt_syms8.*pinvG2_2+coefs_tq3_4.*coef_Jacob1_qt_syms7.*pinvG1_3+coefs_tq2_4.*coef_Jacob1_qt_syms9.*pinvG3_2+coefs_tq3_4.*coef_Jacob1_qt_syms8.*pinvG2_3+coefs_tq3_4.*coef_Jacob1_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob1_qt_syms30.*pinvG2_1+coefs_tq1_1.*coef_Jacob1_qt_syms31.*pinvG3_1+coefs_tq2_1.*coef_Jacob1_qt_syms30.*pinvG2_2+coefs_tq2_1.*coef_Jacob1_qt_syms31.*pinvG3_2+coefs_tq3_1.*coef_Jacob1_qt_syms30.*pinvG2_3+coefs_tq3_1.*coef_Jacob1_qt_syms31.*pinvG3_3+coefs_tq1_1.*coef_Jacob1_qt_syms29.*pinvG1_1+coefs_tq2_1.*coef_Jacob1_qt_syms29.*pinvG1_2+coefs_tq3_1.*coef_Jacob1_qt_syms29.*pinvG1_3,coefs_tq1_4.*coef_Jacob2_qt_syms7.*pinvG1_1+coefs_tq1_4.*coef_Jacob2_qt_syms8.*pinvG2_1+coefs_tq2_4.*coef_Jacob2_qt_syms7.*pinvG1_2+coefs_tq1_4.*coef_Jacob2_qt_syms9.*pinvG3_1+coefs_tq2_4.*coef_Jacob2_qt_syms8.*pinvG2_2+coefs_tq3_4.*coef_Jacob2_qt_syms7.*pinvG1_3+coefs_tq2_4.*coef_Jacob2_qt_syms9.*pinvG3_2+coefs_tq3_4.*coef_Jacob2_qt_syms8.*pinvG2_3+coefs_tq3_4.*coef_Jacob2_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob2_qt_syms30.*pinvG2_1+coefs_tq1_1.*coef_Jacob2_qt_syms31.*pinvG3_1+coefs_tq2_1.*coef_Jacob2_qt_syms30.*pinvG2_2+coefs_tq2_1.*coef_Jacob2_qt_syms31.*pinvG3_2+coefs_tq3_1.*coef_Jacob2_qt_syms30.*pinvG2_3+coefs_tq3_1.*coef_Jacob2_qt_syms31.*pinvG3_3+coefs_tq1_1.*coef_Jacob2_qt_syms29.*pinvG1_1+coefs_tq2_1.*coef_Jacob2_qt_syms29.*pinvG1_2+coefs_tq3_1.*coef_Jacob2_qt_syms29.*pinvG1_3,coefs_tq1_4.*coef_Jacob3_qt_syms7.*pinvG1_1+coefs_tq1_4.*coef_Jacob3_qt_syms8.*pinvG2_1+coefs_tq2_4.*coef_Jacob3_qt_syms7.*pinvG1_2+coefs_tq1_4.*coef_Jacob3_qt_syms9.*pinvG3_1+coefs_tq2_4.*coef_Jacob3_qt_syms8.*pinvG2_2+coefs_tq3_4.*coef_Jacob3_qt_syms7.*pinvG1_3+coefs_tq2_4.*coef_Jacob3_qt_syms9.*pinvG3_2+coefs_tq3_4.*coef_Jacob3_qt_syms8.*pinvG2_3+coefs_tq3_4.*coef_Jacob3_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob3_qt_syms30.*pinvG2_1+coefs_tq1_1.*coef_Jacob3_qt_syms31.*pinvG3_1+coefs_tq2_1.*coef_Jacob3_qt_syms30.*pinvG2_2+coefs_tq2_1.*coef_Jacob3_qt_syms31.*pinvG3_2+coefs_tq3_1.*coef_Jacob3_qt_syms30.*pinvG2_3+coefs_tq3_1.*coef_Jacob3_qt_syms31.*pinvG3_3+coefs_tq1_1.*coef_Jacob3_qt_syms29.*pinvG1_1+coefs_tq2_1.*coef_Jacob3_qt_syms29.*pinvG1_2+coefs_tq3_1.*coef_Jacob3_qt_syms29.*pinvG1_3,coefs_tq1_4.*coef_Jacob4_qt_syms7.*pinvG1_1+coefs_tq1_4.*coef_Jacob4_qt_syms8.*pinvG2_1+coefs_tq2_4.*coef_Jacob4_qt_syms7.*pinvG1_2+coefs_tq1_4.*coef_Jacob4_qt_syms9.*pinvG3_1+coefs_tq2_4.*coef_Jacob4_qt_syms8.*pinvG2_2+coefs_tq3_4.*coef_Jacob4_qt_syms7.*pinvG1_3+coefs_tq2_4.*coef_Jacob4_qt_syms9.*pinvG3_2+coefs_tq3_4.*coef_Jacob4_qt_syms8.*pinvG2_3+coefs_tq3_4.*coef_Jacob4_qt_syms9.*pinvG3_3+coefs_tq1_1.*coef_Jacob4_qt_syms30.*pinvG2_1+coefs_tq1_1.*coef_Jacob4_qt_syms31.*pinvG3_1+coefs_tq2_1.*coef_Jacob4_qt_syms30.*pinvG2_2+coefs_tq2_1.*coef_Jacob4_qt_syms31.*pinvG3_2+coefs_tq3_1.*coef_Jacob4_qt_syms30.*pinvG2_3+coefs_tq3_1.*coef_Jacob4_qt_syms31.*pinvG3_3+coefs_tq1_1.*coef_Jacob4_qt_syms29.*pinvG1_1+coefs_tq2_1.*coef_Jacob4_qt_syms29.*pinvG1_2+coefs_tq3_1.*coef_Jacob4_qt_syms29.*pinvG1_3,coef_Jacob1_qt_syms1+coefs_tq1_5.*coef_Jacob1_qt_syms7.*pinvG1_1+coefs_tq1_5.*coef_Jacob1_qt_syms8.*pinvG2_1+coefs_tq2_5.*coef_Jacob1_qt_syms7.*pinvG1_2+coefs_tq1_5.*coef_Jacob1_qt_syms9.*pinvG3_1+coefs_tq2_5.*coef_Jacob1_qt_syms8.*pinvG2_2+coefs_tq3_5.*coef_Jacob1_qt_syms7.*pinvG1_3+coefs_tq2_5.*coef_Jacob1_qt_syms9.*pinvG3_2+coefs_tq3_5.*coef_Jacob1_qt_syms8.*pinvG2_3+coefs_tq3_5.*coef_Jacob1_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob1_qt_syms17.*pinvG1_1+coefs_tq1_2.*coef_Jacob1_qt_syms18.*pinvG2_1+coefs_tq2_2.*coef_Jacob1_qt_syms17.*pinvG1_2+coefs_tq1_2.*coef_Jacob1_qt_syms19.*pinvG3_1+coefs_tq2_2.*coef_Jacob1_qt_syms18.*pinvG2_2+coefs_tq3_2.*coef_Jacob1_qt_syms17.*pinvG1_3+coefs_tq2_2.*coef_Jacob1_qt_syms19.*pinvG3_2+coefs_tq3_2.*coef_Jacob1_qt_syms18.*pinvG2_3+coefs_tq3_2.*coef_Jacob1_qt_syms19.*pinvG3_3,coef_Jacob2_qt_syms1+coefs_tq1_5.*coef_Jacob2_qt_syms7.*pinvG1_1+coefs_tq1_5.*coef_Jacob2_qt_syms8.*pinvG2_1+coefs_tq2_5.*coef_Jacob2_qt_syms7.*pinvG1_2+coefs_tq1_5.*coef_Jacob2_qt_syms9.*pinvG3_1+coefs_tq2_5.*coef_Jacob2_qt_syms8.*pinvG2_2+coefs_tq3_5.*coef_Jacob2_qt_syms7.*pinvG1_3+coefs_tq2_5.*coef_Jacob2_qt_syms9.*pinvG3_2+coefs_tq3_5.*coef_Jacob2_qt_syms8.*pinvG2_3+coefs_tq3_5.*coef_Jacob2_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob2_qt_syms17.*pinvG1_1+coefs_tq1_2.*coef_Jacob2_qt_syms18.*pinvG2_1+coefs_tq2_2.*coef_Jacob2_qt_syms17.*pinvG1_2+coefs_tq1_2.*coef_Jacob2_qt_syms19.*pinvG3_1+coefs_tq2_2.*coef_Jacob2_qt_syms18.*pinvG2_2+coefs_tq3_2.*coef_Jacob2_qt_syms17.*pinvG1_3+coefs_tq2_2.*coef_Jacob2_qt_syms19.*pinvG3_2+coefs_tq3_2.*coef_Jacob2_qt_syms18.*pinvG2_3+coefs_tq3_2.*coef_Jacob2_qt_syms19.*pinvG3_3,coef_Jacob3_qt_syms1+coefs_tq1_5.*coef_Jacob3_qt_syms7.*pinvG1_1+coefs_tq1_5.*coef_Jacob3_qt_syms8.*pinvG2_1+coefs_tq2_5.*coef_Jacob3_qt_syms7.*pinvG1_2+coefs_tq1_5.*coef_Jacob3_qt_syms9.*pinvG3_1+coefs_tq2_5.*coef_Jacob3_qt_syms8.*pinvG2_2+coefs_tq3_5.*coef_Jacob3_qt_syms7.*pinvG1_3+coefs_tq2_5.*coef_Jacob3_qt_syms9.*pinvG3_2+coefs_tq3_5.*coef_Jacob3_qt_syms8.*pinvG2_3+coefs_tq3_5.*coef_Jacob3_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob3_qt_syms17.*pinvG1_1+coefs_tq1_2.*coef_Jacob3_qt_syms18.*pinvG2_1+coefs_tq2_2.*coef_Jacob3_qt_syms17.*pinvG1_2+coefs_tq1_2.*coef_Jacob3_qt_syms19.*pinvG3_1+coefs_tq2_2.*coef_Jacob3_qt_syms18.*pinvG2_2+coefs_tq3_2.*coef_Jacob3_qt_syms17.*pinvG1_3+coefs_tq2_2.*coef_Jacob3_qt_syms19.*pinvG3_2+coefs_tq3_2.*coef_Jacob3_qt_syms18.*pinvG2_3+coefs_tq3_2.*coef_Jacob3_qt_syms19.*pinvG3_3,coef_Jacob4_qt_syms1+coefs_tq1_5.*coef_Jacob4_qt_syms7.*pinvG1_1+coefs_tq1_5.*coef_Jacob4_qt_syms8.*pinvG2_1+coefs_tq2_5.*coef_Jacob4_qt_syms7.*pinvG1_2+coefs_tq1_5.*coef_Jacob4_qt_syms9.*pinvG3_1+coefs_tq2_5.*coef_Jacob4_qt_syms8.*pinvG2_2+coefs_tq3_5.*coef_Jacob4_qt_syms7.*pinvG1_3+coefs_tq2_5.*coef_Jacob4_qt_syms9.*pinvG3_2+coefs_tq3_5.*coef_Jacob4_qt_syms8.*pinvG2_3+coefs_tq3_5.*coef_Jacob4_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob4_qt_syms17.*pinvG1_1+coefs_tq1_2.*coef_Jacob4_qt_syms18.*pinvG2_1+coefs_tq2_2.*coef_Jacob4_qt_syms17.*pinvG1_2+coefs_tq1_2.*coef_Jacob4_qt_syms19.*pinvG3_1+coefs_tq2_2.*coef_Jacob4_qt_syms18.*pinvG2_2+coefs_tq3_2.*coef_Jacob4_qt_syms17.*pinvG1_3+coefs_tq2_2.*coef_Jacob4_qt_syms19.*pinvG3_2+coefs_tq3_2.*coef_Jacob4_qt_syms18.*pinvG2_3+coefs_tq3_2.*coef_Jacob4_qt_syms19.*pinvG3_3,coef_Jacob1_qt_syms2+coefs_tq1_6.*coef_Jacob1_qt_syms7.*pinvG1_1+coefs_tq1_6.*coef_Jacob1_qt_syms8.*pinvG2_1+coefs_tq2_6.*coef_Jacob1_qt_syms7.*pinvG1_2+coefs_tq1_6.*coef_Jacob1_qt_syms9.*pinvG3_1+coefs_tq2_6.*coef_Jacob1_qt_syms8.*pinvG2_2+coefs_tq3_6.*coef_Jacob1_qt_syms7.*pinvG1_3+coefs_tq2_6.*coef_Jacob1_qt_syms9.*pinvG3_2+coefs_tq3_6.*coef_Jacob1_qt_syms8.*pinvG2_3+coefs_tq3_6.*coef_Jacob1_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob1_qt_syms24.*pinvG1_1+coefs_tq1_2.*coef_Jacob1_qt_syms25.*pinvG2_1+coefs_tq2_2.*coef_Jacob1_qt_syms24.*pinvG1_2+coefs_tq1_3.*coef_Jacob1_qt_syms17.*pinvG1_1+coefs_tq1_2.*coef_Jacob1_qt_syms26.*pinvG3_1+coefs_tq2_2.*coef_Jacob1_qt_syms25.*pinvG2_2+coefs_tq3_2.*coef_Jacob1_qt_syms24.*pinvG1_3+coefs_tq1_3.*coef_Jacob1_qt_syms18.*pinvG2_1+coefs_tq2_3.*coef_Jacob1_qt_syms17.*pinvG1_2+coefs_tq2_2.*coef_Jacob1_qt_syms26.*pinvG3_2+coefs_tq3_2.*coef_Jacob1_qt_syms25.*pinvG2_3+coefs_tq1_3.*coef_Jacob1_qt_syms19.*pinvG3_1+coefs_tq2_3.*coef_Jacob1_qt_syms18.*pinvG2_2+coefs_tq3_3.*coef_Jacob1_qt_syms17.*pinvG1_3+coefs_tq3_2.*coef_Jacob1_qt_syms26.*pinvG3_3+coefs_tq2_3.*coef_Jacob1_qt_syms19.*pinvG3_2+coefs_tq3_3.*coef_Jacob1_qt_syms18.*pinvG2_3+coefs_tq3_3.*coef_Jacob1_qt_syms19.*pinvG3_3,coef_Jacob2_qt_syms2+coefs_tq1_6.*coef_Jacob2_qt_syms7.*pinvG1_1+coefs_tq1_6.*coef_Jacob2_qt_syms8.*pinvG2_1+coefs_tq2_6.*coef_Jacob2_qt_syms7.*pinvG1_2+coefs_tq1_6.*coef_Jacob2_qt_syms9.*pinvG3_1+coefs_tq2_6.*coef_Jacob2_qt_syms8.*pinvG2_2+coefs_tq3_6.*coef_Jacob2_qt_syms7.*pinvG1_3+coefs_tq2_6.*coef_Jacob2_qt_syms9.*pinvG3_2+coefs_tq3_6.*coef_Jacob2_qt_syms8.*pinvG2_3+coefs_tq3_6.*coef_Jacob2_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob2_qt_syms24.*pinvG1_1+coefs_tq1_2.*coef_Jacob2_qt_syms25.*pinvG2_1+coefs_tq2_2.*coef_Jacob2_qt_syms24.*pinvG1_2+coefs_tq1_3.*coef_Jacob2_qt_syms17.*pinvG1_1+coefs_tq1_2.*coef_Jacob2_qt_syms26.*pinvG3_1+coefs_tq2_2.*coef_Jacob2_qt_syms25.*pinvG2_2+coefs_tq3_2.*coef_Jacob2_qt_syms24.*pinvG1_3+coefs_tq1_3.*coef_Jacob2_qt_syms18.*pinvG2_1+coefs_tq2_3.*coef_Jacob2_qt_syms17.*pinvG1_2+coefs_tq2_2.*coef_Jacob2_qt_syms26.*pinvG3_2+coefs_tq3_2.*coef_Jacob2_qt_syms25.*pinvG2_3+coefs_tq1_3.*coef_Jacob2_qt_syms19.*pinvG3_1+coefs_tq2_3.*coef_Jacob2_qt_syms18.*pinvG2_2+coefs_tq3_3.*coef_Jacob2_qt_syms17.*pinvG1_3+coefs_tq3_2.*coef_Jacob2_qt_syms26.*pinvG3_3+coefs_tq2_3.*coef_Jacob2_qt_syms19.*pinvG3_2+coefs_tq3_3.*coef_Jacob2_qt_syms18.*pinvG2_3+coefs_tq3_3.*coef_Jacob2_qt_syms19.*pinvG3_3,coef_Jacob3_qt_syms2+coefs_tq1_6.*coef_Jacob3_qt_syms7.*pinvG1_1+coefs_tq1_6.*coef_Jacob3_qt_syms8.*pinvG2_1+coefs_tq2_6.*coef_Jacob3_qt_syms7.*pinvG1_2+coefs_tq1_6.*coef_Jacob3_qt_syms9.*pinvG3_1+coefs_tq2_6.*coef_Jacob3_qt_syms8.*pinvG2_2+coefs_tq3_6.*coef_Jacob3_qt_syms7.*pinvG1_3+coefs_tq2_6.*coef_Jacob3_qt_syms9.*pinvG3_2+coefs_tq3_6.*coef_Jacob3_qt_syms8.*pinvG2_3+coefs_tq3_6.*coef_Jacob3_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob3_qt_syms24.*pinvG1_1+coefs_tq1_2.*coef_Jacob3_qt_syms25.*pinvG2_1+coefs_tq2_2.*coef_Jacob3_qt_syms24.*pinvG1_2+coefs_tq1_3.*coef_Jacob3_qt_syms17.*pinvG1_1+coefs_tq1_2.*coef_Jacob3_qt_syms26.*pinvG3_1+coefs_tq2_2.*coef_Jacob3_qt_syms25.*pinvG2_2+coefs_tq3_2.*coef_Jacob3_qt_syms24.*pinvG1_3+coefs_tq1_3.*coef_Jacob3_qt_syms18.*pinvG2_1+coefs_tq2_3.*coef_Jacob3_qt_syms17.*pinvG1_2+coefs_tq2_2.*coef_Jacob3_qt_syms26.*pinvG3_2+coefs_tq3_2.*coef_Jacob3_qt_syms25.*pinvG2_3+coefs_tq1_3.*coef_Jacob3_qt_syms19.*pinvG3_1+coefs_tq2_3.*coef_Jacob3_qt_syms18.*pinvG2_2+coefs_tq3_3.*coef_Jacob3_qt_syms17.*pinvG1_3+coefs_tq3_2.*coef_Jacob3_qt_syms26.*pinvG3_3+coefs_tq2_3.*coef_Jacob3_qt_syms19.*pinvG3_2+coefs_tq3_3.*coef_Jacob3_qt_syms18.*pinvG2_3+coefs_tq3_3.*coef_Jacob3_qt_syms19.*pinvG3_3,coef_Jacob4_qt_syms2+coefs_tq1_6.*coef_Jacob4_qt_syms7.*pinvG1_1+coefs_tq1_6.*coef_Jacob4_qt_syms8.*pinvG2_1+coefs_tq2_6.*coef_Jacob4_qt_syms7.*pinvG1_2+coefs_tq1_6.*coef_Jacob4_qt_syms9.*pinvG3_1+coefs_tq2_6.*coef_Jacob4_qt_syms8.*pinvG2_2+coefs_tq3_6.*coef_Jacob4_qt_syms7.*pinvG1_3+coefs_tq2_6.*coef_Jacob4_qt_syms9.*pinvG3_2+coefs_tq3_6.*coef_Jacob4_qt_syms8.*pinvG2_3+coefs_tq3_6.*coef_Jacob4_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob4_qt_syms24.*pinvG1_1+coefs_tq1_2.*coef_Jacob4_qt_syms25.*pinvG2_1+coefs_tq2_2.*coef_Jacob4_qt_syms24.*pinvG1_2+coefs_tq1_3.*coef_Jacob4_qt_syms17.*pinvG1_1+coefs_tq1_2.*coef_Jacob4_qt_syms26.*pinvG3_1+coefs_tq2_2.*coef_Jacob4_qt_syms25.*pinvG2_2+coefs_tq3_2.*coef_Jacob4_qt_syms24.*pinvG1_3+coefs_tq1_3.*coef_Jacob4_qt_syms18.*pinvG2_1+coefs_tq2_3.*coef_Jacob4_qt_syms17.*pinvG1_2+coefs_tq2_2.*coef_Jacob4_qt_syms26.*pinvG3_2+coefs_tq3_2.*coef_Jacob4_qt_syms25.*pinvG2_3+coefs_tq1_3.*coef_Jacob4_qt_syms19.*pinvG3_1+coefs_tq2_3.*coef_Jacob4_qt_syms18.*pinvG2_2+coefs_tq3_3.*coef_Jacob4_qt_syms17.*pinvG1_3+coefs_tq3_2.*coef_Jacob4_qt_syms26.*pinvG3_3+coefs_tq2_3.*coef_Jacob4_qt_syms19.*pinvG3_2+coefs_tq3_3.*coef_Jacob4_qt_syms18.*pinvG2_3+coefs_tq3_3.*coef_Jacob4_qt_syms19.*pinvG3_3,coef_Jacob1_qt_syms3+coefs_tq1_7.*coef_Jacob1_qt_syms7.*pinvG1_1+coefs_tq1_7.*coef_Jacob1_qt_syms8.*pinvG2_1+coefs_tq2_7.*coef_Jacob1_qt_syms7.*pinvG1_2+coefs_tq1_7.*coef_Jacob1_qt_syms9.*pinvG3_1+coefs_tq2_7.*coef_Jacob1_qt_syms8.*pinvG2_2+coefs_tq3_7.*coef_Jacob1_qt_syms7.*pinvG1_3+coefs_tq2_7.*coef_Jacob1_qt_syms9.*pinvG3_2+coefs_tq3_7.*coef_Jacob1_qt_syms8.*pinvG2_3+coefs_tq3_7.*coef_Jacob1_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob1_qt_syms30.*pinvG2_1+coefs_tq1_2.*coef_Jacob1_qt_syms31.*pinvG3_1+coefs_tq2_2.*coef_Jacob1_qt_syms30.*pinvG2_2+coefs_tq2_2.*coef_Jacob1_qt_syms31.*pinvG3_2+coefs_tq3_2.*coef_Jacob1_qt_syms30.*pinvG2_3+coefs_tq1_4.*coef_Jacob1_qt_syms17.*pinvG1_1+coefs_tq3_2.*coef_Jacob1_qt_syms31.*pinvG3_3+coefs_tq1_2.*coef_Jacob1_qt_syms29.*pinvG1_1+coefs_tq1_4.*coef_Jacob1_qt_syms18.*pinvG2_1+coefs_tq2_4.*coef_Jacob1_qt_syms17.*pinvG1_2+coefs_tq2_2.*coef_Jacob1_qt_syms29.*pinvG1_2+coefs_tq1_4.*coef_Jacob1_qt_syms19.*pinvG3_1+coefs_tq2_4.*coef_Jacob1_qt_syms18.*pinvG2_2+coefs_tq3_4.*coef_Jacob1_qt_syms17.*pinvG1_3+coefs_tq3_2.*coef_Jacob1_qt_syms29.*pinvG1_3+coefs_tq2_4.*coef_Jacob1_qt_syms19.*pinvG3_2+coefs_tq3_4.*coef_Jacob1_qt_syms18.*pinvG2_3+coefs_tq3_4.*coef_Jacob1_qt_syms19.*pinvG3_3,coef_Jacob2_qt_syms3+coefs_tq1_7.*coef_Jacob2_qt_syms7.*pinvG1_1+coefs_tq1_7.*coef_Jacob2_qt_syms8.*pinvG2_1+coefs_tq2_7.*coef_Jacob2_qt_syms7.*pinvG1_2+coefs_tq1_7.*coef_Jacob2_qt_syms9.*pinvG3_1+coefs_tq2_7.*coef_Jacob2_qt_syms8.*pinvG2_2+coefs_tq3_7.*coef_Jacob2_qt_syms7.*pinvG1_3+coefs_tq2_7.*coef_Jacob2_qt_syms9.*pinvG3_2+coefs_tq3_7.*coef_Jacob2_qt_syms8.*pinvG2_3+coefs_tq3_7.*coef_Jacob2_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob2_qt_syms30.*pinvG2_1+coefs_tq1_2.*coef_Jacob2_qt_syms31.*pinvG3_1+coefs_tq2_2.*coef_Jacob2_qt_syms30.*pinvG2_2+coefs_tq2_2.*coef_Jacob2_qt_syms31.*pinvG3_2+coefs_tq3_2.*coef_Jacob2_qt_syms30.*pinvG2_3+coefs_tq1_4.*coef_Jacob2_qt_syms17.*pinvG1_1+coefs_tq3_2.*coef_Jacob2_qt_syms31.*pinvG3_3+coefs_tq1_2.*coef_Jacob2_qt_syms29.*pinvG1_1+coefs_tq1_4.*coef_Jacob2_qt_syms18.*pinvG2_1+coefs_tq2_4.*coef_Jacob2_qt_syms17.*pinvG1_2+coefs_tq2_2.*coef_Jacob2_qt_syms29.*pinvG1_2+coefs_tq1_4.*coef_Jacob2_qt_syms19.*pinvG3_1+coefs_tq2_4.*coef_Jacob2_qt_syms18.*pinvG2_2+coefs_tq3_4.*coef_Jacob2_qt_syms17.*pinvG1_3+coefs_tq3_2.*coef_Jacob2_qt_syms29.*pinvG1_3+coefs_tq2_4.*coef_Jacob2_qt_syms19.*pinvG3_2+coefs_tq3_4.*coef_Jacob2_qt_syms18.*pinvG2_3+coefs_tq3_4.*coef_Jacob2_qt_syms19.*pinvG3_3,coef_Jacob3_qt_syms3+coefs_tq1_7.*coef_Jacob3_qt_syms7.*pinvG1_1+coefs_tq1_7.*coef_Jacob3_qt_syms8.*pinvG2_1+coefs_tq2_7.*coef_Jacob3_qt_syms7.*pinvG1_2+coefs_tq1_7.*coef_Jacob3_qt_syms9.*pinvG3_1+coefs_tq2_7.*coef_Jacob3_qt_syms8.*pinvG2_2+coefs_tq3_7.*coef_Jacob3_qt_syms7.*pinvG1_3+coefs_tq2_7.*coef_Jacob3_qt_syms9.*pinvG3_2+coefs_tq3_7.*coef_Jacob3_qt_syms8.*pinvG2_3+coefs_tq3_7.*coef_Jacob3_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob3_qt_syms30.*pinvG2_1+coefs_tq1_2.*coef_Jacob3_qt_syms31.*pinvG3_1+coefs_tq2_2.*coef_Jacob3_qt_syms30.*pinvG2_2+coefs_tq2_2.*coef_Jacob3_qt_syms31.*pinvG3_2+coefs_tq3_2.*coef_Jacob3_qt_syms30.*pinvG2_3+coefs_tq1_4.*coef_Jacob3_qt_syms17.*pinvG1_1+coefs_tq3_2.*coef_Jacob3_qt_syms31.*pinvG3_3+coefs_tq1_2.*coef_Jacob3_qt_syms29.*pinvG1_1+coefs_tq1_4.*coef_Jacob3_qt_syms18.*pinvG2_1+coefs_tq2_4.*coef_Jacob3_qt_syms17.*pinvG1_2+coefs_tq2_2.*coef_Jacob3_qt_syms29.*pinvG1_2+coefs_tq1_4.*coef_Jacob3_qt_syms19.*pinvG3_1+coefs_tq2_4.*coef_Jacob3_qt_syms18.*pinvG2_2+coefs_tq3_4.*coef_Jacob3_qt_syms17.*pinvG1_3+coefs_tq3_2.*coef_Jacob3_qt_syms29.*pinvG1_3+coefs_tq2_4.*coef_Jacob3_qt_syms19.*pinvG3_2+coefs_tq3_4.*coef_Jacob3_qt_syms18.*pinvG2_3+coefs_tq3_4.*coef_Jacob3_qt_syms19.*pinvG3_3,coef_Jacob4_qt_syms3+coefs_tq1_7.*coef_Jacob4_qt_syms7.*pinvG1_1+coefs_tq1_7.*coef_Jacob4_qt_syms8.*pinvG2_1+coefs_tq2_7.*coef_Jacob4_qt_syms7.*pinvG1_2+coefs_tq1_7.*coef_Jacob4_qt_syms9.*pinvG3_1+coefs_tq2_7.*coef_Jacob4_qt_syms8.*pinvG2_2+coefs_tq3_7.*coef_Jacob4_qt_syms7.*pinvG1_3+coefs_tq2_7.*coef_Jacob4_qt_syms9.*pinvG3_2+coefs_tq3_7.*coef_Jacob4_qt_syms8.*pinvG2_3+coefs_tq3_7.*coef_Jacob4_qt_syms9.*pinvG3_3+coefs_tq1_2.*coef_Jacob4_qt_syms30.*pinvG2_1+coefs_tq1_2.*coef_Jacob4_qt_syms31.*pinvG3_1+coefs_tq2_2.*coef_Jacob4_qt_syms30.*pinvG2_2+coefs_tq2_2.*coef_Jacob4_qt_syms31.*pinvG3_2+coefs_tq3_2.*coef_Jacob4_qt_syms30.*pinvG2_3+coefs_tq1_4.*coef_Jacob4_qt_syms17.*pinvG1_1+coefs_tq3_2.*coef_Jacob4_qt_syms31.*pinvG3_3+coefs_tq1_2.*coef_Jacob4_qt_syms29.*pinvG1_1+coefs_tq1_4.*coef_Jacob4_qt_syms18.*pinvG2_1+coefs_tq2_4.*coef_Jacob4_qt_syms17.*pinvG1_2+coefs_tq2_2.*coef_Jacob4_qt_syms29.*pinvG1_2+coefs_tq1_4.*coef_Jacob4_qt_syms19.*pinvG3_1+coefs_tq2_4.*coef_Jacob4_qt_syms18.*pinvG2_2+coefs_tq3_4.*coef_Jacob4_qt_syms17.*pinvG1_3+coefs_tq3_2.*coef_Jacob4_qt_syms29.*pinvG1_3+coefs_tq2_4.*coef_Jacob4_qt_syms19.*pinvG3_2+coefs_tq3_4.*coef_Jacob4_qt_syms18.*pinvG2_3+coefs_tq3_4.*coef_Jacob4_qt_syms19.*pinvG3_3,coef_Jacob1_qt_syms4+coefs_tq1_8.*coef_Jacob1_qt_syms7.*pinvG1_1+coefs_tq1_8.*coef_Jacob1_qt_syms8.*pinvG2_1+coefs_tq2_8.*coef_Jacob1_qt_syms7.*pinvG1_2+coefs_tq1_8.*coef_Jacob1_qt_syms9.*pinvG3_1+coefs_tq2_8.*coef_Jacob1_qt_syms8.*pinvG2_2+coefs_tq3_8.*coef_Jacob1_qt_syms7.*pinvG1_3+coefs_tq2_8.*coef_Jacob1_qt_syms9.*pinvG3_2+coefs_tq3_8.*coef_Jacob1_qt_syms8.*pinvG2_3+coefs_tq3_8.*coef_Jacob1_qt_syms9.*pinvG3_3+coefs_tq1_3.*coef_Jacob1_qt_syms24.*pinvG1_1+coefs_tq1_3.*coef_Jacob1_qt_syms25.*pinvG2_1+coefs_tq2_3.*coef_Jacob1_qt_syms24.*pinvG1_2+coefs_tq1_3.*coef_Jacob1_qt_syms26.*pinvG3_1+coefs_tq2_3.*coef_Jacob1_qt_syms25.*pinvG2_2+coefs_tq3_3.*coef_Jacob1_qt_syms24.*pinvG1_3+coefs_tq2_3.*coef_Jacob1_qt_syms26.*pinvG3_2+coefs_tq3_3.*coef_Jacob1_qt_syms25.*pinvG2_3+coefs_tq3_3.*coef_Jacob1_qt_syms26.*pinvG3_3,coef_Jacob2_qt_syms4+coefs_tq1_8.*coef_Jacob2_qt_syms7.*pinvG1_1+coefs_tq1_8.*coef_Jacob2_qt_syms8.*pinvG2_1+coefs_tq2_8.*coef_Jacob2_qt_syms7.*pinvG1_2+coefs_tq1_8.*coef_Jacob2_qt_syms9.*pinvG3_1+coefs_tq2_8.*coef_Jacob2_qt_syms8.*pinvG2_2+coefs_tq3_8.*coef_Jacob2_qt_syms7.*pinvG1_3+coefs_tq2_8.*coef_Jacob2_qt_syms9.*pinvG3_2+coefs_tq3_8.*coef_Jacob2_qt_syms8.*pinvG2_3+coefs_tq3_8.*coef_Jacob2_qt_syms9.*pinvG3_3+coefs_tq1_3.*coef_Jacob2_qt_syms24.*pinvG1_1+coefs_tq1_3.*coef_Jacob2_qt_syms25.*pinvG2_1+coefs_tq2_3.*coef_Jacob2_qt_syms24.*pinvG1_2+coefs_tq1_3.*coef_Jacob2_qt_syms26.*pinvG3_1+coefs_tq2_3.*coef_Jacob2_qt_syms25.*pinvG2_2+coefs_tq3_3.*coef_Jacob2_qt_syms24.*pinvG1_3+coefs_tq2_3.*coef_Jacob2_qt_syms26.*pinvG3_2+coefs_tq3_3.*coef_Jacob2_qt_syms25.*pinvG2_3+coefs_tq3_3.*coef_Jacob2_qt_syms26.*pinvG3_3,coef_Jacob3_qt_syms4+coefs_tq1_8.*coef_Jacob3_qt_syms7.*pinvG1_1+coefs_tq1_8.*coef_Jacob3_qt_syms8.*pinvG2_1+coefs_tq2_8.*coef_Jacob3_qt_syms7.*pinvG1_2+coefs_tq1_8.*coef_Jacob3_qt_syms9.*pinvG3_1+coefs_tq2_8.*coef_Jacob3_qt_syms8.*pinvG2_2+coefs_tq3_8.*coef_Jacob3_qt_syms7.*pinvG1_3+coefs_tq2_8.*coef_Jacob3_qt_syms9.*pinvG3_2+coefs_tq3_8.*coef_Jacob3_qt_syms8.*pinvG2_3+coefs_tq3_8.*coef_Jacob3_qt_syms9.*pinvG3_3+coefs_tq1_3.*coef_Jacob3_qt_syms24.*pinvG1_1+coefs_tq1_3.*coef_Jacob3_qt_syms25.*pinvG2_1+coefs_tq2_3.*coef_Jacob3_qt_syms24.*pinvG1_2+coefs_tq1_3.*coef_Jacob3_qt_syms26.*pinvG3_1+coefs_tq2_3.*coef_Jacob3_qt_syms25.*pinvG2_2+coefs_tq3_3.*coef_Jacob3_qt_syms24.*pinvG1_3+coefs_tq2_3.*coef_Jacob3_qt_syms26.*pinvG3_2+coefs_tq3_3.*coef_Jacob3_qt_syms25.*pinvG2_3+coefs_tq3_3.*coef_Jacob3_qt_syms26.*pinvG3_3,coef_Jacob4_qt_syms4+coefs_tq1_8.*coef_Jacob4_qt_syms7.*pinvG1_1+coefs_tq1_8.*coef_Jacob4_qt_syms8.*pinvG2_1+coefs_tq2_8.*coef_Jacob4_qt_syms7.*pinvG1_2+coefs_tq1_8.*coef_Jacob4_qt_syms9.*pinvG3_1+coefs_tq2_8.*coef_Jacob4_qt_syms8.*pinvG2_2+coefs_tq3_8.*coef_Jacob4_qt_syms7.*pinvG1_3+coefs_tq2_8.*coef_Jacob4_qt_syms9.*pinvG3_2+coefs_tq3_8.*coef_Jacob4_qt_syms8.*pinvG2_3+coefs_tq3_8.*coef_Jacob4_qt_syms9.*pinvG3_3+coefs_tq1_3.*coef_Jacob4_qt_syms24.*pinvG1_1+coefs_tq1_3.*coef_Jacob4_qt_syms25.*pinvG2_1+coefs_tq2_3.*coef_Jacob4_qt_syms24.*pinvG1_2+coefs_tq1_3.*coef_Jacob4_qt_syms26.*pinvG3_1+coefs_tq2_3.*coef_Jacob4_qt_syms25.*pinvG2_2+coefs_tq3_3.*coef_Jacob4_qt_syms24.*pinvG1_3+coefs_tq2_3.*coef_Jacob4_qt_syms26.*pinvG3_2+coefs_tq3_3.*coef_Jacob4_qt_syms25.*pinvG2_3+coefs_tq3_3.*coef_Jacob4_qt_syms26.*pinvG3_3,coef_Jacob1_qt_syms5+coefs_tq1_9.*coef_Jacob1_qt_syms7.*pinvG1_1+coefs_tq1_9.*coef_Jacob1_qt_syms8.*pinvG2_1+coefs_tq2_9.*coef_Jacob1_qt_syms7.*pinvG1_2+coefs_tq1_9.*coef_Jacob1_qt_syms9.*pinvG3_1+coefs_tq2_9.*coef_Jacob1_qt_syms8.*pinvG2_2+coefs_tq3_9.*coef_Jacob1_qt_syms7.*pinvG1_3+coefs_tq2_9.*coef_Jacob1_qt_syms9.*pinvG3_2+coefs_tq3_9.*coef_Jacob1_qt_syms8.*pinvG2_3+coefs_tq3_9.*coef_Jacob1_qt_syms9.*pinvG3_3+coefs_tq1_3.*coef_Jacob1_qt_syms30.*pinvG2_1+coefs_tq1_3.*coef_Jacob1_qt_syms31.*pinvG3_1+coefs_tq2_3.*coef_Jacob1_qt_syms30.*pinvG2_2+coefs_tq1_4.*coef_Jacob1_qt_syms24.*pinvG1_1+coefs_tq2_3.*coef_Jacob1_qt_syms31.*pinvG3_2+coefs_tq3_3.*coef_Jacob1_qt_syms30.*pinvG2_3+coefs_tq1_4.*coef_Jacob1_qt_syms25.*pinvG2_1+coefs_tq2_4.*coef_Jacob1_qt_syms24.*pinvG1_2+coefs_tq3_3.*coef_Jacob1_qt_syms31.*pinvG3_3+coefs_tq1_3.*coef_Jacob1_qt_syms29.*pinvG1_1+coefs_tq1_4.*coef_Jacob1_qt_syms26.*pinvG3_1+coefs_tq2_4.*coef_Jacob1_qt_syms25.*pinvG2_2+coefs_tq3_4.*coef_Jacob1_qt_syms24.*pinvG1_3+coefs_tq2_3.*coef_Jacob1_qt_syms29.*pinvG1_2+coefs_tq2_4.*coef_Jacob1_qt_syms26.*pinvG3_2+coefs_tq3_4.*coef_Jacob1_qt_syms25.*pinvG2_3+coefs_tq3_3.*coef_Jacob1_qt_syms29.*pinvG1_3+coefs_tq3_4.*coef_Jacob1_qt_syms26.*pinvG3_3,coef_Jacob2_qt_syms5+coefs_tq1_9.*coef_Jacob2_qt_syms7.*pinvG1_1+coefs_tq1_9.*coef_Jacob2_qt_syms8.*pinvG2_1+coefs_tq2_9.*coef_Jacob2_qt_syms7.*pinvG1_2+coefs_tq1_9.*coef_Jacob2_qt_syms9.*pinvG3_1+coefs_tq2_9.*coef_Jacob2_qt_syms8.*pinvG2_2+coefs_tq3_9.*coef_Jacob2_qt_syms7.*pinvG1_3+coefs_tq2_9.*coef_Jacob2_qt_syms9.*pinvG3_2+coefs_tq3_9.*coef_Jacob2_qt_syms8.*pinvG2_3+coefs_tq3_9.*coef_Jacob2_qt_syms9.*pinvG3_3+coefs_tq1_3.*coef_Jacob2_qt_syms30.*pinvG2_1+coefs_tq1_3.*coef_Jacob2_qt_syms31.*pinvG3_1+coefs_tq2_3.*coef_Jacob2_qt_syms30.*pinvG2_2+coefs_tq1_4.*coef_Jacob2_qt_syms24.*pinvG1_1+coefs_tq2_3.*coef_Jacob2_qt_syms31.*pinvG3_2+coefs_tq3_3.*coef_Jacob2_qt_syms30.*pinvG2_3+coefs_tq1_4.*coef_Jacob2_qt_syms25.*pinvG2_1+coefs_tq2_4.*coef_Jacob2_qt_syms24.*pinvG1_2+coefs_tq3_3.*coef_Jacob2_qt_syms31.*pinvG3_3+coefs_tq1_3.*coef_Jacob2_qt_syms29.*pinvG1_1+coefs_tq1_4.*coef_Jacob2_qt_syms26.*pinvG3_1+coefs_tq2_4.*coef_Jacob2_qt_syms25.*pinvG2_2+coefs_tq3_4.*coef_Jacob2_qt_syms24.*pinvG1_3+coefs_tq2_3.*coef_Jacob2_qt_syms29.*pinvG1_2+coefs_tq2_4.*coef_Jacob2_qt_syms26.*pinvG3_2+coefs_tq3_4.*coef_Jacob2_qt_syms25.*pinvG2_3+coefs_tq3_3.*coef_Jacob2_qt_syms29.*pinvG1_3+coefs_tq3_4.*coef_Jacob2_qt_syms26.*pinvG3_3,coef_Jacob3_qt_syms5+coefs_tq1_9.*coef_Jacob3_qt_syms7.*pinvG1_1+coefs_tq1_9.*coef_Jacob3_qt_syms8.*pinvG2_1+coefs_tq2_9.*coef_Jacob3_qt_syms7.*pinvG1_2+coefs_tq1_9.*coef_Jacob3_qt_syms9.*pinvG3_1+coefs_tq2_9.*coef_Jacob3_qt_syms8.*pinvG2_2+coefs_tq3_9.*coef_Jacob3_qt_syms7.*pinvG1_3+coefs_tq2_9.*coef_Jacob3_qt_syms9.*pinvG3_2+coefs_tq3_9.*coef_Jacob3_qt_syms8.*pinvG2_3+coefs_tq3_9.*coef_Jacob3_qt_syms9.*pinvG3_3+coefs_tq1_3.*coef_Jacob3_qt_syms30.*pinvG2_1+coefs_tq1_3.*coef_Jacob3_qt_syms31.*pinvG3_1+coefs_tq2_3.*coef_Jacob3_qt_syms30.*pinvG2_2+coefs_tq1_4.*coef_Jacob3_qt_syms24.*pinvG1_1+coefs_tq2_3.*coef_Jacob3_qt_syms31.*pinvG3_2+coefs_tq3_3.*coef_Jacob3_qt_syms30.*pinvG2_3+coefs_tq1_4.*coef_Jacob3_qt_syms25.*pinvG2_1+coefs_tq2_4.*coef_Jacob3_qt_syms24.*pinvG1_2+coefs_tq3_3.*coef_Jacob3_qt_syms31.*pinvG3_3+coefs_tq1_3.*coef_Jacob3_qt_syms29.*pinvG1_1+coefs_tq1_4.*coef_Jacob3_qt_syms26.*pinvG3_1+coefs_tq2_4.*coef_Jacob3_qt_syms25.*pinvG2_2+coefs_tq3_4.*coef_Jacob3_qt_syms24.*pinvG1_3+coefs_tq2_3.*coef_Jacob3_qt_syms29.*pinvG1_2+coefs_tq2_4.*coef_Jacob3_qt_syms26.*pinvG3_2+coefs_tq3_4.*coef_Jacob3_qt_syms25.*pinvG2_3+coefs_tq3_3.*coef_Jacob3_qt_syms29.*pinvG1_3+coefs_tq3_4.*coef_Jacob3_qt_syms26.*pinvG3_3,coef_Jacob4_qt_syms5+coefs_tq1_9.*coef_Jacob4_qt_syms7.*pinvG1_1+coefs_tq1_9.*coef_Jacob4_qt_syms8.*pinvG2_1+coefs_tq2_9.*coef_Jacob4_qt_syms7.*pinvG1_2+coefs_tq1_9.*coef_Jacob4_qt_syms9.*pinvG3_1+coefs_tq2_9.*coef_Jacob4_qt_syms8.*pinvG2_2+coefs_tq3_9.*coef_Jacob4_qt_syms7.*pinvG1_3+coefs_tq2_9.*coef_Jacob4_qt_syms9.*pinvG3_2+coefs_tq3_9.*coef_Jacob4_qt_syms8.*pinvG2_3+coefs_tq3_9.*coef_Jacob4_qt_syms9.*pinvG3_3+coefs_tq1_3.*coef_Jacob4_qt_syms30.*pinvG2_1+coefs_tq1_3.*coef_Jacob4_qt_syms31.*pinvG3_1+coefs_tq2_3.*coef_Jacob4_qt_syms30.*pinvG2_2+coefs_tq1_4.*coef_Jacob4_qt_syms24.*pinvG1_1+coefs_tq2_3.*coef_Jacob4_qt_syms31.*pinvG3_2+coefs_tq3_3.*coef_Jacob4_qt_syms30.*pinvG2_3+coefs_tq1_4.*coef_Jacob4_qt_syms25.*pinvG2_1+coefs_tq2_4.*coef_Jacob4_qt_syms24.*pinvG1_2+coefs_tq3_3.*coef_Jacob4_qt_syms31.*pinvG3_3+coefs_tq1_3.*coef_Jacob4_qt_syms29.*pinvG1_1+coefs_tq1_4.*coef_Jacob4_qt_syms26.*pinvG3_1+coefs_tq2_4.*coef_Jacob4_qt_syms25.*pinvG2_2+coefs_tq3_4.*coef_Jacob4_qt_syms24.*pinvG1_3+coefs_tq2_3.*coef_Jacob4_qt_syms29.*pinvG1_2+coefs_tq2_4.*coef_Jacob4_qt_syms26.*pinvG3_2+coefs_tq3_4.*coef_Jacob4_qt_syms25.*pinvG2_3+coefs_tq3_3.*coef_Jacob4_qt_syms29.*pinvG1_3+coefs_tq3_4.*coef_Jacob4_qt_syms26.*pinvG3_3,coef_Jacob1_qt_syms6+coefs_tq1_4.*coef_Jacob1_qt_syms30.*pinvG2_1+coefs_tq1_10.*coef_Jacob1_qt_syms7.*pinvG1_1+coefs_tq1_4.*coef_Jacob1_qt_syms31.*pinvG3_1+coefs_tq2_4.*coef_Jacob1_qt_syms30.*pinvG2_2+coefs_tq1_10.*coef_Jacob1_qt_syms8.*pinvG2_1+coefs_tq2_10.*coef_Jacob1_qt_syms7.*pinvG1_2+coefs_tq2_4.*coef_Jacob1_qt_syms31.*pinvG3_2+coefs_tq3_4.*coef_Jacob1_qt_syms30.*pinvG2_3+coefs_tq1_10.*coef_Jacob1_qt_syms9.*pinvG3_1+coefs_tq2_10.*coef_Jacob1_qt_syms8.*pinvG2_2+coefs_tq3_10.*coef_Jacob1_qt_syms7.*pinvG1_3+coefs_tq3_4.*coef_Jacob1_qt_syms31.*pinvG3_3+coefs_tq2_10.*coef_Jacob1_qt_syms9.*pinvG3_2+coefs_tq3_10.*coef_Jacob1_qt_syms8.*pinvG2_3+coefs_tq1_4.*coef_Jacob1_qt_syms29.*pinvG1_1+coefs_tq3_10.*coef_Jacob1_qt_syms9.*pinvG3_3+coefs_tq2_4.*coef_Jacob1_qt_syms29.*pinvG1_2+coefs_tq3_4.*coef_Jacob1_qt_syms29.*pinvG1_3,coef_Jacob2_qt_syms6+coefs_tq1_4.*coef_Jacob2_qt_syms30.*pinvG2_1+coefs_tq1_10.*coef_Jacob2_qt_syms7.*pinvG1_1+coefs_tq1_4.*coef_Jacob2_qt_syms31.*pinvG3_1+coefs_tq2_4.*coef_Jacob2_qt_syms30.*pinvG2_2+coefs_tq1_10.*coef_Jacob2_qt_syms8.*pinvG2_1+coefs_tq2_10.*coef_Jacob2_qt_syms7.*pinvG1_2+coefs_tq2_4.*coef_Jacob2_qt_syms31.*pinvG3_2+coefs_tq3_4.*coef_Jacob2_qt_syms30.*pinvG2_3+coefs_tq1_10.*coef_Jacob2_qt_syms9.*pinvG3_1+coefs_tq2_10.*coef_Jacob2_qt_syms8.*pinvG2_2+coefs_tq3_10.*coef_Jacob2_qt_syms7.*pinvG1_3+coefs_tq3_4.*coef_Jacob2_qt_syms31.*pinvG3_3+coefs_tq2_10.*coef_Jacob2_qt_syms9.*pinvG3_2+coefs_tq3_10.*coef_Jacob2_qt_syms8.*pinvG2_3+coefs_tq1_4.*coef_Jacob2_qt_syms29.*pinvG1_1+coefs_tq3_10.*coef_Jacob2_qt_syms9.*pinvG3_3+coefs_tq2_4.*coef_Jacob2_qt_syms29.*pinvG1_2+coefs_tq3_4.*coef_Jacob2_qt_syms29.*pinvG1_3,coef_Jacob3_qt_syms6+coefs_tq1_4.*coef_Jacob3_qt_syms30.*pinvG2_1+coefs_tq1_10.*coef_Jacob3_qt_syms7.*pinvG1_1+coefs_tq1_4.*coef_Jacob3_qt_syms31.*pinvG3_1+coefs_tq2_4.*coef_Jacob3_qt_syms30.*pinvG2_2+coefs_tq1_10.*coef_Jacob3_qt_syms8.*pinvG2_1+coefs_tq2_10.*coef_Jacob3_qt_syms7.*pinvG1_2+coefs_tq2_4.*coef_Jacob3_qt_syms31.*pinvG3_2+coefs_tq3_4.*coef_Jacob3_qt_syms30.*pinvG2_3+coefs_tq1_10.*coef_Jacob3_qt_syms9.*pinvG3_1+coefs_tq2_10.*coef_Jacob3_qt_syms8.*pinvG2_2+coefs_tq3_10.*coef_Jacob3_qt_syms7.*pinvG1_3+coefs_tq3_4.*coef_Jacob3_qt_syms31.*pinvG3_3+coefs_tq2_10.*coef_Jacob3_qt_syms9.*pinvG3_2+coefs_tq3_10.*coef_Jacob3_qt_syms8.*pinvG2_3+coefs_tq1_4.*coef_Jacob3_qt_syms29.*pinvG1_1+coefs_tq3_10.*coef_Jacob3_qt_syms9.*pinvG3_3+coefs_tq2_4.*coef_Jacob3_qt_syms29.*pinvG1_2+coefs_tq3_4.*coef_Jacob3_qt_syms29.*pinvG1_3,coef_Jacob4_qt_syms6+coefs_tq1_4.*coef_Jacob4_qt_syms30.*pinvG2_1+coefs_tq1_10.*coef_Jacob4_qt_syms7.*pinvG1_1+coefs_tq1_4.*coef_Jacob4_qt_syms31.*pinvG3_1+coefs_tq2_4.*coef_Jacob4_qt_syms30.*pinvG2_2+coefs_tq1_10.*coef_Jacob4_qt_syms8.*pinvG2_1+coefs_tq2_10.*coef_Jacob4_qt_syms7.*pinvG1_2+coefs_tq2_4.*coef_Jacob4_qt_syms31.*pinvG3_2+coefs_tq3_4.*coef_Jacob4_qt_syms30.*pinvG2_3+coefs_tq1_10.*coef_Jacob4_qt_syms9.*pinvG3_1+coefs_tq2_10.*coef_Jacob4_qt_syms8.*pinvG2_2+coefs_tq3_10.*coef_Jacob4_qt_syms7.*pinvG1_3+coefs_tq3_4.*coef_Jacob4_qt_syms31.*pinvG3_3+coefs_tq2_10.*coef_Jacob4_qt_syms9.*pinvG3_2+coefs_tq3_10.*coef_Jacob4_qt_syms8.*pinvG2_3+coefs_tq1_4.*coef_Jacob4_qt_syms29.*pinvG1_1+coefs_tq3_10.*coef_Jacob4_qt_syms9.*pinvG3_3+coefs_tq2_4.*coef_Jacob4_qt_syms29.*pinvG1_2+coefs_tq3_4.*coef_Jacob4_qt_syms29.*pinvG1_3,coef_Jacob1_qt_syms10,coef_Jacob2_qt_syms10,coef_Jacob3_qt_syms10,coef_Jacob4_qt_syms10,coef_Jacob1_qt_syms11+coefs_tq1_5.*coef_Jacob1_qt_syms17.*pinvG1_1+coefs_tq1_5.*coef_Jacob1_qt_syms18.*pinvG2_1+coefs_tq2_5.*coef_Jacob1_qt_syms17.*pinvG1_2+coefs_tq1_5.*coef_Jacob1_qt_syms19.*pinvG3_1+coefs_tq2_5.*coef_Jacob1_qt_syms18.*pinvG2_2+coefs_tq3_5.*coef_Jacob1_qt_syms17.*pinvG1_3+coefs_tq2_5.*coef_Jacob1_qt_syms19.*pinvG3_2+coefs_tq3_5.*coef_Jacob1_qt_syms18.*pinvG2_3+coefs_tq3_5.*coef_Jacob1_qt_syms19.*pinvG3_3,coef_Jacob2_qt_syms11+coefs_tq1_5.*coef_Jacob2_qt_syms17.*pinvG1_1+coefs_tq1_5.*coef_Jacob2_qt_syms18.*pinvG2_1+coefs_tq2_5.*coef_Jacob2_qt_syms17.*pinvG1_2+coefs_tq1_5.*coef_Jacob2_qt_syms19.*pinvG3_1+coefs_tq2_5.*coef_Jacob2_qt_syms18.*pinvG2_2+coefs_tq3_5.*coef_Jacob2_qt_syms17.*pinvG1_3+coefs_tq2_5.*coef_Jacob2_qt_syms19.*pinvG3_2+coefs_tq3_5.*coef_Jacob2_qt_syms18.*pinvG2_3+coefs_tq3_5.*coef_Jacob2_qt_syms19.*pinvG3_3,coef_Jacob3_qt_syms11+coefs_tq1_5.*coef_Jacob3_qt_syms17.*pinvG1_1+coefs_tq1_5.*coef_Jacob3_qt_syms18.*pinvG2_1+coefs_tq2_5.*coef_Jacob3_qt_syms17.*pinvG1_2+coefs_tq1_5.*coef_Jacob3_qt_syms19.*pinvG3_1+coefs_tq2_5.*coef_Jacob3_qt_syms18.*pinvG2_2+coefs_tq3_5.*coef_Jacob3_qt_syms17.*pinvG1_3+coefs_tq2_5.*coef_Jacob3_qt_syms19.*pinvG3_2+coefs_tq3_5.*coef_Jacob3_qt_syms18.*pinvG2_3+coefs_tq3_5.*coef_Jacob3_qt_syms19.*pinvG3_3,coef_Jacob4_qt_syms11+coefs_tq1_5.*coef_Jacob4_qt_syms17.*pinvG1_1+coefs_tq1_5.*coef_Jacob4_qt_syms18.*pinvG2_1+coefs_tq2_5.*coef_Jacob4_qt_syms17.*pinvG1_2+coefs_tq1_5.*coef_Jacob4_qt_syms19.*pinvG3_1+coefs_tq2_5.*coef_Jacob4_qt_syms18.*pinvG2_2+coefs_tq3_5.*coef_Jacob4_qt_syms17.*pinvG1_3+coefs_tq2_5.*coef_Jacob4_qt_syms19.*pinvG3_2+coefs_tq3_5.*coef_Jacob4_qt_syms18.*pinvG2_3+coefs_tq3_5.*coef_Jacob4_qt_syms19.*pinvG3_3,coef_Jacob1_qt_syms12+coefs_tq1_5.*coef_Jacob1_qt_syms24.*pinvG1_1+coefs_tq1_5.*coef_Jacob1_qt_syms25.*pinvG2_1+coefs_tq2_5.*coef_Jacob1_qt_syms24.*pinvG1_2+coefs_tq1_6.*coef_Jacob1_qt_syms17.*pinvG1_1+coefs_tq1_5.*coef_Jacob1_qt_syms26.*pinvG3_1+coefs_tq2_5.*coef_Jacob1_qt_syms25.*pinvG2_2+coefs_tq3_5.*coef_Jacob1_qt_syms24.*pinvG1_3+coefs_tq1_6.*coef_Jacob1_qt_syms18.*pinvG2_1+coefs_tq2_6.*coef_Jacob1_qt_syms17.*pinvG1_2+coefs_tq2_5.*coef_Jacob1_qt_syms26.*pinvG3_2+coefs_tq3_5.*coef_Jacob1_qt_syms25.*pinvG2_3+coefs_tq1_6.*coef_Jacob1_qt_syms19.*pinvG3_1+coefs_tq2_6.*coef_Jacob1_qt_syms18.*pinvG2_2+coefs_tq3_6.*coef_Jacob1_qt_syms17.*pinvG1_3+coefs_tq3_5.*coef_Jacob1_qt_syms26.*pinvG3_3+coefs_tq2_6.*coef_Jacob1_qt_syms19.*pinvG3_2+coefs_tq3_6.*coef_Jacob1_qt_syms18.*pinvG2_3+coefs_tq3_6.*coef_Jacob1_qt_syms19.*pinvG3_3,coef_Jacob2_qt_syms12+coefs_tq1_5.*coef_Jacob2_qt_syms24.*pinvG1_1+coefs_tq1_5.*coef_Jacob2_qt_syms25.*pinvG2_1+coefs_tq2_5.*coef_Jacob2_qt_syms24.*pinvG1_2+coefs_tq1_6.*coef_Jacob2_qt_syms17.*pinvG1_1+coefs_tq1_5.*coef_Jacob2_qt_syms26.*pinvG3_1+coefs_tq2_5.*coef_Jacob2_qt_syms25.*pinvG2_2+coefs_tq3_5.*coef_Jacob2_qt_syms24.*pinvG1_3+coefs_tq1_6.*coef_Jacob2_qt_syms18.*pinvG2_1+coefs_tq2_6.*coef_Jacob2_qt_syms17.*pinvG1_2+coefs_tq2_5.*coef_Jacob2_qt_syms26.*pinvG3_2+coefs_tq3_5.*coef_Jacob2_qt_syms25.*pinvG2_3+coefs_tq1_6.*coef_Jacob2_qt_syms19.*pinvG3_1+coefs_tq2_6.*coef_Jacob2_qt_syms18.*pinvG2_2+coefs_tq3_6.*coef_Jacob2_qt_syms17.*pinvG1_3+coefs_tq3_5.*coef_Jacob2_qt_syms26.*pinvG3_3+coefs_tq2_6.*coef_Jacob2_qt_syms19.*pinvG3_2+coefs_tq3_6.*coef_Jacob2_qt_syms18.*pinvG2_3+coefs_tq3_6.*coef_Jacob2_qt_syms19.*pinvG3_3,coef_Jacob3_qt_syms12+coefs_tq1_5.*coef_Jacob3_qt_syms24.*pinvG1_1+coefs_tq1_5.*coef_Jacob3_qt_syms25.*pinvG2_1+coefs_tq2_5.*coef_Jacob3_qt_syms24.*pinvG1_2+coefs_tq1_6.*coef_Jacob3_qt_syms17.*pinvG1_1+coefs_tq1_5.*coef_Jacob3_qt_syms26.*pinvG3_1+coefs_tq2_5.*coef_Jacob3_qt_syms25.*pinvG2_2+coefs_tq3_5.*coef_Jacob3_qt_syms24.*pinvG1_3+coefs_tq1_6.*coef_Jacob3_qt_syms18.*pinvG2_1+coefs_tq2_6.*coef_Jacob3_qt_syms17.*pinvG1_2+coefs_tq2_5.*coef_Jacob3_qt_syms26.*pinvG3_2+coefs_tq3_5.*coef_Jacob3_qt_syms25.*pinvG2_3+coefs_tq1_6.*coef_Jacob3_qt_syms19.*pinvG3_1+coefs_tq2_6.*coef_Jacob3_qt_syms18.*pinvG2_2+coefs_tq3_6.*coef_Jacob3_qt_syms17.*pinvG1_3+coefs_tq3_5.*coef_Jacob3_qt_syms26.*pinvG3_3+coefs_tq2_6.*coef_Jacob3_qt_syms19.*pinvG3_2+coefs_tq3_6.*coef_Jacob3_qt_syms18.*pinvG2_3+coefs_tq3_6.*coef_Jacob3_qt_syms19.*pinvG3_3,coef_Jacob4_qt_syms12+coefs_tq1_5.*coef_Jacob4_qt_syms24.*pinvG1_1+coefs_tq1_5.*coef_Jacob4_qt_syms25.*pinvG2_1+coefs_tq2_5.*coef_Jacob4_qt_syms24.*pinvG1_2+coefs_tq1_6.*coef_Jacob4_qt_syms17.*pinvG1_1+coefs_tq1_5.*coef_Jacob4_qt_syms26.*pinvG3_1+coefs_tq2_5.*coef_Jacob4_qt_syms25.*pinvG2_2+coefs_tq3_5.*coef_Jacob4_qt_syms24.*pinvG1_3+coefs_tq1_6.*coef_Jacob4_qt_syms18.*pinvG2_1+coefs_tq2_6.*coef_Jacob4_qt_syms17.*pinvG1_2+coefs_tq2_5.*coef_Jacob4_qt_syms26.*pinvG3_2+coefs_tq3_5.*coef_Jacob4_qt_syms25.*pinvG2_3+coefs_tq1_6.*coef_Jacob4_qt_syms19.*pinvG3_1+coefs_tq2_6.*coef_Jacob4_qt_syms18.*pinvG2_2+coefs_tq3_6.*coef_Jacob4_qt_syms17.*pinvG1_3+coefs_tq3_5.*coef_Jacob4_qt_syms26.*pinvG3_3+coefs_tq2_6.*coef_Jacob4_qt_syms19.*pinvG3_2+coefs_tq3_6.*coef_Jacob4_qt_syms18.*pinvG2_3+coefs_tq3_6.*coef_Jacob4_qt_syms19.*pinvG3_3,coef_Jacob1_qt_syms13+coefs_tq1_5.*coef_Jacob1_qt_syms30.*pinvG2_1+coefs_tq1_5.*coef_Jacob1_qt_syms31.*pinvG3_1+coefs_tq2_5.*coef_Jacob1_qt_syms30.*pinvG2_2+coefs_tq2_5.*coef_Jacob1_qt_syms31.*pinvG3_2+coefs_tq3_5.*coef_Jacob1_qt_syms30.*pinvG2_3+coefs_tq1_7.*coef_Jacob1_qt_syms17.*pinvG1_1+coefs_tq3_5.*coef_Jacob1_qt_syms31.*pinvG3_3+coefs_tq1_5.*coef_Jacob1_qt_syms29.*pinvG1_1+coefs_tq1_7.*coef_Jacob1_qt_syms18.*pinvG2_1+coefs_tq2_7.*coef_Jacob1_qt_syms17.*pinvG1_2+coefs_tq2_5.*coef_Jacob1_qt_syms29.*pinvG1_2+coefs_tq1_7.*coef_Jacob1_qt_syms19.*pinvG3_1+coefs_tq2_7.*coef_Jacob1_qt_syms18.*pinvG2_2+coefs_tq3_7.*coef_Jacob1_qt_syms17.*pinvG1_3+coefs_tq3_5.*coef_Jacob1_qt_syms29.*pinvG1_3+coefs_tq2_7.*coef_Jacob1_qt_syms19.*pinvG3_2+coefs_tq3_7.*coef_Jacob1_qt_syms18.*pinvG2_3+coefs_tq3_7.*coef_Jacob1_qt_syms19.*pinvG3_3,coef_Jacob2_qt_syms13+coefs_tq1_5.*coef_Jacob2_qt_syms30.*pinvG2_1+coefs_tq1_5.*coef_Jacob2_qt_syms31.*pinvG3_1+coefs_tq2_5.*coef_Jacob2_qt_syms30.*pinvG2_2+coefs_tq2_5.*coef_Jacob2_qt_syms31.*pinvG3_2+coefs_tq3_5.*coef_Jacob2_qt_syms30.*pinvG2_3+coefs_tq1_7.*coef_Jacob2_qt_syms17.*pinvG1_1+coefs_tq3_5.*coef_Jacob2_qt_syms31.*pinvG3_3+coefs_tq1_5.*coef_Jacob2_qt_syms29.*pinvG1_1+coefs_tq1_7.*coef_Jacob2_qt_syms18.*pinvG2_1+coefs_tq2_7.*coef_Jacob2_qt_syms17.*pinvG1_2+coefs_tq2_5.*coef_Jacob2_qt_syms29.*pinvG1_2+coefs_tq1_7.*coef_Jacob2_qt_syms19.*pinvG3_1+coefs_tq2_7.*coef_Jacob2_qt_syms18.*pinvG2_2+coefs_tq3_7.*coef_Jacob2_qt_syms17.*pinvG1_3+coefs_tq3_5.*coef_Jacob2_qt_syms29.*pinvG1_3+coefs_tq2_7.*coef_Jacob2_qt_syms19.*pinvG3_2+coefs_tq3_7.*coef_Jacob2_qt_syms18.*pinvG2_3+coefs_tq3_7.*coef_Jacob2_qt_syms19.*pinvG3_3,coef_Jacob3_qt_syms13+coefs_tq1_5.*coef_Jacob3_qt_syms30.*pinvG2_1+coefs_tq1_5.*coef_Jacob3_qt_syms31.*pinvG3_1+coefs_tq2_5.*coef_Jacob3_qt_syms30.*pinvG2_2+coefs_tq2_5.*coef_Jacob3_qt_syms31.*pinvG3_2+coefs_tq3_5.*coef_Jacob3_qt_syms30.*pinvG2_3+coefs_tq1_7.*coef_Jacob3_qt_syms17.*pinvG1_1+coefs_tq3_5.*coef_Jacob3_qt_syms31.*pinvG3_3+coefs_tq1_5.*coef_Jacob3_qt_syms29.*pinvG1_1+coefs_tq1_7.*coef_Jacob3_qt_syms18.*pinvG2_1+coefs_tq2_7.*coef_Jacob3_qt_syms17.*pinvG1_2+coefs_tq2_5.*coef_Jacob3_qt_syms29.*pinvG1_2+coefs_tq1_7.*coef_Jacob3_qt_syms19.*pinvG3_1+coefs_tq2_7.*coef_Jacob3_qt_syms18.*pinvG2_2+coefs_tq3_7.*coef_Jacob3_qt_syms17.*pinvG1_3+coefs_tq3_5.*coef_Jacob3_qt_syms29.*pinvG1_3+coefs_tq2_7.*coef_Jacob3_qt_syms19.*pinvG3_2+coefs_tq3_7.*coef_Jacob3_qt_syms18.*pinvG2_3+coefs_tq3_7.*coef_Jacob3_qt_syms19.*pinvG3_3,coef_Jacob4_qt_syms13+coefs_tq1_5.*coef_Jacob4_qt_syms30.*pinvG2_1+coefs_tq1_5.*coef_Jacob4_qt_syms31.*pinvG3_1+coefs_tq2_5.*coef_Jacob4_qt_syms30.*pinvG2_2+coefs_tq2_5.*coef_Jacob4_qt_syms31.*pinvG3_2+coefs_tq3_5.*coef_Jacob4_qt_syms30.*pinvG2_3+coefs_tq1_7.*coef_Jacob4_qt_syms17.*pinvG1_1+coefs_tq3_5.*coef_Jacob4_qt_syms31.*pinvG3_3+coefs_tq1_5.*coef_Jacob4_qt_syms29.*pinvG1_1+coefs_tq1_7.*coef_Jacob4_qt_syms18.*pinvG2_1+coefs_tq2_7.*coef_Jacob4_qt_syms17.*pinvG1_2+coefs_tq2_5.*coef_Jacob4_qt_syms29.*pinvG1_2+coefs_tq1_7.*coef_Jacob4_qt_syms19.*pinvG3_1+coefs_tq2_7.*coef_Jacob4_qt_syms18.*pinvG2_2+coefs_tq3_7.*coef_Jacob4_qt_syms17.*pinvG1_3+coefs_tq3_5.*coef_Jacob4_qt_syms29.*pinvG1_3+coefs_tq2_7.*coef_Jacob4_qt_syms19.*pinvG3_2+coefs_tq3_7.*coef_Jacob4_qt_syms18.*pinvG2_3+coefs_tq3_7.*coef_Jacob4_qt_syms19.*pinvG3_3,coef_Jacob1_qt_syms14+coefs_tq1_6.*coef_Jacob1_qt_syms24.*pinvG1_1+coefs_tq1_6.*coef_Jacob1_qt_syms25.*pinvG2_1+coefs_tq2_6.*coef_Jacob1_qt_syms24.*pinvG1_2+coefs_tq1_6.*coef_Jacob1_qt_syms26.*pinvG3_1+coefs_tq2_6.*coef_Jacob1_qt_syms25.*pinvG2_2+coefs_tq1_8.*coef_Jacob1_qt_syms17.*pinvG1_1+coefs_tq3_6.*coef_Jacob1_qt_syms24.*pinvG1_3+coefs_tq2_6.*coef_Jacob1_qt_syms26.*pinvG3_2+coefs_tq1_8.*coef_Jacob1_qt_syms18.*pinvG2_1+coefs_tq3_6.*coef_Jacob1_qt_syms25.*pinvG2_3+coefs_tq2_8.*coef_Jacob1_qt_syms17.*pinvG1_2+coefs_tq1_8.*coef_Jacob1_qt_syms19.*pinvG3_1+coefs_tq3_6.*coef_Jacob1_qt_syms26.*pinvG3_3+coefs_tq2_8.*coef_Jacob1_qt_syms18.*pinvG2_2+coefs_tq3_8.*coef_Jacob1_qt_syms17.*pinvG1_3+coefs_tq2_8.*coef_Jacob1_qt_syms19.*pinvG3_2+coefs_tq3_8.*coef_Jacob1_qt_syms18.*pinvG2_3+coefs_tq3_8.*coef_Jacob1_qt_syms19.*pinvG3_3,coef_Jacob2_qt_syms14+coefs_tq1_6.*coef_Jacob2_qt_syms24.*pinvG1_1+coefs_tq1_6.*coef_Jacob2_qt_syms25.*pinvG2_1+coefs_tq2_6.*coef_Jacob2_qt_syms24.*pinvG1_2+coefs_tq1_6.*coef_Jacob2_qt_syms26.*pinvG3_1+coefs_tq2_6.*coef_Jacob2_qt_syms25.*pinvG2_2+coefs_tq1_8.*coef_Jacob2_qt_syms17.*pinvG1_1+coefs_tq3_6.*coef_Jacob2_qt_syms24.*pinvG1_3+coefs_tq2_6.*coef_Jacob2_qt_syms26.*pinvG3_2+coefs_tq1_8.*coef_Jacob2_qt_syms18.*pinvG2_1+coefs_tq3_6.*coef_Jacob2_qt_syms25.*pinvG2_3+coefs_tq2_8.*coef_Jacob2_qt_syms17.*pinvG1_2+coefs_tq1_8.*coef_Jacob2_qt_syms19.*pinvG3_1+coefs_tq3_6.*coef_Jacob2_qt_syms26.*pinvG3_3+coefs_tq2_8.*coef_Jacob2_qt_syms18.*pinvG2_2+coefs_tq3_8.*coef_Jacob2_qt_syms17.*pinvG1_3+coefs_tq2_8.*coef_Jacob2_qt_syms19.*pinvG3_2+coefs_tq3_8.*coef_Jacob2_qt_syms18.*pinvG2_3+coefs_tq3_8.*coef_Jacob2_qt_syms19.*pinvG3_3,coef_Jacob3_qt_syms14+coefs_tq1_6.*coef_Jacob3_qt_syms24.*pinvG1_1+coefs_tq1_6.*coef_Jacob3_qt_syms25.*pinvG2_1+coefs_tq2_6.*coef_Jacob3_qt_syms24.*pinvG1_2+coefs_tq1_6.*coef_Jacob3_qt_syms26.*pinvG3_1+coefs_tq2_6.*coef_Jacob3_qt_syms25.*pinvG2_2+coefs_tq1_8.*coef_Jacob3_qt_syms17.*pinvG1_1+coefs_tq3_6.*coef_Jacob3_qt_syms24.*pinvG1_3+coefs_tq2_6.*coef_Jacob3_qt_syms26.*pinvG3_2+coefs_tq1_8.*coef_Jacob3_qt_syms18.*pinvG2_1+coefs_tq3_6.*coef_Jacob3_qt_syms25.*pinvG2_3+coefs_tq2_8.*coef_Jacob3_qt_syms17.*pinvG1_2+coefs_tq1_8.*coef_Jacob3_qt_syms19.*pinvG3_1+coefs_tq3_6.*coef_Jacob3_qt_syms26.*pinvG3_3+coefs_tq2_8.*coef_Jacob3_qt_syms18.*pinvG2_2+coefs_tq3_8.*coef_Jacob3_qt_syms17.*pinvG1_3+coefs_tq2_8.*coef_Jacob3_qt_syms19.*pinvG3_2+coefs_tq3_8.*coef_Jacob3_qt_syms18.*pinvG2_3+coefs_tq3_8.*coef_Jacob3_qt_syms19.*pinvG3_3,coef_Jacob4_qt_syms14+coefs_tq1_6.*coef_Jacob4_qt_syms24.*pinvG1_1+coefs_tq1_6.*coef_Jacob4_qt_syms25.*pinvG2_1+coefs_tq2_6.*coef_Jacob4_qt_syms24.*pinvG1_2+coefs_tq1_6.*coef_Jacob4_qt_syms26.*pinvG3_1+coefs_tq2_6.*coef_Jacob4_qt_syms25.*pinvG2_2+coefs_tq1_8.*coef_Jacob4_qt_syms17.*pinvG1_1+coefs_tq3_6.*coef_Jacob4_qt_syms24.*pinvG1_3+coefs_tq2_6.*coef_Jacob4_qt_syms26.*pinvG3_2+coefs_tq1_8.*coef_Jacob4_qt_syms18.*pinvG2_1+coefs_tq3_6.*coef_Jacob4_qt_syms25.*pinvG2_3+coefs_tq2_8.*coef_Jacob4_qt_syms17.*pinvG1_2+coefs_tq1_8.*coef_Jacob4_qt_syms19.*pinvG3_1+coefs_tq3_6.*coef_Jacob4_qt_syms26.*pinvG3_3+coefs_tq2_8.*coef_Jacob4_qt_syms18.*pinvG2_2+coefs_tq3_8.*coef_Jacob4_qt_syms17.*pinvG1_3+coefs_tq2_8.*coef_Jacob4_qt_syms19.*pinvG3_2+coefs_tq3_8.*coef_Jacob4_qt_syms18.*pinvG2_3+coefs_tq3_8.*coef_Jacob4_qt_syms19.*pinvG3_3,coef_Jacob1_qt_syms15+coefs_tq1_6.*coef_Jacob1_qt_syms30.*pinvG2_1+coefs_tq1_6.*coef_Jacob1_qt_syms31.*pinvG3_1+coefs_tq2_6.*coef_Jacob1_qt_syms30.*pinvG2_2+coefs_tq1_7.*coef_Jacob1_qt_syms24.*pinvG1_1+coefs_tq2_6.*coef_Jacob1_qt_syms31.*pinvG3_2+coefs_tq3_6.*coef_Jacob1_qt_syms30.*pinvG2_3+coefs_tq1_7.*coef_Jacob1_qt_syms25.*pinvG2_1+coefs_tq2_7.*coef_Jacob1_qt_syms24.*pinvG1_2+coefs_tq3_6.*coef_Jacob1_qt_syms31.*pinvG3_3+coefs_tq1_6.*coef_Jacob1_qt_syms29.*pinvG1_1+coefs_tq1_7.*coef_Jacob1_qt_syms26.*pinvG3_1+coefs_tq2_7.*coef_Jacob1_qt_syms25.*pinvG2_2+coefs_tq1_9.*coef_Jacob1_qt_syms17.*pinvG1_1+coefs_tq3_7.*coef_Jacob1_qt_syms24.*pinvG1_3+coefs_tq2_6.*coef_Jacob1_qt_syms29.*pinvG1_2+coefs_tq2_7.*coef_Jacob1_qt_syms26.*pinvG3_2+coefs_tq1_9.*coef_Jacob1_qt_syms18.*pinvG2_1+coefs_tq3_7.*coef_Jacob1_qt_syms25.*pinvG2_3+coefs_tq2_9.*coef_Jacob1_qt_syms17.*pinvG1_2+coefs_tq3_6.*coef_Jacob1_qt_syms29.*pinvG1_3+coefs_tq1_9.*coef_Jacob1_qt_syms19.*pinvG3_1+coefs_tq3_7.*coef_Jacob1_qt_syms26.*pinvG3_3+coefs_tq2_9.*coef_Jacob1_qt_syms18.*pinvG2_2+coefs_tq3_9.*coef_Jacob1_qt_syms17.*pinvG1_3+coefs_tq2_9.*coef_Jacob1_qt_syms19.*pinvG3_2+coefs_tq3_9.*coef_Jacob1_qt_syms18.*pinvG2_3+coefs_tq3_9.*coef_Jacob1_qt_syms19.*pinvG3_3,coef_Jacob2_qt_syms15+coefs_tq1_6.*coef_Jacob2_qt_syms30.*pinvG2_1+coefs_tq1_6.*coef_Jacob2_qt_syms31.*pinvG3_1+coefs_tq2_6.*coef_Jacob2_qt_syms30.*pinvG2_2+coefs_tq1_7.*coef_Jacob2_qt_syms24.*pinvG1_1+coefs_tq2_6.*coef_Jacob2_qt_syms31.*pinvG3_2+coefs_tq3_6.*coef_Jacob2_qt_syms30.*pinvG2_3+coefs_tq1_7.*coef_Jacob2_qt_syms25.*pinvG2_1+coefs_tq2_7.*coef_Jacob2_qt_syms24.*pinvG1_2+coefs_tq3_6.*coef_Jacob2_qt_syms31.*pinvG3_3+coefs_tq1_6.*coef_Jacob2_qt_syms29.*pinvG1_1+coefs_tq1_7.*coef_Jacob2_qt_syms26.*pinvG3_1+coefs_tq2_7.*coef_Jacob2_qt_syms25.*pinvG2_2+coefs_tq1_9.*coef_Jacob2_qt_syms17.*pinvG1_1+coefs_tq3_7.*coef_Jacob2_qt_syms24.*pinvG1_3+coefs_tq2_6.*coef_Jacob2_qt_syms29.*pinvG1_2+coefs_tq2_7.*coef_Jacob2_qt_syms26.*pinvG3_2+coefs_tq1_9.*coef_Jacob2_qt_syms18.*pinvG2_1+coefs_tq3_7.*coef_Jacob2_qt_syms25.*pinvG2_3+coefs_tq2_9.*coef_Jacob2_qt_syms17.*pinvG1_2+coefs_tq3_6.*coef_Jacob2_qt_syms29.*pinvG1_3+coefs_tq1_9.*coef_Jacob2_qt_syms19.*pinvG3_1+coefs_tq3_7.*coef_Jacob2_qt_syms26.*pinvG3_3+coefs_tq2_9.*coef_Jacob2_qt_syms18.*pinvG2_2+coefs_tq3_9.*coef_Jacob2_qt_syms17.*pinvG1_3+coefs_tq2_9.*coef_Jacob2_qt_syms19.*pinvG3_2+coefs_tq3_9.*coef_Jacob2_qt_syms18.*pinvG2_3+coefs_tq3_9.*coef_Jacob2_qt_syms19.*pinvG3_3,coef_Jacob3_qt_syms15+coefs_tq1_6.*coef_Jacob3_qt_syms30.*pinvG2_1+coefs_tq1_6.*coef_Jacob3_qt_syms31.*pinvG3_1+coefs_tq2_6.*coef_Jacob3_qt_syms30.*pinvG2_2+coefs_tq1_7.*coef_Jacob3_qt_syms24.*pinvG1_1+coefs_tq2_6.*coef_Jacob3_qt_syms31.*pinvG3_2+coefs_tq3_6.*coef_Jacob3_qt_syms30.*pinvG2_3+coefs_tq1_7.*coef_Jacob3_qt_syms25.*pinvG2_1+coefs_tq2_7.*coef_Jacob3_qt_syms24.*pinvG1_2+coefs_tq3_6.*coef_Jacob3_qt_syms31.*pinvG3_3+coefs_tq1_6.*coef_Jacob3_qt_syms29.*pinvG1_1+coefs_tq1_7.*coef_Jacob3_qt_syms26.*pinvG3_1+coefs_tq2_7.*coef_Jacob3_qt_syms25.*pinvG2_2+coefs_tq1_9.*coef_Jacob3_qt_syms17.*pinvG1_1+coefs_tq3_7.*coef_Jacob3_qt_syms24.*pinvG1_3+coefs_tq2_6.*coef_Jacob3_qt_syms29.*pinvG1_2+coefs_tq2_7.*coef_Jacob3_qt_syms26.*pinvG3_2+coefs_tq1_9.*coef_Jacob3_qt_syms18.*pinvG2_1+coefs_tq3_7.*coef_Jacob3_qt_syms25.*pinvG2_3+coefs_tq2_9.*coef_Jacob3_qt_syms17.*pinvG1_2+coefs_tq3_6.*coef_Jacob3_qt_syms29.*pinvG1_3+coefs_tq1_9.*coef_Jacob3_qt_syms19.*pinvG3_1+coefs_tq3_7.*coef_Jacob3_qt_syms26.*pinvG3_3+coefs_tq2_9.*coef_Jacob3_qt_syms18.*pinvG2_2+coefs_tq3_9.*coef_Jacob3_qt_syms17.*pinvG1_3+coefs_tq2_9.*coef_Jacob3_qt_syms19.*pinvG3_2+coefs_tq3_9.*coef_Jacob3_qt_syms18.*pinvG2_3+coefs_tq3_9.*coef_Jacob3_qt_syms19.*pinvG3_3,coef_Jacob4_qt_syms15+coefs_tq1_6.*coef_Jacob4_qt_syms30.*pinvG2_1+coefs_tq1_6.*coef_Jacob4_qt_syms31.*pinvG3_1+coefs_tq2_6.*coef_Jacob4_qt_syms30.*pinvG2_2+coefs_tq1_7.*coef_Jacob4_qt_syms24.*pinvG1_1+coefs_tq2_6.*coef_Jacob4_qt_syms31.*pinvG3_2+coefs_tq3_6.*coef_Jacob4_qt_syms30.*pinvG2_3+coefs_tq1_7.*coef_Jacob4_qt_syms25.*pinvG2_1+coefs_tq2_7.*coef_Jacob4_qt_syms24.*pinvG1_2+coefs_tq3_6.*coef_Jacob4_qt_syms31.*pinvG3_3+coefs_tq1_6.*coef_Jacob4_qt_syms29.*pinvG1_1+coefs_tq1_7.*coef_Jacob4_qt_syms26.*pinvG3_1+coefs_tq2_7.*coef_Jacob4_qt_syms25.*pinvG2_2+coefs_tq1_9.*coef_Jacob4_qt_syms17.*pinvG1_1+coefs_tq3_7.*coef_Jacob4_qt_syms24.*pinvG1_3+coefs_tq2_6.*coef_Jacob4_qt_syms29.*pinvG1_2+coefs_tq2_7.*coef_Jacob4_qt_syms26.*pinvG3_2+coefs_tq1_9.*coef_Jacob4_qt_syms18.*pinvG2_1+coefs_tq3_7.*coef_Jacob4_qt_syms25.*pinvG2_3+coefs_tq2_9.*coef_Jacob4_qt_syms17.*pinvG1_2+coefs_tq3_6.*coef_Jacob4_qt_syms29.*pinvG1_3+coefs_tq1_9.*coef_Jacob4_qt_syms19.*pinvG3_1+coefs_tq3_7.*coef_Jacob4_qt_syms26.*pinvG3_3+coefs_tq2_9.*coef_Jacob4_qt_syms18.*pinvG2_2+coefs_tq3_9.*coef_Jacob4_qt_syms17.*pinvG1_3+coefs_tq2_9.*coef_Jacob4_qt_syms19.*pinvG3_2+coefs_tq3_9.*coef_Jacob4_qt_syms18.*pinvG2_3+coefs_tq3_9.*coef_Jacob4_qt_syms19.*pinvG3_3,coef_Jacob1_qt_syms16+coefs_tq1_7.*coef_Jacob1_qt_syms30.*pinvG2_1+coefs_tq1_7.*coef_Jacob1_qt_syms31.*pinvG3_1+coefs_tq2_7.*coef_Jacob1_qt_syms30.*pinvG2_2+coefs_tq2_7.*coef_Jacob1_qt_syms31.*pinvG3_2+coefs_tq3_7.*coef_Jacob1_qt_syms30.*pinvG2_3+coefs_tq3_7.*coef_Jacob1_qt_syms31.*pinvG3_3+coefs_tq1_7.*coef_Jacob1_qt_syms29.*pinvG1_1+coefs_tq2_7.*coef_Jacob1_qt_syms29.*pinvG1_2+coefs_tq3_7.*coef_Jacob1_qt_syms29.*pinvG1_3+coefs_tq1_10.*coef_Jacob1_qt_syms17.*pinvG1_1+coefs_tq1_10.*coef_Jacob1_qt_syms18.*pinvG2_1+coefs_tq2_10.*coef_Jacob1_qt_syms17.*pinvG1_2+coefs_tq1_10.*coef_Jacob1_qt_syms19.*pinvG3_1+coefs_tq2_10.*coef_Jacob1_qt_syms18.*pinvG2_2+coefs_tq3_10.*coef_Jacob1_qt_syms17.*pinvG1_3+coefs_tq2_10.*coef_Jacob1_qt_syms19.*pinvG3_2+coefs_tq3_10.*coef_Jacob1_qt_syms18.*pinvG2_3+coefs_tq3_10.*coef_Jacob1_qt_syms19.*pinvG3_3,coef_Jacob2_qt_syms16+coefs_tq1_7.*coef_Jacob2_qt_syms30.*pinvG2_1+coefs_tq1_7.*coef_Jacob2_qt_syms31.*pinvG3_1+coefs_tq2_7.*coef_Jacob2_qt_syms30.*pinvG2_2+coefs_tq2_7.*coef_Jacob2_qt_syms31.*pinvG3_2+coefs_tq3_7.*coef_Jacob2_qt_syms30.*pinvG2_3+coefs_tq3_7.*coef_Jacob2_qt_syms31.*pinvG3_3+coefs_tq1_7.*coef_Jacob2_qt_syms29.*pinvG1_1+coefs_tq2_7.*coef_Jacob2_qt_syms29.*pinvG1_2+coefs_tq3_7.*coef_Jacob2_qt_syms29.*pinvG1_3+coefs_tq1_10.*coef_Jacob2_qt_syms17.*pinvG1_1+coefs_tq1_10.*coef_Jacob2_qt_syms18.*pinvG2_1+coefs_tq2_10.*coef_Jacob2_qt_syms17.*pinvG1_2+coefs_tq1_10.*coef_Jacob2_qt_syms19.*pinvG3_1+coefs_tq2_10.*coef_Jacob2_qt_syms18.*pinvG2_2+coefs_tq3_10.*coef_Jacob2_qt_syms17.*pinvG1_3+coefs_tq2_10.*coef_Jacob2_qt_syms19.*pinvG3_2+coefs_tq3_10.*coef_Jacob2_qt_syms18.*pinvG2_3+coefs_tq3_10.*coef_Jacob2_qt_syms19.*pinvG3_3,coef_Jacob3_qt_syms16+coefs_tq1_7.*coef_Jacob3_qt_syms30.*pinvG2_1+coefs_tq1_7.*coef_Jacob3_qt_syms31.*pinvG3_1+coefs_tq2_7.*coef_Jacob3_qt_syms30.*pinvG2_2+coefs_tq2_7.*coef_Jacob3_qt_syms31.*pinvG3_2+coefs_tq3_7.*coef_Jacob3_qt_syms30.*pinvG2_3+coefs_tq3_7.*coef_Jacob3_qt_syms31.*pinvG3_3+coefs_tq1_7.*coef_Jacob3_qt_syms29.*pinvG1_1+coefs_tq2_7.*coef_Jacob3_qt_syms29.*pinvG1_2+coefs_tq3_7.*coef_Jacob3_qt_syms29.*pinvG1_3+coefs_tq1_10.*coef_Jacob3_qt_syms17.*pinvG1_1+coefs_tq1_10.*coef_Jacob3_qt_syms18.*pinvG2_1+coefs_tq2_10.*coef_Jacob3_qt_syms17.*pinvG1_2+coefs_tq1_10.*coef_Jacob3_qt_syms19.*pinvG3_1+coefs_tq2_10.*coef_Jacob3_qt_syms18.*pinvG2_2+coefs_tq3_10.*coef_Jacob3_qt_syms17.*pinvG1_3+coefs_tq2_10.*coef_Jacob3_qt_syms19.*pinvG3_2+coefs_tq3_10.*coef_Jacob3_qt_syms18.*pinvG2_3+coefs_tq3_10.*coef_Jacob3_qt_syms19.*pinvG3_3,coef_Jacob4_qt_syms16+coefs_tq1_7.*coef_Jacob4_qt_syms30.*pinvG2_1+coefs_tq1_7.*coef_Jacob4_qt_syms31.*pinvG3_1+coefs_tq2_7.*coef_Jacob4_qt_syms30.*pinvG2_2+coefs_tq2_7.*coef_Jacob4_qt_syms31.*pinvG3_2+coefs_tq3_7.*coef_Jacob4_qt_syms30.*pinvG2_3+coefs_tq3_7.*coef_Jacob4_qt_syms31.*pinvG3_3+coefs_tq1_7.*coef_Jacob4_qt_syms29.*pinvG1_1+coefs_tq2_7.*coef_Jacob4_qt_syms29.*pinvG1_2+coefs_tq3_7.*coef_Jacob4_qt_syms29.*pinvG1_3+coefs_tq1_10.*coef_Jacob4_qt_syms17.*pinvG1_1+coefs_tq1_10.*coef_Jacob4_qt_syms18.*pinvG2_1+coefs_tq2_10.*coef_Jacob4_qt_syms17.*pinvG1_2+coefs_tq1_10.*coef_Jacob4_qt_syms19.*pinvG3_1+coefs_tq2_10.*coef_Jacob4_qt_syms18.*pinvG2_2+coefs_tq3_10.*coef_Jacob4_qt_syms17.*pinvG1_3+coefs_tq2_10.*coef_Jacob4_qt_syms19.*pinvG3_2+coefs_tq3_10.*coef_Jacob4_qt_syms18.*pinvG2_3+coefs_tq3_10.*coef_Jacob4_qt_syms19.*pinvG3_3,coef_Jacob1_qt_syms20,coef_Jacob2_qt_syms20,coef_Jacob3_qt_syms20,coef_Jacob4_qt_syms20,coef_Jacob1_qt_syms21+coefs_tq1_8.*coef_Jacob1_qt_syms24.*pinvG1_1+coefs_tq1_8.*coef_Jacob1_qt_syms25.*pinvG2_1+coefs_tq2_8.*coef_Jacob1_qt_syms24.*pinvG1_2+coefs_tq1_8.*coef_Jacob1_qt_syms26.*pinvG3_1+coefs_tq2_8.*coef_Jacob1_qt_syms25.*pinvG2_2+coefs_tq3_8.*coef_Jacob1_qt_syms24.*pinvG1_3+coefs_tq2_8.*coef_Jacob1_qt_syms26.*pinvG3_2+coefs_tq3_8.*coef_Jacob1_qt_syms25.*pinvG2_3+coefs_tq3_8.*coef_Jacob1_qt_syms26.*pinvG3_3,coef_Jacob2_qt_syms21+coefs_tq1_8.*coef_Jacob2_qt_syms24.*pinvG1_1+coefs_tq1_8.*coef_Jacob2_qt_syms25.*pinvG2_1+coefs_tq2_8.*coef_Jacob2_qt_syms24.*pinvG1_2+coefs_tq1_8.*coef_Jacob2_qt_syms26.*pinvG3_1+coefs_tq2_8.*coef_Jacob2_qt_syms25.*pinvG2_2+coefs_tq3_8.*coef_Jacob2_qt_syms24.*pinvG1_3+coefs_tq2_8.*coef_Jacob2_qt_syms26.*pinvG3_2+coefs_tq3_8.*coef_Jacob2_qt_syms25.*pinvG2_3+coefs_tq3_8.*coef_Jacob2_qt_syms26.*pinvG3_3,coef_Jacob3_qt_syms21+coefs_tq1_8.*coef_Jacob3_qt_syms24.*pinvG1_1+coefs_tq1_8.*coef_Jacob3_qt_syms25.*pinvG2_1+coefs_tq2_8.*coef_Jacob3_qt_syms24.*pinvG1_2+coefs_tq1_8.*coef_Jacob3_qt_syms26.*pinvG3_1+coefs_tq2_8.*coef_Jacob3_qt_syms25.*pinvG2_2+coefs_tq3_8.*coef_Jacob3_qt_syms24.*pinvG1_3+coefs_tq2_8.*coef_Jacob3_qt_syms26.*pinvG3_2+coefs_tq3_8.*coef_Jacob3_qt_syms25.*pinvG2_3+coefs_tq3_8.*coef_Jacob3_qt_syms26.*pinvG3_3,coef_Jacob4_qt_syms21+coefs_tq1_8.*coef_Jacob4_qt_syms24.*pinvG1_1+coefs_tq1_8.*coef_Jacob4_qt_syms25.*pinvG2_1+coefs_tq2_8.*coef_Jacob4_qt_syms24.*pinvG1_2+coefs_tq1_8.*coef_Jacob4_qt_syms26.*pinvG3_1+coefs_tq2_8.*coef_Jacob4_qt_syms25.*pinvG2_2+coefs_tq3_8.*coef_Jacob4_qt_syms24.*pinvG1_3+coefs_tq2_8.*coef_Jacob4_qt_syms26.*pinvG3_2+coefs_tq3_8.*coef_Jacob4_qt_syms25.*pinvG2_3+coefs_tq3_8.*coef_Jacob4_qt_syms26.*pinvG3_3,coef_Jacob1_qt_syms22+coefs_tq1_8.*coef_Jacob1_qt_syms30.*pinvG2_1+coefs_tq1_8.*coef_Jacob1_qt_syms31.*pinvG3_1+coefs_tq2_8.*coef_Jacob1_qt_syms30.*pinvG2_2+coefs_tq1_9.*coef_Jacob1_qt_syms24.*pinvG1_1+coefs_tq2_8.*coef_Jacob1_qt_syms31.*pinvG3_2+coefs_tq3_8.*coef_Jacob1_qt_syms30.*pinvG2_3+coefs_tq1_9.*coef_Jacob1_qt_syms25.*pinvG2_1+coefs_tq2_9.*coef_Jacob1_qt_syms24.*pinvG1_2+coefs_tq3_8.*coef_Jacob1_qt_syms31.*pinvG3_3+coefs_tq1_8.*coef_Jacob1_qt_syms29.*pinvG1_1+coefs_tq1_9.*coef_Jacob1_qt_syms26.*pinvG3_1+coefs_tq2_9.*coef_Jacob1_qt_syms25.*pinvG2_2+coefs_tq3_9.*coef_Jacob1_qt_syms24.*pinvG1_3+coefs_tq2_8.*coef_Jacob1_qt_syms29.*pinvG1_2+coefs_tq2_9.*coef_Jacob1_qt_syms26.*pinvG3_2+coefs_tq3_9.*coef_Jacob1_qt_syms25.*pinvG2_3+coefs_tq3_8.*coef_Jacob1_qt_syms29.*pinvG1_3+coefs_tq3_9.*coef_Jacob1_qt_syms26.*pinvG3_3,coef_Jacob2_qt_syms22+coefs_tq1_8.*coef_Jacob2_qt_syms30.*pinvG2_1+coefs_tq1_8.*coef_Jacob2_qt_syms31.*pinvG3_1+coefs_tq2_8.*coef_Jacob2_qt_syms30.*pinvG2_2+coefs_tq1_9.*coef_Jacob2_qt_syms24.*pinvG1_1+coefs_tq2_8.*coef_Jacob2_qt_syms31.*pinvG3_2+coefs_tq3_8.*coef_Jacob2_qt_syms30.*pinvG2_3+coefs_tq1_9.*coef_Jacob2_qt_syms25.*pinvG2_1+coefs_tq2_9.*coef_Jacob2_qt_syms24.*pinvG1_2+coefs_tq3_8.*coef_Jacob2_qt_syms31.*pinvG3_3+coefs_tq1_8.*coef_Jacob2_qt_syms29.*pinvG1_1+coefs_tq1_9.*coef_Jacob2_qt_syms26.*pinvG3_1+coefs_tq2_9.*coef_Jacob2_qt_syms25.*pinvG2_2+coefs_tq3_9.*coef_Jacob2_qt_syms24.*pinvG1_3+coefs_tq2_8.*coef_Jacob2_qt_syms29.*pinvG1_2+coefs_tq2_9.*coef_Jacob2_qt_syms26.*pinvG3_2+coefs_tq3_9.*coef_Jacob2_qt_syms25.*pinvG2_3+coefs_tq3_8.*coef_Jacob2_qt_syms29.*pinvG1_3+coefs_tq3_9.*coef_Jacob2_qt_syms26.*pinvG3_3,coef_Jacob3_qt_syms22+coefs_tq1_8.*coef_Jacob3_qt_syms30.*pinvG2_1+coefs_tq1_8.*coef_Jacob3_qt_syms31.*pinvG3_1+coefs_tq2_8.*coef_Jacob3_qt_syms30.*pinvG2_2+coefs_tq1_9.*coef_Jacob3_qt_syms24.*pinvG1_1+coefs_tq2_8.*coef_Jacob3_qt_syms31.*pinvG3_2+coefs_tq3_8.*coef_Jacob3_qt_syms30.*pinvG2_3+coefs_tq1_9.*coef_Jacob3_qt_syms25.*pinvG2_1+coefs_tq2_9.*coef_Jacob3_qt_syms24.*pinvG1_2+coefs_tq3_8.*coef_Jacob3_qt_syms31.*pinvG3_3+coefs_tq1_8.*coef_Jacob3_qt_syms29.*pinvG1_1+coefs_tq1_9.*coef_Jacob3_qt_syms26.*pinvG3_1+coefs_tq2_9.*coef_Jacob3_qt_syms25.*pinvG2_2+coefs_tq3_9.*coef_Jacob3_qt_syms24.*pinvG1_3+coefs_tq2_8.*coef_Jacob3_qt_syms29.*pinvG1_2+coefs_tq2_9.*coef_Jacob3_qt_syms26.*pinvG3_2+coefs_tq3_9.*coef_Jacob3_qt_syms25.*pinvG2_3+coefs_tq3_8.*coef_Jacob3_qt_syms29.*pinvG1_3+coefs_tq3_9.*coef_Jacob3_qt_syms26.*pinvG3_3,coef_Jacob4_qt_syms22+coefs_tq1_8.*coef_Jacob4_qt_syms30.*pinvG2_1+coefs_tq1_8.*coef_Jacob4_qt_syms31.*pinvG3_1+coefs_tq2_8.*coef_Jacob4_qt_syms30.*pinvG2_2+coefs_tq1_9.*coef_Jacob4_qt_syms24.*pinvG1_1+coefs_tq2_8.*coef_Jacob4_qt_syms31.*pinvG3_2+coefs_tq3_8.*coef_Jacob4_qt_syms30.*pinvG2_3+coefs_tq1_9.*coef_Jacob4_qt_syms25.*pinvG2_1+coefs_tq2_9.*coef_Jacob4_qt_syms24.*pinvG1_2+coefs_tq3_8.*coef_Jacob4_qt_syms31.*pinvG3_3+coefs_tq1_8.*coef_Jacob4_qt_syms29.*pinvG1_1+coefs_tq1_9.*coef_Jacob4_qt_syms26.*pinvG3_1+coefs_tq2_9.*coef_Jacob4_qt_syms25.*pinvG2_2+coefs_tq3_9.*coef_Jacob4_qt_syms24.*pinvG1_3+coefs_tq2_8.*coef_Jacob4_qt_syms29.*pinvG1_2+coefs_tq2_9.*coef_Jacob4_qt_syms26.*pinvG3_2+coefs_tq3_9.*coef_Jacob4_qt_syms25.*pinvG2_3+coefs_tq3_8.*coef_Jacob4_qt_syms29.*pinvG1_3+coefs_tq3_9.*coef_Jacob4_qt_syms26.*pinvG3_3,coef_Jacob1_qt_syms23+coefs_tq1_9.*coef_Jacob1_qt_syms30.*pinvG2_1+coefs_tq1_9.*coef_Jacob1_qt_syms31.*pinvG3_1+coefs_tq2_9.*coef_Jacob1_qt_syms30.*pinvG2_2+coefs_tq2_9.*coef_Jacob1_qt_syms31.*pinvG3_2+coefs_tq3_9.*coef_Jacob1_qt_syms30.*pinvG2_3+coefs_tq3_9.*coef_Jacob1_qt_syms31.*pinvG3_3+coefs_tq1_9.*coef_Jacob1_qt_syms29.*pinvG1_1+coefs_tq2_9.*coef_Jacob1_qt_syms29.*pinvG1_2+coefs_tq3_9.*coef_Jacob1_qt_syms29.*pinvG1_3+coefs_tq1_10.*coef_Jacob1_qt_syms24.*pinvG1_1+coefs_tq1_10.*coef_Jacob1_qt_syms25.*pinvG2_1+coefs_tq2_10.*coef_Jacob1_qt_syms24.*pinvG1_2+coefs_tq1_10.*coef_Jacob1_qt_syms26.*pinvG3_1+coefs_tq2_10.*coef_Jacob1_qt_syms25.*pinvG2_2+coefs_tq3_10.*coef_Jacob1_qt_syms24.*pinvG1_3+coefs_tq2_10.*coef_Jacob1_qt_syms26.*pinvG3_2+coefs_tq3_10.*coef_Jacob1_qt_syms25.*pinvG2_3+coefs_tq3_10.*coef_Jacob1_qt_syms26.*pinvG3_3,coef_Jacob2_qt_syms23+coefs_tq1_9.*coef_Jacob2_qt_syms30.*pinvG2_1+coefs_tq1_9.*coef_Jacob2_qt_syms31.*pinvG3_1+coefs_tq2_9.*coef_Jacob2_qt_syms30.*pinvG2_2+coefs_tq2_9.*coef_Jacob2_qt_syms31.*pinvG3_2+coefs_tq3_9.*coef_Jacob2_qt_syms30.*pinvG2_3+coefs_tq3_9.*coef_Jacob2_qt_syms31.*pinvG3_3+coefs_tq1_9.*coef_Jacob2_qt_syms29.*pinvG1_1+coefs_tq2_9.*coef_Jacob2_qt_syms29.*pinvG1_2+coefs_tq3_9.*coef_Jacob2_qt_syms29.*pinvG1_3+coefs_tq1_10.*coef_Jacob2_qt_syms24.*pinvG1_1+coefs_tq1_10.*coef_Jacob2_qt_syms25.*pinvG2_1+coefs_tq2_10.*coef_Jacob2_qt_syms24.*pinvG1_2+coefs_tq1_10.*coef_Jacob2_qt_syms26.*pinvG3_1+coefs_tq2_10.*coef_Jacob2_qt_syms25.*pinvG2_2+coefs_tq3_10.*coef_Jacob2_qt_syms24.*pinvG1_3+coefs_tq2_10.*coef_Jacob2_qt_syms26.*pinvG3_2+coefs_tq3_10.*coef_Jacob2_qt_syms25.*pinvG2_3+coefs_tq3_10.*coef_Jacob2_qt_syms26.*pinvG3_3,coef_Jacob3_qt_syms23+coefs_tq1_9.*coef_Jacob3_qt_syms30.*pinvG2_1+coefs_tq1_9.*coef_Jacob3_qt_syms31.*pinvG3_1+coefs_tq2_9.*coef_Jacob3_qt_syms30.*pinvG2_2+coefs_tq2_9.*coef_Jacob3_qt_syms31.*pinvG3_2+coefs_tq3_9.*coef_Jacob3_qt_syms30.*pinvG2_3+coefs_tq3_9.*coef_Jacob3_qt_syms31.*pinvG3_3+coefs_tq1_9.*coef_Jacob3_qt_syms29.*pinvG1_1+coefs_tq2_9.*coef_Jacob3_qt_syms29.*pinvG1_2+coefs_tq3_9.*coef_Jacob3_qt_syms29.*pinvG1_3+coefs_tq1_10.*coef_Jacob3_qt_syms24.*pinvG1_1+coefs_tq1_10.*coef_Jacob3_qt_syms25.*pinvG2_1+coefs_tq2_10.*coef_Jacob3_qt_syms24.*pinvG1_2+coefs_tq1_10.*coef_Jacob3_qt_syms26.*pinvG3_1+coefs_tq2_10.*coef_Jacob3_qt_syms25.*pinvG2_2+coefs_tq3_10.*coef_Jacob3_qt_syms24.*pinvG1_3+coefs_tq2_10.*coef_Jacob3_qt_syms26.*pinvG3_2+coefs_tq3_10.*coef_Jacob3_qt_syms25.*pinvG2_3+coefs_tq3_10.*coef_Jacob3_qt_syms26.*pinvG3_3,coef_Jacob4_qt_syms23+coefs_tq1_9.*coef_Jacob4_qt_syms30.*pinvG2_1+coefs_tq1_9.*coef_Jacob4_qt_syms31.*pinvG3_1+coefs_tq2_9.*coef_Jacob4_qt_syms30.*pinvG2_2+coefs_tq2_9.*coef_Jacob4_qt_syms31.*pinvG3_2+coefs_tq3_9.*coef_Jacob4_qt_syms30.*pinvG2_3+coefs_tq3_9.*coef_Jacob4_qt_syms31.*pinvG3_3+coefs_tq1_9.*coef_Jacob4_qt_syms29.*pinvG1_1+coefs_tq2_9.*coef_Jacob4_qt_syms29.*pinvG1_2+coefs_tq3_9.*coef_Jacob4_qt_syms29.*pinvG1_3+coefs_tq1_10.*coef_Jacob4_qt_syms24.*pinvG1_1+coefs_tq1_10.*coef_Jacob4_qt_syms25.*pinvG2_1+coefs_tq2_10.*coef_Jacob4_qt_syms24.*pinvG1_2+coefs_tq1_10.*coef_Jacob4_qt_syms26.*pinvG3_1+coefs_tq2_10.*coef_Jacob4_qt_syms25.*pinvG2_2+coefs_tq3_10.*coef_Jacob4_qt_syms24.*pinvG1_3+coefs_tq2_10.*coef_Jacob4_qt_syms26.*pinvG3_2+coefs_tq3_10.*coef_Jacob4_qt_syms25.*pinvG2_3+coefs_tq3_10.*coef_Jacob4_qt_syms26.*pinvG3_3,coef_Jacob1_qt_syms27,coef_Jacob2_qt_syms27,coef_Jacob3_qt_syms27,coef_Jacob4_qt_syms27,coef_Jacob1_qt_syms28+coefs_tq1_10.*coef_Jacob1_qt_syms30.*pinvG2_1+coefs_tq1_10.*coef_Jacob1_qt_syms31.*pinvG3_1+coefs_tq2_10.*coef_Jacob1_qt_syms30.*pinvG2_2+coefs_tq2_10.*coef_Jacob1_qt_syms31.*pinvG3_2+coefs_tq3_10.*coef_Jacob1_qt_syms30.*pinvG2_3+coefs_tq3_10.*coef_Jacob1_qt_syms31.*pinvG3_3+coefs_tq1_10.*coef_Jacob1_qt_syms29.*pinvG1_1+coefs_tq2_10.*coef_Jacob1_qt_syms29.*pinvG1_2+coefs_tq3_10.*coef_Jacob1_qt_syms29.*pinvG1_3,coef_Jacob2_qt_syms28+coefs_tq1_10.*coef_Jacob2_qt_syms30.*pinvG2_1+coefs_tq1_10.*coef_Jacob2_qt_syms31.*pinvG3_1+coefs_tq2_10.*coef_Jacob2_qt_syms30.*pinvG2_2+coefs_tq2_10.*coef_Jacob2_qt_syms31.*pinvG3_2+coefs_tq3_10.*coef_Jacob2_qt_syms30.*pinvG2_3+coefs_tq3_10.*coef_Jacob2_qt_syms31.*pinvG3_3+coefs_tq1_10.*coef_Jacob2_qt_syms29.*pinvG1_1+coefs_tq2_10.*coef_Jacob2_qt_syms29.*pinvG1_2+coefs_tq3_10.*coef_Jacob2_qt_syms29.*pinvG1_3,coef_Jacob3_qt_syms28+coefs_tq1_10.*coef_Jacob3_qt_syms30.*pinvG2_1+coefs_tq1_10.*coef_Jacob3_qt_syms31.*pinvG3_1+coefs_tq2_10.*coef_Jacob3_qt_syms30.*pinvG2_2+coefs_tq2_10.*coef_Jacob3_qt_syms31.*pinvG3_2+coefs_tq3_10.*coef_Jacob3_qt_syms30.*pinvG2_3+coefs_tq3_10.*coef_Jacob3_qt_syms31.*pinvG3_3+coefs_tq1_10.*coef_Jacob3_qt_syms29.*pinvG1_1+coefs_tq2_10.*coef_Jacob3_qt_syms29.*pinvG1_2+coefs_tq3_10.*coef_Jacob3_qt_syms29.*pinvG1_3,coef_Jacob4_qt_syms28+coefs_tq1_10.*coef_Jacob4_qt_syms30.*pinvG2_1+coefs_tq1_10.*coef_Jacob4_qt_syms31.*pinvG3_1+coefs_tq2_10.*coef_Jacob4_qt_syms30.*pinvG2_2+coefs_tq2_10.*coef_Jacob4_qt_syms31.*pinvG3_2+coefs_tq3_10.*coef_Jacob4_qt_syms30.*pinvG2_3+coefs_tq3_10.*coef_Jacob4_qt_syms31.*pinvG3_3+coefs_tq1_10.*coef_Jacob4_qt_syms29.*pinvG1_1+coefs_tq2_10.*coef_Jacob4_qt_syms29.*pinvG1_2+coefs_tq3_10.*coef_Jacob4_qt_syms29.*pinvG1_3,coef_Jacob1_qt_syms32,coef_Jacob2_qt_syms32,coef_Jacob3_qt_syms32,coef_Jacob4_qt_syms32],[4, 24]);


function model = ResNet50_for_DetectTrack_ILSVRCvid(model)
% ResNet 50 layers D&T with OHEM training (finetuned from res3a)

model.solver_def_file        = fullfile(pwd, 'models', 'rfcn_prototxts', 'ResNet-50L_ILSVRCvid_corr', 'solver_160k240k_lr1_4.prototxt');
model.test_net_def_file      = fullfile(pwd, 'models', 'rfcn_prototxts', 'ResNet-50L_ILSVRCvid_corr', 'test_track.prototxt');

model.net_file               = fullfile(pwd, 'models', 'pre_trained_models', 'ResNet-50L', 'ResNet-50-D-ilsvrc-vid.caffemodel');
model.mean_image             = fullfile(pwd, 'models', 'pre_trained_models', 'ResNet-50L', 'mean_image');

end


function [Fp, Fi] = tt(F)
  warning('tt is deprecated, use triangle_triangle_adjacency instead.');
  [Fp, Fi] = triangle_triangle_adjacency(F);
end


%%% void convert_video4d_to_avi(V,filename)
%
function convert_video4d_to_avi(video,filename)
  movobj(1:size(video,4)) = struct('cdata',[], 'colormap',[]);

  for i = 1:size(video,4)
    frame = video(:,:,:,i);

    if(size(frame,3) == 1)
      frame = repmat(frame,[1 1 3]);
    end

    movobj(i).cdata = frame;
  end

  movie2avi(movobj, filename, 'compression', 'None');
end


function files = genfiles(path,name)
% recurisviely look for files in a path
% example usage:
% files = genfiles('~/Downloads','*.jpg');

folders = genpathsplit(path);

files = [];

for folderID=1:length(folders)
    cfiles = dir(fullfile(folders{folderID},name));
    for fileID=1:length(cfiles)
        files{end+1} = fullfile(folders{folderID},cfiles(fileID).name);
    end
end


function mtrSetupDOCCParams(subjID)

% Setting up parameters files for a subject based on ROIs assumes
% 1. You are in the subject directory
% 2. A met_params.txt file is already in the conTrack directory
%subjID = 'ss040804';
localSubjDir = ['/teal/scr1/dti/sisr/' subjID];
dlhSubjDir = ['/radlab_share/home/tony/images/' subjID];
lappySubjDir = ['c:/cygwin/home/sherbond/images/' subjID];
machineListL = {'deep-lumen1','deep-lumen2','deep-lumen4'};
machineListR = {'deep-lumen5','deep-lumen6','deep-lumen8'};
mtrTwoRoiSamplerSISR(localSubjDir, 'CC_FA.mat', 'LV3AB7d_cleaned.mat', 'met_params.txt', 'LDOCC_met_params.txt', 'paths_LDOCC.dat', 'ldoccRoisMask.nii.gz');
mtrTwoRoiSamplerSISR(localSubjDir, 'CC_FA.mat', 'RV3AB7d_cleaned.mat', 'met_params.txt', 'RDOCC_met_params.txt', 'paths_RDOCC.dat', 'rdoccRoisMask.nii.gz');
mtrTwoRoiSamplerSISR(localSubjDir, 'CC_FA.mat', 'LV3AB7d_cleaned.mat', 'met_params.txt', 'LDOCC_met_params_dl.txt', 'paths_LDOCC.dat', 'ldoccRoisMask.nii.gz', 'track_LDOCC.sh', dlhSubjDir, machineListL);
mtrTwoRoiSamplerSISR(localSubjDir, 'CC_FA.mat', 'RV3AB7d_cleaned.mat', 'met_params.txt', 'RDOCC_met_params_dl.txt', 'paths_RDOCC.dat', 'rdoccRoisMask.nii.gz', 'track_RDOCC.sh', dlhSubjDir, machineListR);
mtrTwoRoiSamplerSISR(localSubjDir, 'CC_FA.mat', 'LV3AB7d_cleaned.mat', 'met_params.txt', 'LDOCC_met_params_lap.txt', 'paths_LDOCC.dat', 'ldoccRoisMask.nii.gz', 'temp.sh', lappySubjDir, machineListL);
mtrTwoRoiSamplerSISR(localSubjDir, 'CC_FA.mat', 'RV3AB7d_cleaned.mat', 'met_params.txt', 'RDOCC_met_params_lap.txt', 'paths_RDOCC.dat', 'rdoccRoisMask.nii.gz', 'temp.sh', lappySubjDir, machineListR);

delete(fullfile('conTrack','temp.sh'));


function vw = switch2Gray(vw)
%
% Switches Volume view to gray mode:
% - changes vw.subdir to 'Gray'
% - sets vw.ui.grayVolButtons=2
% - computes/loads vw.coords
% - loads user preferences
% - empties co, amp, ph, map
%
% djh, 7/98
% ress, 6/03: Added 3D button UI controls

if isempty(vw)
    myErrorDlg('Volume window must be open to switch it to gray mode.');
end

vwType = viewGet(vw, 'view type');

if ~strcmp(vwType,'Volume') && ~strcmp(vwType,'Gray')
    myErrorDlg('Only volume window can be switched to gray mode.');
end

% set viewType
vw = viewSet(vw,'view type','Gray');
vw = viewSet(vw,'subdir','Gray');

% Compute/load VOLUME.coords
vw = getGrayCoords(vw);

% Empty data matrices already set in openRaw...
% vw.co = [];
% vw.amp = [];
% vw.ph = [];
% vw.map = [];

% Only do this for VOLUME, not for hiddenVolume
if strcmp(vwType, 'VOLUME')
    if checkfields(vw, 'ui', 'grayVolButtons')
          % Set vw.ui.grayVolButtons
          selectButton(vw.ui.grayVolButtons, 1);
    end
end

return;


function finetuned_model_path = spp_finetune_voc(opts)
% [] = spp_finetune_voc(opts)
%   finetune fc layers
%
% this version read conv feature maps from disk each iteration for compatibility and small
% memory usage. load all conv feature maps into memory will accelerate finetuning
% greatly
%
% AUTORIGHTS
% ---------------------------------------------------------
% Copyright (c) 2014, Shaoqing Ren
%
% This file is part of the SPP code and is available
% under the terms of the Simplified BSD License provided in
% LICENSE. Please retain this notice and LICENSE if you use
% this file (or any portion of it) in your project.
% ---------------------------------------------------------

% -------------------- CONFIG --------------------
if ~exist('opts', 'var')
    opts.net_file               = fullfile(pwd, 'data\cnn_model\Zeiler_conv5\Zeiler_conv5');
    opts.finetune_net_def_file  = fullfile(pwd, 'model-defs\pascal_finetune_fc_spm_solver.prototxt');
    opts.spp_params_def         = fullfile(pwd, 'data\cnn_model\Zeiler_conv5\spp_config');

    opts.flip = true;
    opts.finetune_cache_name = 'Zeiler_conv5_ft(5s_flip)_ss';

    opts.with_selective_search = true;
    opts.with_edge_box = false;

    opts.devkit = './datasets/VOCdevkit2007';
    opts.imdb_train   = {   imdb_from_voc(opts.devkit, 'trainval', '2007', opts.flip) };
    opts.feat_cache_train   = { 'Zeiler_conv5' };

    opts.imdb_test    = { imdb_from_voc(opts.devkit, 'test', '2007') };
    opts.feat_cache_test = { 'Zeiler_conv5' };

    opts.with_hard_samples = false;  % only for train
else
    if ~iscell(opts.imdb_test)
        opts.imdb_test = {opts.imdb_test};
        opts.feat_cache_test = {opts.feat_cache_test};
    end
end

opts.random_scale = 1;

data_param.img_num_per_iter = 128; % should be same with the prototxt file
data_param.random_scale = opts.random_scale;
data_param.iter_per_batch = 500; % for load data effectively
data_param.fg_fraction = 0.25;
data_param.fg_threshold = 0.5;
data_param.bg_threshold = [0.1 0.5];

solver_param.test_iter = 500; % better times of data_param.iter_per_batch
solver_param.test_interval = 2000; % better times of data_param.iter_per_batch
if isfield(opts, 'max_iter')
    solver_param.max_iter = opts.max_iter;
else
    solver_param.max_iter = 1000000;
end

opts.imdb_train = opts.imdb_train(:)';
opts.feat_cache_train = opts.feat_cache_train(:)';
opts.imdb_test = opts.imdb_test(:)';
opts.feat_cache_test = opts.feat_cache_test(:)';
roidb_train = cellfun(@(x) x.roidb_func(x, opts.with_hard_samples, opts.with_selective_search, opts.with_edge_box), opts.imdb_train, 'UniformOutput', false);
roidb_test = cellfun(@(x) x.roidb_func(x, true, opts.with_selective_search, opts.with_edge_box), opts.imdb_test, 'UniformOutput', false);
% ------------------------------------------------

work_dir = fullfile(pwd, 'finetuning', opts.finetune_cache_name);
timestamp = datestr(datevec(now()), 'yyyymmdd_HHMMSS');
log_file = fullfile(work_dir, 'output', [opts.finetune_cache_name, '_' timestamp, '.txt']);
caffe_log_file = fullfile(work_dir, opts.finetune_cache_name);

mkdir_if_missing(work_dir);
mkdir_if_missing(fileparts(log_file));
diary(log_file);

fprintf('data_param:\n');
disp(data_param);
fprintf('solver_param:\n');
disp(solver_param);
fprintf('opts_param:\n');
disp(opts);

%% get all data info
[fg_windows_train, bg_windows_train] = cellfun(@(x) SetupData(x, data_param), roidb_train, 'UniformOutput', false);
[fg_windows_test, bg_windows_test] = cellfun(@(x) SetupData(x, data_param), roidb_test, 'UniformOutput', false);
fg_windows_num_train = cellfun(@(y) cellfun(@(x) size(x, 1), y, 'UniformOutput', true), ...
    fg_windows_train, 'UniformOutput', false);
fg_windows_num_test = cellfun(@(y) cellfun(@(x) size(x, 1), y, 'UniformOutput', true), ...
    fg_windows_test, 'UniformOutput', false);
bg_windows_num_train = cellfun(@(y) cellfun(@(x) size(x, 1), y, 'UniformOutput', true), ...
    bg_windows_train, 'UniformOutput', false);
bg_windows_num_test = cellfun(@(y) cellfun(@(x) size(x, 1), y, 'UniformOutput', true), ...
    bg_windows_test, 'UniformOutput', false);

fg_windows_train = CombineImdbWindows(fg_windows_train);
bg_windows_train = CombineImdbWindows(bg_windows_train);
fg_windows_test = CombineImdbWindows(fg_windows_test);
bg_windows_test = CombineImdbWindows(bg_windows_test);

fg_windows_num_train = cell2mat(fg_windows_num_train');
bg_windows_num_train = cell2mat(bg_windows_num_train');
fg_windows_num_test = cell2mat(fg_windows_num_test');
bg_windows_num_test = cell2mat(bg_windows_num_test');

fprintf('total fg_windows_num_train : %d\n', sum(fg_windows_num_train));
fprintf('total bg_windows_num_train : %d\n', sum(bg_windows_num_train));
fprintf('total fg_windows_num_test : %d\n', sum(fg_windows_num_test));
fprintf('total bg_windows_num_test : %d\n', sum(bg_windows_num_test));
%% init caffe solver
caffe('set_random_seed', 6);
spp_model.spp_pooler = spp_load_pooling_params(opts.spp_params_def);
InitSolver(opts.finetune_net_def_file, opts.net_file, caffe_log_file);

% finetune
caffe('set_mode_gpu');
caffe('set_phase_train');

%% get test sample
% fix the random seed for repeatability
prev_rng = seed_rand();
data_param_test = data_param;
data_param_test.iter_per_batch = solver_param.test_iter;
data_param_test.random_scale = 0; % for test use the best scale
[data_test, label_test] = PrepareBatchData(spp_model.spp_pooler, opts.imdb_test, fg_windows_test, ...
                    fg_windows_num_test, bg_windows_test, bg_windows_num_test, data_param_test, data_param.img_num_per_iter, opts.feat_cache_test);
rng(prev_rng);

%% finetune
prev_rng = seed_rand();
data_train = {}; label_train = {};
train_error_sum = 0;
train_error_count = 0;
min_test_error = 1;
iter_ = 1;
while(iter_ < solver_param.max_iter)
    if isempty(data_train)
        [data_train, label_train] = ...
        PrepareBatchData(spp_model.spp_pooler, opts.imdb_train, fg_windows_train, ...
        fg_windows_num_train, bg_windows_train, bg_windows_num_train, data_param, data_param.img_num_per_iter, opts.feat_cache_train);
    end
    rst = caffe('train', {data_train{1}, label_train{1}});
    data_train(1) = []; label_train(1) = [];
    train_error_sum = train_error_sum + rst(1);
    train_error_count = train_error_count + 1;

    % test per test_interval iterations
    if ~mod(iter_, solver_param.test_interval)
        test_error = nan(solver_param.test_iter, 1);
        for it = 1:solver_param.test_iter
            rst = caffe('test', {data_test{it}, label_test{it}});
            test_error(it) = rst(1);
        end
        ShowState(iter_, train_error_sum / train_error_count, mean(test_error));
        if (mean(test_error) < min_test_error)
            min_test_error = mean(test_error);
            finetuned_model_path = fullfile(opts.finetune_rst_dir, sprintf('FT_iter_%d', iter_));
            caffe('snapshot', finetuned_model_path);
            fprintf('best! save as %s\n', finetuned_model_path);
        end
        train_error_sum = 0;
        train_error_count = 0;

        diary; diary; % flush diary
    end

    iter_ = caffe('get_solver_iter');
end

rng(prev_rng);
caffe('release_solver');

end

function [data, label] = PrepareBatchData(spp_pooler, imdb, fg_windows, fg_windows_num, bg_windows, bg_windows_num, data_param, img_num_per_iter, feat_cache)
    % windows -- (image_id_in_total, image_imdb_idx, image_id_in_imdb,
    % label, ov, l, t, r, b)

    nTimesMoreData = 10;

    fg_num_each = int32(data_param.fg_fraction * img_num_per_iter);
    bg_num_each = img_num_per_iter - fg_num_each;
    fg_num_total = fg_num_each * data_param.iter_per_batch;
    bg_num_total = bg_num_each * data_param.iter_per_batch;
    total_img = size(fg_windows, 1);

    % random perm image and get top n image with total more than patch_num
    % windows
    img_idx = randperm(total_img);
    fg_windows_num = fg_windows_num(img_idx);
    fg_windows_cumsum = cumsum(fg_windows_num);
    bg_windows_num = bg_windows_num(img_idx);
    bg_windows_cumsum = cumsum(bg_windows_num);
    img_idx_end = max(find(fg_windows_cumsum > fg_num_total * nTimesMoreData, 1, 'first'), ...
        find(bg_windows_cumsum > bg_num_total * nTimesMoreData, 1, 'first'));
    if isempty( img_idx_end )
        img_idx_end = length(img_idx);
    end
    select_img_idx = img_idx(1:img_idx_end);

    fg_window = cell2mat(fg_windows(select_img_idx));
    bg_window = cell2mat(bg_windows(select_img_idx));

    % random perm all windows, and drop redundant data
    window_idx = randperm(size(fg_window, 1));
    fg_window = fg_window(window_idx(1:fg_num_total), :);
    window_idx = randperm(size(bg_window, 1));
    bg_window = bg_window(window_idx(1:bg_num_total), :);

    fg_data = cell(1, length(select_img_idx)); bg_data = cell(1, length(select_img_idx));
    fg_label = cell(length(select_img_idx), 1); bg_label = cell(length(select_img_idx), 1);
    random_scale = data_param.random_scale;
    fg_window_this_img = cell(length(select_img_idx), 1);
    bg_window_this_img = cell(length(select_img_idx), 1);
    for i = 1:length(select_img_idx)
        fg_window_this_img{i} = fg_window(fg_window(:, 1) == select_img_idx(i), :);
        bg_window_this_img{i} = bg_window(bg_window(:, 1) == select_img_idx(i), :);
    end
    assert(sum(cellfun(@(x) size(x, 1), fg_window_this_img, 'UniformOutput', true)) == fg_num_total);
    assert(sum(cellfun(@(x) size(x, 1), bg_window_this_img, 'UniformOutput', true)) == bg_num_total);
    random_seed = randi(10^6, length(select_img_idx));
    parfor i = 1:length(select_img_idx)
        rng(random_seed(i), 'twister')
        window_this_img = [fg_window_this_img{i}; bg_window_this_img{i}];
        if isempty(window_this_img)
            continue;
        end
        image_id_in_total = select_img_idx(i);
        assert(all(window_this_img(:, 1) == image_id_in_total));
        image_imdb_idx = window_this_img(1, 2);
        assert(all(window_this_img(:, 2) == image_imdb_idx));
        image_id_in_imdb = window_this_img(1, 3);
        assert(all(window_this_img(:, 3) == image_id_in_imdb));

        [fg_data{i}, bg_data{i}] = LoadCachedPoolXFeature(spp_pooler, imdb{image_imdb_idx}, feat_cache{image_imdb_idx}, ...
            image_id_in_imdb, fg_window_this_img{i}(:, 6:9), bg_window_this_img{i}(:, 6:9), random_scale);
        fg_label{i} = fg_window_this_img{i}(:, 4);
        bg_label{i} = bg_window_this_img{i}(:, 4);
    end
    valid_fg_data = cellfun(@(x) ~isempty(x), fg_label, 'UniformOutput', true);
    valid_bg_data = cellfun(@(x) ~isempty(x), bg_label, 'UniformOutput', true);
    fg_data = cell2mat(fg_data(valid_fg_data));
    bg_data = cell2mat(bg_data(valid_bg_data));
    fg_label = cell2mat(fg_label(valid_fg_data));
    bg_label = cell2mat(bg_label(valid_bg_data));

    % random perm all windows
    fg_rnd_idx = randperm(size(fg_label, 1));
    bg_rnd_idx = randperm(size(bg_label, 1));
    fg_data = fg_data(:, fg_rnd_idx);
    fg_label = fg_label(fg_rnd_idx, :);
    bg_data = bg_data(:, bg_rnd_idx);
    bg_label = bg_label(bg_rnd_idx, :);

    % split to iter_per_batch
    fg_split_div = ones(1, data_param.iter_per_batch) * double(fg_num_each);
    bg_split_div = ones(1, data_param.iter_per_batch) * double(bg_num_each);
    fg_data = mat2cell(fg_data, size(fg_data, 1), fg_split_div);
    fg_label = mat2cell(fg_label', size(fg_label, 2), fg_split_div);
    bg_data = mat2cell(bg_data, size(bg_data, 1), bg_split_div);
    bg_label = mat2cell(bg_label', size(bg_label, 2), bg_split_div);

    % merge fg and bg_data
    data = cellfun(@(x, y) [x, y], fg_data, bg_data, 'UniformOutput', false);
    label = cellfun(@(x, y) [x, y], fg_label, bg_label, 'UniformOutput', false);
end

function [fg_windows, bg_windows] = SetupData(roidb, data_param)
    fg_windows = cell(length(roidb.rois), 1);
    bg_windows = cell(length(roidb.rois), 1);
    for i = 1:length(roidb.rois)
        roi = roidb.rois(i);
        [ov, label] = max(roi.overlap, [], 2);
        ov = full(ov);
        fg_mask = ov >= data_param.fg_threshold;
        fg_ov = ov(fg_mask);
        fg_label = label(fg_mask);
        fg_img_idx = fg_label * 0 + i;
        fg_window = roi.boxes(fg_mask, :);
        fg_windows{i} = [fg_img_idx, fg_label, fg_ov, fg_window];

        bg_mask = ~fg_mask & ov >= data_param.bg_threshold(1) & ov < data_param.bg_threshold(2);
        bg_ov = ov(bg_mask) * 0;
        bg_label = label(bg_mask) * 0;
        bg_img_idx = bg_label * 0 + i;
        bg_window = roi.boxes(bg_mask, :);
        bg_windows{i} = [bg_img_idx, bg_label, bg_ov, bg_window];
    end
end

function [fg_feat, bg_feat] = LoadCachedPoolXFeature(spp_pooler, imdb, feat_cache, img_id, fg_windows, bg_windows, random_scale)
    feat = spp_load_cached_poolX_features(spp_pooler, feat_cache, imdb.name, imdb.image_ids{img_id}, [fg_windows; bg_windows], random_scale);
    fg_feat = feat(:, 1:size(fg_windows, 1));
    bg_feat = feat(:, (size(fg_windows, 1)+1):end);
end

function ShowState(iter, train_error, test_error)
    fprintf('\n------------------------- Iteration %d -------------------------\n', iter);
    fprintf('Error - Training : %.4f - Testing : %.4f\n', train_error, test_error);
end

function windows = CombineImdbWindows(windows_in_cell)
    % windows -- (image_id_in_total, image_imdb_idx, image_id_in_imdb,
    % label, ov, l, t, r, b)

    image_imdb_idx = cellfun(@(x, y) ones(size(y, 1), 1) * x, num2cell(1:length(windows_in_cell)), windows_in_cell, 'UniformOutput', false);
    image_imdb_idx = cat(1, image_imdb_idx{:});
    windows = cat(1, windows_in_cell{:});
    windows = cellfun(@(x, y, z) [ones(size(z, 1), 1)*x, ones(size(z, 1), 1)*y, z], ...
        num2cell(1:size(windows, 1))', num2cell(image_imdb_idx), windows, 'UniformOutput', false);

end

function InitSolver(net_def_file, net_file, log_file)
    cur_dir = pwd;
    cd(fileparts(net_def_file));
    caffe('init_solver', net_def_file, net_file, log_file);
    cd(cur_dir);
end


%demo_SOFAstrings - Script for testing the string array feature of SOFA.

% #Author: Piotr Majdak
% #Author: Michael Mihocic: header documentation updated (28.10.2021)
% #Author: Michael Mihocic: updated with variable ReceiverDescriptions instead of Ears (03.08.2022)
%
% Copyright (C) Acoustics Research Institute - Austrian Academy of Sciences
% Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License")
% You may not use this work except in compliance with the License.
% You may obtain a copy of the License at: https://joinup.ec.europa.eu/software/page/eupl
% Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing  permissions and limitations under the License.

%% Test Strings as application-specific variable
% Load some arbritrary HRTFs
hrtf = SOFAload(fullfile(SOFAdbPath, 'database','ari','dtf_nh2.sofa'));
% Add a string array
str={};
for ii=1:hrtf.API.M
  str{ii,1}=['String' num2str(round(rand(1,1)*10000))];
end
% SOFAaddVariable(Obj,Name,Dim,Value)
hrtf2 = SOFAaddVariable(hrtf,'Test','MS',str);

% Add a new string with dimensions [RS]
strn={'left ear'; 'right ear'};
hrtf2 = SOFAaddVariable(hrtf2, 'ReceiverDescriptions', 'RS', strn);

% Save as SOFA
SOFAsave('stringtest_applicationvar.sofa',hrtf2);
% Reload the file
hrtf = SOFAload('stringtest_applicationvar.sofa');
% compare the strings
if prod(strcmp(hrtf.Test,hrtf2.Test))
    disp('SimpleFreeFieldHRIR: String Load-Reload: OK');
    delete('stringtest_applicationvar.sofa');
else
    error('String comparison showed differences');
end
clear

%% Test with conventions GeneralString (non-standardized convention, just for testing)
% Create an empty object
Obj = SOFAgetConventions('GeneralString');
% Create numeric data with M=15, R=2, N=10
Obj.Data.Double=rand(15,2,10);
% Create string arrays
str2={}; str={};
for ii=1:15
  id = num2str(round(rand(1,1)*1000000));
  str{ii,1}=['X' id];
  str2{ii,1}=['Left' id];
  str2{ii,2}=['Right' id];
end
Obj.String2 = str2;      % String1=[MRS]
Obj.Data.String1 = str;  % Data.String1=[MS]
Obj.Data.String2 = str2; % Data.String2=[MRS]

% Add a new string with dimensions [RS]
strn={'left ear'; 'right ear'};
Obj = SOFAaddVariable(Obj, 'ReceiverDescriptions', 'RS', strn);

% Update dimensions
Obj = SOFAupdateDimensions(Obj);
% Save as SOFA
SOFAsave('stringtest_generalstring.sofa',Obj);
% Reload the file
Obj2 = SOFAload('stringtest_generalstring.sofa');
% Compare the strings
if ~prod(strcmp(Obj2.Data.String2,Obj.Data.String2))
    error('Data.String2: Comparison showed differences');
end
if ~prod(strcmp(Obj2.String2,Obj.String2))
    error('String2: Comparison showed differences');
end
if ~prod(strcmp(Obj2.Data.String1,Obj.Data.String1))
    error('Data.String1: Comparison showed differences');
end
if ~prod(strcmp(Obj2.ReceiverDescriptions,Obj.ReceiverDescriptions))
    error('ReceiverDescriptions: Comparison showed differences');
end
disp('GeneralString: String1, String2, Data, ReceiverDescriptions: Load-Reload: OK');
clear
delete('stringtest_generalstring.sofa');