
// Make newform 320.6.d.d in Magma, downloaded from the LMFDB on 18 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_320_d();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_320_d_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_320_6_d_d();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_320_6_d_d();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function ConvertToHeckeField(input: pass_field := false, Kf := [])
    if not pass_field then
        poly := [653157349, 1475231592, 1271335685, 434775816, 26901210, -15554592, -2401691, 179640, 44406, -696, -343, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-217987432168313171400201, -385502990089768818965820, -239134506183485171752707, -45036396282092927536469, 5974186120174593456795, 2363407957163362867206, -7591386010812523011, -42209525222022135489, -777687620581938609, 344320662557978084, 5148378830255625, -1114169565385359], [4388000374446049, 506366224717298, 6141622707594396, 5250130473321761, 857644800821275, -139410432367826, -32730922343066, 1368899772199, 393167792559, -8316126004, -1614964016, 36815915], [581426451064245854644667842, 681999693930617945570246238, 687852158936708631963167595, 283737884722866991445184958, 20901286382332442400657520, -9763097509765769583985496, -1218425713243063389228323, 132142088648168857632184, 16294561626189934266384, -970562338568173639224, -70661177934391715597, 3513742031841606386], [-2560494130722577331427101863, -4343313783885789675179200592, -2594800642456820605873067720, -552996627940027869804602545, 30706837610558187280253691, 24321066494443697292639176, 923710347683365989128438, -388795639100860195034671, -18879843136352678124641, 3043275071165687287774, 95045593935047337780, -10231513249461913599], [-1430082952317763, -8667704717034982, -10571516347535470, -3022005704518913, 211252396213243, 150021763825354, 2122604298688, -2729723240483, -69843390937, 22748159420, 389497022, -74273403], [-98920471395888825472533, 3893131488180761585810778, 2817604227319846900601423, 625668140384878066459881, -48050332016629088674543, -29802757647914065725084, -602191962960693180693, 511744645096093141965, 16865639858706048357, -4139261263854231198, -91124133229166981, 13639266356667327], [-5166027282445433905581974531, -5580760055468273501014891708, -1400843290371205317628670133, -1230442815340743268840968667, -339095214197795010763360823, 55345622743396298138630626, 13647693775930350342127611, -1136470451040249814781311, -177728667037626808988547, 12418662926401850962132, 782892543987925631975, -54754580421881446865], [-5357881289418969973280396130, -13789237970643232634050789618, -9335236695460745980003599107, -1889413878050639052509821774, -5360134902433571636730090, 37468431433912499527525892, 4739366617868354835284603, 169635384594321812887328, -52414456244141235315222, -6753967617680930083028, 143280450754515900289, 34003364205222503302], [-28286273382402104580263775, -44397370695649112120155436, -22389716409000305804366985, -2630413554028126583041875, 772142929035544358218749, 149603854094149565872106, -9537599746470372114465, -2490352575452209485519, 51793124112605240505, 17502036736459030668, -115775673391474869, -44234630164150217], [-16459470084154113895305812859, -43460313045814929858639489068, -38939536065376814251435508591, -9502399212145153462872180943, 702991763010290290224807677, 398242724666323927919815670, 3329158345812296085750717, -6171859732685479040894591, -128556339007628903695591, 44639957700360428213656, 644642326512253546581, -128705849992829120893], [7133995622365770276605081365, 16450443817427961744959054578, 11481762909904075317986816135, 2249132229357742391094901349, -288746807766053051174364153, -126185264131728728881735944, -628606524459807419585633, 2448055765108875426834705, 63587200441678776729387, -21909708977731768086998, -418685991849346335709, 78237484165190888991]];
    Rf_basisdens := [1, 19119816859116838401556, 484488895993706, 36499730384054044508570404, 36499730384054044508570404, 143817507231506, 9559908429558419200778, 36499730384054044508570404, 18249865192027022254285202, 19119816859116838401556, 36499730384054044508570404, 18249865192027022254285202];
    Rf_basisnums := ChangeUniverse([[z : z in elt] : elt in Rf_num], Kf);
    Rfbasis := [Rf_basisnums[i]/Rf_basisdens[i] : i in [1..Degree(Kf)]];
    inp_vec := Vector(Rfbasis)*ChangeRing(Transpose(Matrix([[elt : elt in row] : row in input])),Kf);
    return Eltseq(inp_vec);
