2017.04.11 09:49 PM
2017.04.12 08:18 AM
2017.04.12 09:52 AM
HS: {[c0; c1]// exclude common intervalsc0_p: c0@where not c0 in c1;c1_p: c1@where not c1 in c0;// minimal sum of the absolute distance between of all permutations between c1 and c0: $[0 = count hs: min sum each {HD each x} each abs each c0_p -'/: c1_p@perms[-1+count c1_p];0; // same chord? return 0 (same chords return empty lists)(abs hs) < 1e-5; // very small? return 00;hs // otherwise return the actual harmonic sum]};
q)k)permutations:{(,/@\:)/,\(,<<:)'x=\:x:!x};
q)perms: permutations each 1+til count primeOrder;
i:0;cutPrimes: 16 cut allOtherPrimes;while[i <= count cutPrimes;
show "Working on chunk ",(string i)," of ",string count cutPrimes;filename: `$"ht_4d_",string i;filename set ([] HS: {HS[pPrime; x]} peach cutPrimes[i]; IHD: {IHD[pPrime; x]} peach cutPrimes[i]; PV: {PV[pPrime; x]} peach cutPrimes[i]);delete filename from `.;i+::1;
];
q)// before table generationq).Q.w[]
used|210295952heap|268435456peak|268435456wmax|0mmap|0mphy|25238728704syms|638symw|20452q)i:0;
q)([] HS: {HS[pPrime; x]} peach cutPrimes[i]; IHD: {IHD[pPrime; x]} peach cutPrimes[i]; PV: {PV[pPrime; x]} peach cutPrimes[i])
HS IHD PV------------------------------------------------------------27.348234169259634 3.994476838856357 -2.210896782498624f31.015411433268973 7.6616541028657 1.456280481510717f71.94088011289334 0.5464091664079223 -7.916065108069992f15.387849050834898 0.29199816120364064 1.4562804815107278f
... ... ...
q).Q.w[]used|210291984heap|268435456peak|268435456wmax|0mmap|0mphy|25238728704syms|638symw|20452
q)i+:1;q) ([] HS: {HS[pPrime; x]} peach cutPrimes[i]; IHD: {IHD[pPrime; x]} peach cutPrimes[i]; PV: {PV[pPrime; x]} peach cutPrimes[i])
'wsfull
2017.04.14 01:35 PM
hs_tmp: ();ihd_tmp: ();pv_tmp: ();g:{hs_tmp,:: HS[pPrime; x];ihd_tmp,:: IHD[pPrime; x];pv_tmp,:: PV[pPrime; x];};
2017.04.12 10:07 AM
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.