end function;


// To make the character of type GrpDrchElt, type "MakeCharacter_320_d();"
function MakeCharacter_320_d()
    N := 320;
    order := 2;
    char_gens := [191, 261, 257];
    v := [2, 1, 2];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_320_d_Hecke();"
function MakeCharacter_320_d_Hecke(Kf)
    N := 320;
    order := 2;
    char_gens := [191, 261, 257];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := true, Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
end function;


function ExtendMultiplicatively(weight, aps, character)
    prec := NextPrime(NthPrime(#aps)) - 1; // we will able to figure out a_0 ... a_prec
    primes := PrimesUpTo(prec);
    prime_powers := primes;
    assert #primes eq #aps;
    log_prec := Floor(Log(prec)/Log(2)); // prec < 2^(log_prec+1)
    F := Universe(aps);
    FXY<X, Y> := PolynomialRing(F, 2);
    // 1/(1 - a_p T + p^(weight - 1) * char(p) T^2) = 1 + a_p T + a_{p^2} T^2 + ...
    R<T> := PowerSeriesRing(FXY : Precision := log_prec + 1);
    recursion := Coefficients(1/(1 - X*T + Y*T^2));
    coeffs := [F!0: i in [1..(prec+1)]];
    coeffs[1] := 1; //a_1
    for i := 1 to #primes do
        p := primes[i];
        coeffs[p] := aps[i];
        b := p^(weight - 1) * F!character(p);
        r := 2;
        p_power := p * p;
        //deals with powers of p
        while p_power le prec do
            Append(~prime_powers, p_power);
            coeffs[p_power] := Evaluate(recursion[r + 1], [aps[i], b]);
            p_power *:= p;
            r +:= 1;
        end while;    
    end for;
    Sort(~prime_powers);
    for pp in prime_powers do
        for k := 1 to Floor(prec/pp) do
            if GCD(k, pp) eq 1 then
                coeffs[pp*k] := coeffs[pp]*coeffs[k];
            end if;
        end for;
    end for;
    return coeffs;
end function;


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 6;
    raw_aps := [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0], [0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [22, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, -1], [0, -63, 0, 0, -8, -2, 0, 2, 0, 2, -1, 0], [0, -147, 0, 0, 4, -22, 0, -1, 0, 3, 1, 0], [201, 0, 2, -20, 0, 0, 5, 0, -3, 0, 0, -5], [0, -401, 0, 0, 2, -22, 0, 4, 0, -6, 5, 0], [682, 0, 62, -123, 0, 0, 14, 0, -1, 0, 0, 4], [0, 972, 0, 0, 80, 53, 0, 16, 0, 6, -22, 0], [654, 0, 56, -146, 0, 0, -32, 0, -2, 0, 0, -2], [0, 1750, 0, 0, 408, 188, 0, -10, 0, -48, 26, 0], [-4663, 0, -85, 20, 0, 0, 17, 0, -59, 0, 0, 37], [0, -3351, 0, 0, -385, -681, 0, 3, 0, 58, 3, 0], [1784, 0, -401, 615, 0, 0, 16, 0, -80, 0, 0, -37], [0, 6643, 0, 0, -620, 200, 0, -41, 0, 109, -43, 0], [0, 1535, 0, 0, 578, -608, 0, 26, 0, -154, -65, 0], [0, 5244, 0, 0, 64, -390, 0, -28, 0, -58, 32, 0], [0, 4629, 0, 0, 1175, -1491, 0, -27, 0, 118, -27, 0], [30590, 0, -406, 626, 0, 0, -20, 0, 146, 0, 0, 10], [4893, 0, -1948, -636, 0, 0, -187, 0, 71, 0, 0, 253], [2254, 0, 2240, -332, 0, 0, -92, 0, -88, 0, 0, 218], [0, 21101, 0, 0, -1743, -4237, 0, -317, 0, -2, -123, 0], [7428, 0, -5528, 2792, 0, 0, 322, 0, 18, 0, 0, 62], [-14139, 0, -4518, 3796, 0, 0, 121, 0, -225, 0, 0, 321], [0, 22640, 0, 0, -2832, -331, 0, 640, 0, 230, 362, 0], [36178, 0, 138, 469, 0, 0, -546, 0, -297, 0, 0, -124], [0, 2007, 0, 0, -665, -6386, 0, 242, 0, -308, -150, 0], [0, 34972, 0, 0, 9656, 2628, 0, 186, 0, 266, -58, 0], [-37004, 0, -4874, 376, 0, 0, 342, 0, -258, 0, 0, -58], [-22880, 0, 2904, -8311, 0, 0, -250, 0, 99, 0, 0, -690], [0, 603, 0, 0, -3640, -4960, 0, 1354, 0, -6, 797, 0], [-61652, 0, -5020, 6624, 0, 0, -990, 0, -140, 0, 0, -1820], [0, -60235, 0, 0, -90, -8360, 0, 380, 0, 490, 835, 0], [0, 56734, 0, 0, -792, 3070, 0, -1558, 0, -788, 58, 0], [153744, 0, 7910, -4374, 0, 0, -712, 0, 790, 0, 0, 1848], [0, 97460, 0, 0, 8824, 1290, 0, 210, 0, -422, -1958, 0], [0, 2383, 0, 0, -4269, 4410, 0, 678, 0, -1212, -726, 0], [20762, 0, 7292, -9709, 0, 0, 166, 0, -973, 0, 0, -746], [0, -60206, 0, 0, 15640, 16568, 0, 1582, 0, 1768, -262, 0], [0, -152351, 0, 0, 1302, 148, 0, -2044, 0, 1146, 431, 0], [0, -130986, 0, 0, -9160, -19391, 0, 3742, 0, -1188, 1436, 0], [-197788, 0, 832, 8106, 0, 0, -2156, 0, 2398, 0, 0, 704], [-163701, 0, 12092, 9084, 0, 0, -1525, 0, 1697, 0, 0, -1685], [0, -71135, 0, 0, 116, -1968, 0, -3405, 0, -629, -39, 0], [118126, 0, 6274, -16200, 0, 0, 1472, 0, 476, 0, 0, -1178], [0, -285249, 0, 0, 11556, 34474, 0, -772, 0, 1678, 643, 0], [-633456, 0, -33314, 4619, 0, 0, 1502, 0, 311, 0, 0, -172], [0, 20055, 0, 0, 26917, 39046, 0, 3782, 0, 1152, 592, 0], [0, -375178, 0, 0, -2312, -3681, 0, -714, 0, 4596, -2800, 0], [-397789, 0, 34338, -6068, 0, 0, 991, 0, -1719, 0, 0, 2271], [-660958, 0, -2522, -25680, 0, 0, -2096, 0, 2062, 0, 0, 884], [442103, 0, 38685, -6420, 0, 0, 171, 0, -177, 0, 0, -4449], [0, -358695, 0, 0, -44492, 1912, 0, -2272, 0, -2882, 1221, 0], [-224134, 0, 36780, 424, 0, 0, 2896, 0, -1782, 0, 0, 6], [475994, 0, -50857, -40429, 0, 0, -3188, 0, -2362, 0, 0, -857], [0, 101100, 0, 0, -7536, 11406, 0, 6720, 0, -2490, -2004, 0], [-913338, 0, 74318, -56106, 0, 0, 5644, 0, -1324, 0, 0, 1344], [0, -621130, 0, 0, 50264, -40514, 0, -5770, 0, -1320, -354, 0], [-29153, 0, 47419, -21476, 0, 0, -5137, 0, -3857, 0, 0, -1237], [0, -113293, 0, 0, 19645, 15266, 0, 1930, 0, 6760, 6536, 0], [0, -506366, 0, 0, 87568, 64346, 0, -4748, 0, -4340, 2384, 0], [0, -328547, 0, 0, -43609, -3617, 0, 755, 0, -4870, 6343, 0], [929292, 0, 96644, 9802, 0, 0, -756, 0, -856, 0, 0, -8366], [-758398, 0, 48630, -89752, 0, 0, 572, 0, -2154, 0, 0, -2418], [0, 114013, 0, 0, -56092, -59760, 0, 13119, 0, 7435, -1539, 0], [0, -827345, 0, 0, -1568, 4198, 0, 7328, 0, 798, -4013, 0], [535126, 0, -5134, 13624, 0, 0, -7500, 0, -4894, 0, 0, -5750], [0, -1004527, 0, 0, -41131, -71951, 0, -3919, 0, -6374, -313, 0], [0, -465158, 0, 0, 17912, -13595, 0, 7566, 0, 8316, 10516, 0], [-2134840, 0, -58600, 67784, 0, 0, -566, 0, -298, 0, 0, 8194], [2447208, 0, 10180, -28732, 0, 0, -2544, 0, -3734, 0, 0, 4526], [-745620, 0, -1140, -45559, 0, 0, -18162, 0, 15427, 0, 0, -2230], [0, 174134, 0, 0, 115688, 255914, 0, 6722, 0, 10536, 3546, 0], [0, 531405, 0, 0, -73674, -35486, 0, -358, 0, 11422, -6635, 0], [-1458968, 0, -133712, 96775, 0, 0, 4130, 0, -9131, 0, 0, 12794], [0, 490744, 0, 0, 19696, -18742, 0, -8, 0, -14258, 4460, 0], [0, 680829, 0, 0, -108396, -85890, 0, 5307, 0, -21845, 2093, 0], [1522978, 0, -122320, 125520, 0, 0, -908, 0, -3144, 0, 0, 11392], [-1307681, 0, 18069, 57964, 0, 0, -28517, 0, 7203, 0, 0, 8403], [0, -822127, 0, 0, -71710, -195590, 0, -12874, 0, -3954, 3273, 0], [0, 853910, 0, 0, -17656, -170818, 0, 410, 0, -980, -11494, 0], [-1049678, 0, 289006, -146882, 0, 0, -2476, 0, -2960, 0, 0, -17056], [-1549221, 0, -45540, 121684, 0, 0, 19987, 0, 471, 0, 0, -13923], [2225896, 0, 57112, 112972, 0, 0, -8568, 0, 12258, 0, 0, -2218], [0, 2523311, 0, 0, -45671, -105840, 0, 17004, 0, 324, -16018, 0], [1139423, 0, -142345, -154900, 0, 0, -2517, 0, -13821, 0, 0, 1183], [141548, 0, 87826, 7808, 0, 0, 15018, 0, -21680, 0, 0, 25508], [0, 1521576, 0, 0, -18832, -356197, 0, -19112, 0, 6138, -12514, 0], [-2567220, 0, -241807, -88495, 0, 0, 5216, 0, -8368, 0, 0, 4025], [0, -663017, 0, 0, 16957, -64564, 0, 23236, 0, -5324, -2446, 0], [114268, 0, 35558, -125880, 0, 0, -3484, 0, 22658, 0, 0, -12734], [1819370, 0, 129805, -159503, 0, 0, -4484, 0, -13986, 0, 0, 1365], [0, -4030041, 0, 0, -6700, -166330, 0, 6076, 0, 46326, -877, 0], [0, -1656967, 0, 0, -200842, 84662, 0, 3562, 0, 17982, -8887, 0], [1099522, 0, -330778, 207477, 0, 0, -28906, 0, -6481, 0, 0, -10796], [0, -705890, 0, 0, 36808, -140527, 0, -5870, 0, -5480, -568, 0], [1213526, 0, 94384, -248976, 0, 0, -33036, 0, -964, 0, 0, 7124], [0, 4391331, 0, 0, -59211, 170332, 0, -27088, 0, -42308, 17938, 0], [0, -2810584, 0, 0, 195808, -75665, 0, 48708, 0, 17658, -12694, 0], [0, -1976157, 0, 0, 18953, 242776, 0, -46000, 0, 17180, -794, 0], [0, 1545936, 0, 0, 110136, 60060, 0, 978, 0, 4590, -24738, 0], [0, 3717655, 0, 0, 283459, 144074, 0, 4582, 0, -68, 21530, 0], [150051, 0, -125291, 625484, 0, 0, 3511, 0, 10227, 0, 0, -11149], [0, 301673, 0, 0, 118780, 564890, 0, 14974, 0, -8126, 6887, 0], [3243038, 0, 502650, -89968, 0, 0, 19148, 0, 18744, 0, 0, 13068], [0, -3985795, 0, 0, 190309, 205461, 0, 9225, 0, 130, -20309, 0], [-2326896, 0, 127882, 113264, 0, 0, -7150, 0, 38612, 0, 0, 30560], [-1787846, 0, -73682, 459532, 0, 0, 36968, 0, -18404, 0, 0, 36758], [3263335, 0, 518899, -94116, 0, 0, 16543, 0, -11537, 0, 0, 27323], [-7306680, 0, 303075, 40327, 0, 0, -21304, 0, 2784, 0, 0, -30365], [0, -7201187, 0, 0, -38580, 349722, 0, -10351, 0, 9263, 17655, 0], [3754941, 0, -216644, 421676, 0, 0, -28083, 0, 34897, 0, 0, -36613], [0, 2028191, 0, 0, 212102, 779268, 0, -6474, 0, 8086, -21729, 0], [-4609560, 0, 390372, 354758, 0, 0, -20580, 0, 44608, 0, 0, 17930], [4684567, 0, 228201, -269524, 0, 0, -26461, 0, 10983, 0, 0, 46959], [0, 876297, 0, 0, 55825, 636261, 0, 6705, 0, 68450, -20349, 0], [-2746794, 0, 289735, -416311, 0, 0, -26136, 0, 7024, 0, 0, -9793], [0, 1431589, 0, 0, -94724, 436466, 0, -27323, 0, 11491, 16163, 0], [0, 2940853, 0, 0, 245154, 394786, 0, 29678, 0, -28042, -19275, 0], [0, -2645942, 0, 0, -299504, -398828, 0, -19196, 0, -55516, 676, 0], [-1940277, 0, 720218, 344828, 0, 0, -48269, 0, 20381, 0, 0, 24811], [0, 389567, 0, 0, -111892, -68840, 0, 48341, 0, 8897, -53153, 0], [0, -919963, 0, 0, 447983, -105359, 0, -63943, 0, -11738, 31217, 0], [0, -3796769, 0, 0, 108544, 701866, 0, -18568, 0, 19542, -14093, 0], [0, 1498784, 0, 0, -463304, -60960, 0, 36882, 0, -113338, 8550, 0], [0, -9454720, 0, 0, 382224, 10551, 0, 7960, 0, -39210, 20086, 0], [3799422, 0, 157926, -252936, 0, 0, -37176, 0, 9306, 0, 0, 75684], [-9545966, 0, 333421, -181523, 0, 0, 19396, 0, -37738, 0, 0, -1687], [0, -3650908, 0, 0, -384512, 93960, 0, -25164, 0, -14878, 4572, 0], [0, -4032487, 0, 0, -57538, 296648, 0, -14576, 0, -45006, 45875, 0], [-3498366, 0, -251455, -96089, 0, 0, 10296, 0, -3724, 0, 0, 8173], [2788848, 0, -359940, 27790, 0, 0, -60964, 0, 56838, 0, 0, -28184], [0, 503416, 0, 0, 701488, 6846, 0, 3088, 0, 73946, -3428, 0], [3640358, 0, -392972, -500592, 0, 0, -26640, 0, -11572, 0, 0, -9220], [1314168, 0, 512236, -382664, 0, 0, -77470, 0, -70034, 0, 0, -77350], [0, -1315865, 0, 0, 820676, 608790, 0, 18315, 0, -383, -44307, 0], [0, 6979213, 0, 0, 16231, 389953, 0, 62705, 0, 79110, -3047, 0], [0, 2967521, 0, 0, -55188, -10210, 0, -40367, 0, -26473, 38255, 0], [-5795626, 0, -554216, 276144, 0, 0, 19948, 0, -25412, 0, 0, 69668], [0, 4824545, 0, 0, -550900, 353540, 0, 85324, 0, -50826, -33463, 0], [0, 10574556, 0, 0, 837720, 563820, 0, -18462, 0, 75438, 10494, 0], [-7831490, 0, -198076, 214169, 0, 0, -78910, 0, 48849, 0, 0, -92070], [0, -8072539, 0, 0, 488817, -468469, 0, -12605, 0, -73130, -3819, 0], [0, -5747032, 0, 0, -1382560, -454542, 0, -24676, 0, 58314, -43608, 0], [-696252, 0, 103130, -401012, 0, 0, -98604, 0, 30476, 0, 0, -35024], [0, 8147653, 0, 0, 341764, -768612, 0, -28841, 0, -36497, -48019, 0], [-708046, 0, -874156, -387640, 0, 0, 20004, 0, 60066, 0, 0, 43774], [0, 6820611, 0, 0, -198862, -67248, 0, -166638, 0, 12382, 18603, 0], [12708564, 0, 839439, -383067, 0, 0, -46140, 0, -23754, 0, 0, 156543], [0, 4592530, 0, 0, -748320, 518318, 0, 53360, 0, 2216, 53772, 0], [-10505571, 0, -816055, 435940, 0, 0, -69111, 0, 5237, 0, 0, 10369], [0, -11432037, 0, 0, 194491, 370824, 0, -179736, 0, -109216, -68964, 0], [-6185978, 0, 320275, 618565, 0, 0, 16664, 0, -42668, 0, 0, 40799], [0, -1716365, 0, 0, -723017, 94758, 0, 34914, 0, 9164, -52530, 0], [10753766, 0, -163540, 740654, 0, 0, -118808, 0, -56170, 0, 0, -116138], [-7566622, 0, -173570, -394068, 0, 0, -92824, 0, 95220, 0, 0, 76646], [-581149, 0, -1296425, 177180, 0, 0, -134729, 0, -10937, 0, 0, -16069], [-7122617, 0, 656000, -8780, 0, 0, -25029, 0, -57337, 0, 0, -22379], [0, 16754634, 0, 0, -295560, 940635, 0, -115938, 0, -15948, 5616, 0], [0, 13954513, 0, 0, -310529, -922783, 0, -175679, 0, 69046, 19085, 0], [11187960, 0, -764714, -37648, 0, 0, -94514, 0, 26484, 0, 0, 69176], [-8091310, 0, -990500, 156547, 0, 0, 123246, 0, 101659, 0, 0, 96510], [0, 4633267, 0, 0, 215484, -867884, 0, -38758, 0, 115722, -60103, 0], [-5389007, 0, -1276360, 1045932, 0, 0, -2547, 0, -109751, 0, 0, -115397], [-3303506, 0, 788671, -996785, 0, 0, 221060, 0, -50642, 0, 0, -43297], [-4962704, 0, -1054946, -166494, 0, 0, 46792, 0, -222228, 0, 0, -9938], [0, -33573007, 0, 0, 87884, 537676, 0, -9151, 0, 84299, -7397, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_320_d_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_320_6_d_d();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
function MakeNewformModFrm_320_6_d_d(:prec:=12)
    chi := MakeCharacter_320_d();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 6));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 1;
    while true do
        trunc_vec := Vector(Kf, [0] cat [f_vec[i]: i in [1..prec]]);
        B := Basis(S, prec + 1);
        S_basismat := Matrix([AbsEltseq(g): g in B]);
        if Rank(S_basismat) eq Min(NumberOfRows(S_basismat), NumberOfColumns(S_basismat)) then
            S_basismat := ChangeRing(S_basismat,Kf);
            f_lincom := Solution(S_basismat,trunc_vec);
            f := &+[f_lincom[i]*Basis(S)[i] : i in [1..#Basis(S)]];
            return f;
        end if;
        error if prec eq maxprec, "Unable to distinguish newform within newspace";
        prec := Min(Ceiling(1.25 * prec), maxprec);
    end while;
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_320_6_d_d();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function MakeNewformModSym_320_6_d_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_320_d();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,6,sign)));
    Vf := Kernel([<3,R![928201218624, 0, 165296582784, 0, 8614933552, 0, 160687168, 0, 862572, 0, 1672, 0, 1]>,<7,R![-603298353096, -4498079256, 328685460, 1534896, -40058, -134, 1]>],Snew);
    return Vf;
end function;