diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index b982d50..cf8f15f 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -1,6 +1,7 @@ #+TITLE: Sherman-Morrison-Woodbury #+SETUPFILE: ../tools/theme.setup #+INCLUDE: ../tools/lib.org +#+STARTUP: content Low- and high-level functions that use the Sherman-Morrison and Woodbury matrix inversion formulas to update the inverse of a @@ -85,14 +86,14 @@ int main() { #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_sherman_morrison_c ( + qmckl_exit_code qmckl_sherman_morrison( const qmckl_context context, - const uint64_t Dim, - const uint64_t N_updates, + const uint64_t* Dim_p, + const uint64_t* N_updates_p, const double* Updates, const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv ); + const double* breakdown_p, + double* Slater_inv); #+end_src *** Source @@ -102,16 +103,17 @@ int main() { #include #include "qmckl.h" -qmckl_exit_code qmckl_sherman_morrison_c(const qmckl_context context, - const uint64_t Dim, - const uint64_t N_updates, +qmckl_exit_code qmckl_sherman_morrison_c_(const qmckl_context context, + const uint64_t* Dim_p, + const uint64_t* N_updates_p, const double* Updates, const uint64_t* Updates_index, - const double breakdown, - double * Slater_inv) { -// #ifdef DEBUG -// std::cerr << "Called qmckl_sherman_morrison with " << N_updates << " updates" << std::endl; -// #endif + const double* breakdown_p, + double* Slater_inv) { + + const uint64_t Dim = *Dim_p; + const uint64_t N_updates = *N_updates_p; + const double breakdown = *breakdown_p; double C[Dim]; double D[Dim]; @@ -169,15 +171,65 @@ qmckl_exit_code qmckl_sherman_morrison_c(const qmckl_context context, #+CALL: generate_c_interface(table=qmckl_sherman_morrison_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + #+RESULTS: + #+begin_src f90 :tangle (eval f) :comments org :exports none + integer(c_int32_t) function qmckl_sherman_morrison & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv) & + bind(C) result(info) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) :: Dim + integer (c_int64_t) , intent(in) :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + + integer(c_int32_t), external :: qmckl_sherman_morrison_c + info = qmckl_sherman_morrison_c & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv) + + end function qmckl_sherman_morrison + #+end_src + #+CALL: generate_f_interface(table=qmckl_sherman_morrison_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + #+RESULTS: + #+begin_src f90 :tangle (eval fh_func) :comments org :exports none + interface + integer(c_int32_t) function qmckl_sherman_morrison & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv) & + bind(C) + + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) :: Dim + integer (c_int64_t) , intent(in) :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + + end function qmckl_sherman_morrison + end interface + #+end_src + *** Test :noexport: The tests for the kernels are executed on datasets that are extracted from a run of QMC=Chem on Benzene (21 spin-up/21 spin down electrons) using 329 unique alpha determinants. The tests are run such that the kernels reject the computed inverse whenever the computed intermediate determinants or denominators are smaller than 1e-3. This is the default value in QMC=Chem. The tests will return QMCKL_SUCCESS whenever all the elements of the final matrix $R=S.S^-1 - 1$ are smaller than the given tolerance value of 1e-3, and will return QMCKL_FAILURE if the values are larger than this tolerance value. #+begin_src c :tangle (eval c_test) const uint64_t Dim = 21; +const uint64_t* Dim_p = &Dim; +const uint64_t* N_updates_p = NULL; const double breakdown = 1e-3; +const double* breakdown_p = &breakdown; const double tolerance = 1e-3; double res[441]; @@ -206,14 +258,16 @@ const uint64_t N_updates5 = 5; const uint64_t Updates_index5[5] = {17, 18, 19, 20, 21}; const double Updates5[105] = {-0.026680206879973502, 0.27298007905483301, -0.099715244024992294, -0.1053539039567112, -0.1449181307107206, 0.086803577840328203, -0.13467331603169441, 0.083233945071697304, -0.050348894670605604, 0.113249283283949, -0.18058512732386639, -0.013084722682833599, -0.2101329043507576, 0.29668186604976698, 0.011996015906333896, -0.25581711530685397, -0.18468007631599939, -0.19795016199350388, 0.13754389435052872, 0.066371031105519007, 0.1506568714976311, 0.1407152302563191, -0.035490237176418013, -0.15555772557854669, -0.13084962218999829, -0.065377140417695004, -0.28165902942419097, -0.0038048550486564081, -0.17355462908744812, 0.1904655769467351, 0.1015159860253334, -0.082969114184379605, 0.1009396240115165, 0.25867408514022822, -0.090622015297412997, -0.0261126160621643, -0.0070611685514450073, 0.34575527906417902, 0.1856994293630127, 0.1505507901310916, -0.24748291820287749, -0.1930690407752986, -0.10824421048164369, -0.2003080397844319, -0.050228431820869016, 0.2341227037832137, -0.1714876033365724, 0.32784904539585158, 0.040038149803876807, 0.12709141941741103, -0.088602993637323102, -0.1617441214621064, -0.237361330538988, -0.029239896684885004, 0.039443209767341697, -0.15546871721744498, -0.0127334967255592, -0.093294814229011994, -0.16617536172270789, 0.081297293305397006, -0.11561803519725759, -0.088157065212726496, 0.043941155076026403, -0.043334499001503005, -0.072291933000086989, 0.25947313755750623, -0.00654759816825385, -0.23022028384730242, -0.0992842186242342, -0.059074921417050084, 0.009816635400056898, -0.018885548226535299, 0.28729220479726802, 0.30690228054299934, 0.058271216228604303, 0.050839929841458791, -0.091462507843971003, 0.21059621125459649, -0.19497598148882408, 0.012118805199861502, -0.040971436537802185, -0.0676504261791709, -0.16150601254776081, 0.076545581221580811, -0.44388696737587502, 0.026131823658942982, -0.11532356310635784, 0.038358195684850299, 0.16635001881513747, 0.035624274984002099, 0.039094586856663179, 0.12423532153479717, 0.13070272840559499, 0.027002811431885002, -0.22131750034168385, 0.1172939799726007, -0.034513717517256695, 0.19796614628285178, 0.087915631011128009, 0.1338309701532128, -0.086308442056179102, -0.014136113226413699, 0.06877816375345, 0.11613245680928279, -0.16100704949349121}; const double Slater5[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, -0.42026260495185902, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, -0.12476679682731601, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, -0.0079971449449658394, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, 0.0250354297459126, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, -0.0016308756312355399, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.017600754275918, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, -0.0045592403039336196, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.120766848325729, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, 0.10763206332922, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.11803108453750601, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, -0.0018243347294628601, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, 0.140344902873039, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, 0.011294623836875, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.0101170120760798, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, -0.030968701466917999, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, -0.030221903696656199, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.061180751770734801, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.054775215685367598, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.0132825700566173, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, 0.0096404440701007808, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, -0.0153317032381892}; -// WB2+spl: 2,2,1 -double Slater_inv5_1[441] = {-0.054189244668834902, -105.426713929607, -88.458496476283003, 1.5333775291907901, -306.17152423250297, 211.834723659242, 189.348181800731, -164.85602878397, 1001.02895803198, -19.086531171244101, -14.1862411100869, 93.929906236367501, -177.880045125896, -6.7382862272631598, -14.511503830974201, 198.86948709278099, 116.24375034946701, -509.187787693936, -474.82187536023201, 185.49468275501101, -68.704359475869197, 0.066396729468773799, 128.61396390514599, 107.279152808508, -3.2214077352586501, 377.39638500462598, -258.32727230254102, -233.50899542599601, 202.73053181330999, -1222.6711957145401, 23.374193247961198, 17.0231928902612, -115.31992914359, 218.34781344598201, 8.5868800406738099, 17.706454078785399, -244.13052330624399, -142.42769283244499, 622.15335091370196, 579.15535219316803, -228.72024346964599, 85.262861528059901, 0.042977214694503003, -75.818887039648899, -63.4429496117761, 1.89037149893251, -221.440571714557, 152.54192851849001, 136.92110635753301, -119.073716594494, 720.98982202338402, -13.516656591400601, -9.7291496308540406, 67.372278162472895, -128.19425354399101, -4.9638472213270699, -10.200417492010599, 143.31769471617801, 83.615852083439094, -366.86654819753397, -341.426964056759, 133.98241248588599, -50.230799667840699, -0.074440153582489205, 131.003888225851, 110.340015781723, -1.92534262087524, 381.482058581253, -264.51148724341499, -236.035513173862, 204.43864191351099, -1249.3967405711001, 23.404380739562701, 17.427737318703301, -116.737852869633, 221.189913802663, 8.4677080090305399, 17.684126766935599, -247.44394443997601, -145.031902348194, 635.53348480709997, 592.58164589603302, -230.87850923206801, 85.694308069456397, -0.038299262589364599, -74.702005824131604, -63.171412849899497, 1.0859859506457199, -217.148397050222, 150.25957665606299, 134.431598757773, -117.013550651343, 708.34335491195498, -13.4940069422526, -9.5788103819957797, 66.593490547156307, -125.80391712960601, -4.7671091217963504, -10.2632044954116, 140.809682960885, 82.366527572926103, -360.28206877713399, -335.74815599116999, 131.925760239261, -48.660685665615503, -0.060749768867194, 106.92546569584999, 88.790343162838894, -2.6692288353747702, 312.16097467403699, -214.903931604847, -193.215823966269, 167.781122174079, -1018.10641886182, 19.107519450141002, 14.388719322765001, -95.267373183568594, 180.40857560667001, 6.9728512293157801, 14.4102075774752, -201.83015329787199, -117.917199027973, 518.09179195913805, 482.46342773412402, -189.25708821193001, 70.869624357767506, -0.000187411047696029, -11.9846117540694, -9.5726690972884096, 0.23970985157893901, -31.525734707294099, 26.424001662617101, 19.629541977294, -12.8111861333484, 126.186955595279, -0.21994779537689901, -1.75278408990554, 12.699562562401301, -19.050321348645301, 0.28466729039388, -1.07057307471916, 20.675591706275501, 13.1048598424623, -64.121267975873096, -59.394985304548896, 16.918592992744401, -7.70362909966763, 0.00036065684724530402, 12.9068309168011, 12.002712393435401, -0.33194601220397202, 40.326484701927001, -31.878253347415502, -25.170560077575001, 17.9905011861023, -156.05779622500401, 0.28522581276215098, 2.06069522309385, -17.151275363286, 25.397351917205899, 2.08581286823873, 0.91118057859336898, -26.515090998756101, -14.4035822159035, 78.890023885294596, 75.240667711773398, -20.769502289340899, 10.973365712218101, 0.00054214253230406803, -2.29504518628212, -2.1312244512866698, 0.047562978801466302, -10.6318457557031, 3.0591772010668401, 6.6375862982055702, -4.4363733110097296, 16.291945106274301, -0.062929125223047597, -0.16835581689436099, 6.0820271877694996, -5.8351950377758204, 0.35401259185447298, -0.90070453596893996, 6.0382685793059503, 2.4785619931575602, -8.4908203096171402, -8.6197966065449307, 5.8804527059182696, -1.67757738078734, 0.00096800508899916803, -2.4934502646428101, -4.5195305250493698, 0.052900907147883501, -6.5403147654399101, 8.5375829900159896, 4.1350660479474399, -1.63386715634978, 39.5635438458416, -0.11054656518749099, -0.56905231469759199, 10.2311793759502, -8.8014973731182806, -1.42214511908425, -1.9356586876592501, 7.4277556761303396, 2.8985267278915199, -19.981167223464801, -18.310196540769098, 1.3631485584979499, -1.4104996470922699, 0.000167515045034934, 10.6237721447983, 9.6125946891096099, -0.20829092726741699, 28.481388931713699, -22.584157610136199, -17.8392407006579, 11.6781776869203, -110.705963174229, 0.192721307745398, 1.4471736958685699, -11.629464509211299, 19.0388155304672, -0.23390314175395899, 0.62505732559282601, -19.284349111137399, -11.6199046959709, 56.562315732201498, 53.440734762614099, -13.464260193464, 6.5494922727750904, -0.00064712664753083498, 0.51012013976619996, -0.40601608060218902, -0.010304898323864499, -1.9162384482042301, 0.67040773560745603, 1.4195140953666501, 1.89175006728124, 8.4997123797302105, -0.053837688493721801, -0.0081694468687663092, 7.5841687069424202, -3.9864241641726901, 0.82441242748559596, 1.28841942280286, 2.4602644684099202, -0.65833650503714802, -2.93422340475106, -4.7994849299481297, -3.1153746742144999, 0.76509679552570997, -0.00094253467883977896, 4.5884404541075803, 2.5577714145483599, -0.100362327319965, 18.711173319888399, -7.5191542625802104, -11.814804467633101, 7.51205003788884, -36.605280961279099, 0.11460812693040601, 0.498461399643222, -10.903564320961401, 13.2948947844546, -0.64349351510306596, 1.9974412451213299, -11.727821769419799, -4.9603602940684901, 17.916362650168399, 17.291804112001799, -7.9761250950845, 3.6407278735208699, -0.000183321670183587, 6.4691421816769399, 6.0512576241625498, -0.15162968127745899, 23.395366108183801, -14.5381852262701, -14.606223833564799, 10.199271998597199, -73.975176230999594, 0.109352036334604, 0.939662287060122, -5.0493506777824901, 12.432450504307001, 0.66340082972807302, 0.89171490853171798, -14.301193838340501, -7.1767924210601599, 37.417730343433, 34.621199008384998, -12.2257905481279, 5.0337643040644098, 0.00077853683475417402, -4.0437466042030499, -3.2232682351578399, 0.038202731665628202, -12.153196028398099, 6.5027616010011799, 7.2973627140258399, -12.054113026894999, 23.6623418919025, 0.0029087480524890102, -0.465988240269751, -5.8215678299339997, -0.92982871489462304, 0.72875377435640498, -1.76856112702097, 3.9100682853776498, 4.3638012685037904, -12.532035664209801, -10.8596693966264, 12.5729914998231, -1.17795314966104, -0.00047116201805309901, 2.7712702890005598, 1.4259517039641101, -0.060855532638316702, 9.8783846948200704, -5.3156162802238898, -6.24217543532784, 4.0955113938692902, -22.6133771249789, 0.0576846298115802, 0.37261538596098298, -5.69311024324454, 6.6165547759347501, -0.31572322723037299, 1.2076815066994999, -7.13883450856141, -3.0036796657518701, 12.888731168100399, 10.144844547714699, -3.4202567509716602, 2.2424073656324301, 0.00046719815518450402, -6.1786048720593501, -4.9366254575058903, 0.121293000821164, -13.5354546658637, 11.122151465656, 8.2996176249675795, -7.8492497139147304, 53.792699096533298, -0.056207389907105297, -0.72284563910330601, -0.034988476570927102, -5.8914910450597402, -0.57259031868870103, -1.3110690999933601, 8.9888650972260002, 6.8430482968640902, -26.406527264610599, -25.8419474444987, 8.95444342115516, -4.1168180484580699, 0.00068908057573134802, -2.0076563509740999, -3.65231424825159, 0.042894239647239998, -9.7520285174303201, 7.9819862061298199, 6.2214414143151, -1.1841920217922099, 31.911005041941699, -0.080053013664620296, -0.54185675163812796, 8.0781654837979193, -9.3493294125201594, -1.24083642122091, -1.6208022544009499, 8.8607449463367196, 2.3445831189331501, -16.218420387174199, -15.8119148955707, 1.7389982134136399, -1.0509978817476, -3.48584361237575e-05, 0.61330220442703598, 2.33052219623813, -0.0057796507046079101, 5.3801162861110896, -1.7460100802854299, -3.4260231079769401, 1.85323155008146, -1.34565392401789, 0.0020702237459098, 0.147768044797361, -0.43649104760725999, 0.997972495465969, 0.056933085588242997, 0.0077486424610570597, -0.89070134502194598, -0.68148789029708001, 0.89518325797891696, 0.16523545732706499, -2.8298454160600501, 0.26096748561569599, -3.9951230141139501e-05, 2.6625953366596802, 0.159171360187916, -0.0080654609832386693, 14.485659114429501, 0.26188806209423798, -8.9564367313419204, 9.5170929366304993, 3.6594343436186199, 0.017879567938259198, 0.0042052494877241001, -1.4377710841437801, 5.8763150360799203, 0.47441391996743998, -0.014783250610591801, -7.06163381200634, -2.9885184999935599, -1.42889911045556, -2.4433038426403901, -9.8958894810457991, 0.55194555716779503, -5.7250805560848302e-05, 0.98372766353792995, 3.2392588139392098, -0.0119630481344816, 0.14153713576169, -2.73924503033615, 0.060309030316031902, 2.34167965625057, -3.8604817562043001, 0.012593073725828199, 0.22349082635471901, -0.35749918018293803, 2.0835157939561699, 0.13368765195851301, 0.0515445449292352, -2.95655438325227, -1.09680637412728, 2.2418386652533302, 1.2169977713442901, -1.20005576483735, 0.48385142427875799}; -// WB3+splL 3,1,1 -double Slater_inv5_2[441] = {-0.054189244668834902, -105.426713929607, -88.458496476283003, 1.5333775291907901, -306.17152423250297, 211.834723659242, 189.348181800731, -164.85602878397, 1001.02895803198, -19.086531171244101, -14.1862411100869, 93.929906236367501, -177.880045125896, -6.7382862272631598, -14.511503830974201, 198.86948709278099, 116.24375034946701, -509.187787693936, -474.82187536023201, 185.49468275501101, -68.704359475869197, 0.066396729468773799, 128.61396390514599, 107.279152808508, -3.2214077352586501, 377.39638500462598, -258.32727230254102, -233.50899542599601, 202.73053181330999, -1222.6711957145401, 23.374193247961198, 17.0231928902612, -115.31992914359, 218.34781344598201, 8.5868800406738099, 17.706454078785399, -244.13052330624399, -142.42769283244499, 622.15335091370196, 579.15535219316803, -228.72024346964599, 85.262861528059901, 0.042977214694503003, -75.818887039648899, -63.4429496117761, 1.89037149893251, -221.440571714557, 152.54192851849001, 136.92110635753301, -119.073716594494, 720.98982202338402, -13.516656591400601, -9.7291496308540406, 67.372278162472895, -128.19425354399101, -4.9638472213270699, -10.200417492010599, 143.31769471617801, 83.615852083439094, -366.86654819753397, -341.426964056759, 133.98241248588599, -50.230799667840699, -0.074440153582489205, 131.003888225851, 110.340015781723, -1.92534262087524, 381.482058581253, -264.51148724341499, -236.035513173862, 204.43864191351099, -1249.3967405711001, 23.404380739562701, 17.427737318703301, -116.737852869633, 221.189913802663, 8.4677080090305399, 17.684126766935599, -247.44394443997601, -145.031902348194, 635.53348480709997, 592.58164589603302, -230.87850923206801, 85.694308069456397, -0.038299262589364599, -74.702005824131604, -63.171412849899497, 1.0859859506457199, -217.148397050222, 150.25957665606299, 134.431598757773, -117.013550651343, 708.34335491195498, -13.4940069422526, -9.5788103819957797, 66.593490547156307, -125.80391712960601, -4.7671091217963504, -10.2632044954116, 140.809682960885, 82.366527572926103, -360.28206877713399, -335.74815599116999, 131.925760239261, -48.660685665615503, -0.060749768867194, 106.92546569584999, 88.790343162838894, -2.6692288353747702, 312.16097467403699, -214.903931604847, -193.215823966269, 167.781122174079, -1018.10641886182, 19.107519450141002, 14.388719322765001, -95.267373183568594, 180.40857560667001, 6.9728512293157801, 14.4102075774752, -201.83015329787199, -117.917199027973, 518.09179195913805, 482.46342773412402, -189.25708821193001, 70.869624357767506, -0.000187411047696029, -11.9846117540694, -9.5726690972884096, 0.23970985157893901, -31.525734707294099, 26.424001662617101, 19.629541977294, -12.8111861333484, 126.186955595279, -0.21994779537689901, -1.75278408990554, 12.699562562401301, -19.050321348645301, 0.28466729039388, -1.07057307471916, 20.675591706275501, 13.1048598424623, -64.121267975873096, -59.394985304548896, 16.918592992744401, -7.70362909966763, 0.00036065684724530402, 12.9068309168011, 12.002712393435401, -0.33194601220397202, 40.326484701927001, -31.878253347415502, -25.170560077575001, 17.9905011861023, -156.05779622500401, 0.28522581276215098, 2.06069522309385, -17.151275363286, 25.397351917205899, 2.08581286823873, 0.91118057859336898, -26.515090998756101, -14.4035822159035, 78.890023885294596, 75.240667711773398, -20.769502289340899, 10.973365712218101, 0.00054214253230406803, -2.29504518628212, -2.1312244512866698, 0.047562978801466302, -10.6318457557031, 3.0591772010668401, 6.6375862982055702, -4.4363733110097296, 16.291945106274301, -0.062929125223047597, -0.16835581689436099, 6.0820271877694996, -5.8351950377758204, 0.35401259185447298, -0.90070453596893996, 6.0382685793059503, 2.4785619931575602, -8.4908203096171402, -8.6197966065449307, 5.8804527059182696, -1.67757738078734, 0.00096800508899916803, -2.4934502646428101, -4.5195305250493698, 0.052900907147883501, -6.5403147654399101, 8.5375829900159896, 4.1350660479474399, -1.63386715634978, 39.5635438458416, -0.11054656518749099, -0.56905231469759199, 10.2311793759502, -8.8014973731182806, -1.42214511908425, -1.9356586876592501, 7.4277556761303396, 2.8985267278915199, -19.981167223464801, -18.310196540769098, 1.3631485584979499, -1.4104996470922699, 0.000167515045034934, 10.6237721447983, 9.6125946891096099, -0.20829092726741699, 28.481388931713699, -22.584157610136199, -17.8392407006579, 11.6781776869203, -110.705963174229, 0.192721307745398, 1.4471736958685699, -11.629464509211299, 19.0388155304672, -0.23390314175395899, 0.62505732559282601, -19.284349111137399, -11.6199046959709, 56.562315732201498, 53.440734762614099, -13.464260193464, 6.5494922727750904, -0.00064712664753083498, 0.51012013976619996, -0.40601608060218902, -0.010304898323864499, -1.9162384482042301, 0.67040773560745603, 1.4195140953666501, 1.89175006728124, 8.4997123797302105, -0.053837688493721801, -0.0081694468687663092, 7.5841687069424202, -3.9864241641726901, 0.82441242748559596, 1.28841942280286, 2.4602644684099202, -0.65833650503714802, -2.93422340475106, -4.7994849299481297, -3.1153746742144999, 0.76509679552570997, -0.00094253467883977896, 4.5884404541075803, 2.5577714145483599, -0.100362327319965, 18.711173319888399, -7.5191542625802104, -11.814804467633101, 7.51205003788884, -36.605280961279099, 0.11460812693040601, 0.498461399643222, -10.903564320961401, 13.2948947844546, -0.64349351510306596, 1.9974412451213299, -11.727821769419799, -4.9603602940684901, 17.916362650168399, 17.291804112001799, -7.9761250950845, 3.6407278735208699, -0.000183321670183587, 6.4691421816769399, 6.0512576241625498, -0.15162968127745899, 23.395366108183801, -14.5381852262701, -14.606223833564799, 10.199271998597199, -73.975176230999594, 0.109352036334604, 0.939662287060122, -5.0493506777824901, 12.432450504307001, 0.66340082972807302, 0.89171490853171798, -14.301193838340501, -7.1767924210601599, 37.417730343433, 34.621199008384998, -12.2257905481279, 5.0337643040644098, 0.00077853683475417402, -4.0437466042030499, -3.2232682351578399, 0.038202731665628202, -12.153196028398099, 6.5027616010011799, 7.2973627140258399, -12.054113026894999, 23.6623418919025, 0.0029087480524890102, -0.465988240269751, -5.8215678299339997, -0.92982871489462304, 0.72875377435640498, -1.76856112702097, 3.9100682853776498, 4.3638012685037904, -12.532035664209801, -10.8596693966264, 12.5729914998231, -1.17795314966104, -0.00047116201805309901, 2.7712702890005598, 1.4259517039641101, -0.060855532638316702, 9.8783846948200704, -5.3156162802238898, -6.24217543532784, 4.0955113938692902, -22.6133771249789, 0.0576846298115802, 0.37261538596098298, -5.69311024324454, 6.6165547759347501, -0.31572322723037299, 1.2076815066994999, -7.13883450856141, -3.0036796657518701, 12.888731168100399, 10.144844547714699, -3.4202567509716602, 2.2424073656324301, 0.00046719815518450402, -6.1786048720593501, -4.9366254575058903, 0.121293000821164, -13.5354546658637, 11.122151465656, 8.2996176249675795, -7.8492497139147304, 53.792699096533298, -0.056207389907105297, -0.72284563910330601, -0.034988476570927102, -5.8914910450597402, -0.57259031868870103, -1.3110690999933601, 8.9888650972260002, 6.8430482968640902, -26.406527264610599, -25.8419474444987, 8.95444342115516, -4.1168180484580699, 0.00068908057573134802, -2.0076563509740999, -3.65231424825159, 0.042894239647239998, -9.7520285174303201, 7.9819862061298199, 6.2214414143151, -1.1841920217922099, 31.911005041941699, -0.080053013664620296, -0.54185675163812796, 8.0781654837979193, -9.3493294125201594, -1.24083642122091, -1.6208022544009499, 8.8607449463367196, 2.3445831189331501, -16.218420387174199, -15.8119148955707, 1.7389982134136399, -1.0509978817476, -3.48584361237575e-05, 0.61330220442703598, 2.33052219623813, -0.0057796507046079101, 5.3801162861110896, -1.7460100802854299, -3.4260231079769401, 1.85323155008146, -1.34565392401789, 0.0020702237459098, 0.147768044797361, -0.43649104760725999, 0.997972495465969, 0.056933085588242997, 0.0077486424610570597, -0.89070134502194598, -0.68148789029708001, 0.89518325797891696, 0.16523545732706499, -2.8298454160600501, 0.26096748561569599, -3.9951230141139501e-05, 2.6625953366596802, 0.159171360187916, -0.0080654609832386693, 14.485659114429501, 0.26188806209423798, -8.9564367313419204, 9.5170929366304993, 3.6594343436186199, 0.017879567938259198, 0.0042052494877241001, -1.4377710841437801, 5.8763150360799203, 0.47441391996743998, -0.014783250610591801, -7.06163381200634, -2.9885184999935599, -1.42889911045556, -2.4433038426403901, -9.8958894810457991, 0.55194555716779503, -5.7250805560848302e-05, 0.98372766353792995, 3.2392588139392098, -0.0119630481344816, 0.14153713576169, -2.73924503033615, 0.060309030316031902, 2.34167965625057, -3.8604817562043001, 0.012593073725828199, 0.22349082635471901, -0.35749918018293803, 2.0835157939561699, 0.13368765195851301, 0.0515445449292352, -2.95655438325227, -1.09680637412728, 2.2418386652533302, 1.2169977713442901, -1.20005576483735, 0.48385142427875799}; -// WB3,2+spl: 3,2 -double Slater_inv5_3[441] = {-0.054189244668834902, -105.426713929607, -88.458496476283003, 1.5333775291907901, -306.17152423250297, 211.834723659242, 189.348181800731, -164.85602878397, 1001.02895803198, -19.086531171244101, -14.1862411100869, 93.929906236367501, -177.880045125896, -6.7382862272631598, -14.511503830974201, 198.86948709278099, 116.24375034946701, -509.187787693936, -474.82187536023201, 185.49468275501101, -68.704359475869197, 0.066396729468773799, 128.61396390514599, 107.279152808508, -3.2214077352586501, 377.39638500462598, -258.32727230254102, -233.50899542599601, 202.73053181330999, -1222.6711957145401, 23.374193247961198, 17.0231928902612, -115.31992914359, 218.34781344598201, 8.5868800406738099, 17.706454078785399, -244.13052330624399, -142.42769283244499, 622.15335091370196, 579.15535219316803, -228.72024346964599, 85.262861528059901, 0.042977214694503003, -75.818887039648899, -63.4429496117761, 1.89037149893251, -221.440571714557, 152.54192851849001, 136.92110635753301, -119.073716594494, 720.98982202338402, -13.516656591400601, -9.7291496308540406, 67.372278162472895, -128.19425354399101, -4.9638472213270699, -10.200417492010599, 143.31769471617801, 83.615852083439094, -366.86654819753397, -341.426964056759, 133.98241248588599, -50.230799667840699, -0.074440153582489205, 131.003888225851, 110.340015781723, -1.92534262087524, 381.482058581253, -264.51148724341499, -236.035513173862, 204.43864191351099, -1249.3967405711001, 23.404380739562701, 17.427737318703301, -116.737852869633, 221.189913802663, 8.4677080090305399, 17.684126766935599, -247.44394443997601, -145.031902348194, 635.53348480709997, 592.58164589603302, -230.87850923206801, 85.694308069456397, -0.038299262589364599, -74.702005824131604, -63.171412849899497, 1.0859859506457199, -217.148397050222, 150.25957665606299, 134.431598757773, -117.013550651343, 708.34335491195498, -13.4940069422526, -9.5788103819957797, 66.593490547156307, -125.80391712960601, -4.7671091217963504, -10.2632044954116, 140.809682960885, 82.366527572926103, -360.28206877713399, -335.74815599116999, 131.925760239261, -48.660685665615503, -0.060749768867194, 106.92546569584999, 88.790343162838894, -2.6692288353747702, 312.16097467403699, -214.903931604847, -193.215823966269, 167.781122174079, -1018.10641886182, 19.107519450141002, 14.388719322765001, -95.267373183568594, 180.40857560667001, 6.9728512293157801, 14.4102075774752, -201.83015329787199, -117.917199027973, 518.09179195913805, 482.46342773412402, -189.25708821193001, 70.869624357767506, -0.000187411047696029, -11.9846117540694, -9.5726690972884096, 0.23970985157893901, -31.525734707294099, 26.424001662617101, 19.629541977294, -12.8111861333484, 126.186955595279, -0.21994779537689901, -1.75278408990554, 12.699562562401301, -19.050321348645301, 0.28466729039388, -1.07057307471916, 20.675591706275501, 13.1048598424623, -64.121267975873096, -59.394985304548896, 16.918592992744401, -7.70362909966763, 0.00036065684724530402, 12.9068309168011, 12.002712393435401, -0.33194601220397202, 40.326484701927001, -31.878253347415502, -25.170560077575001, 17.9905011861023, -156.05779622500401, 0.28522581276215098, 2.06069522309385, -17.151275363286, 25.397351917205899, 2.08581286823873, 0.91118057859336898, -26.515090998756101, -14.4035822159035, 78.890023885294596, 75.240667711773398, -20.769502289340899, 10.973365712218101, 0.00054214253230406803, -2.29504518628212, -2.1312244512866698, 0.047562978801466302, -10.6318457557031, 3.0591772010668401, 6.6375862982055702, -4.4363733110097296, 16.291945106274301, -0.062929125223047597, -0.16835581689436099, 6.0820271877694996, -5.8351950377758204, 0.35401259185447298, -0.90070453596893996, 6.0382685793059503, 2.4785619931575602, -8.4908203096171402, -8.6197966065449307, 5.8804527059182696, -1.67757738078734, 0.00096800508899916803, -2.4934502646428101, -4.5195305250493698, 0.052900907147883501, -6.5403147654399101, 8.5375829900159896, 4.1350660479474399, -1.63386715634978, 39.5635438458416, -0.11054656518749099, -0.56905231469759199, 10.2311793759502, -8.8014973731182806, -1.42214511908425, -1.9356586876592501, 7.4277556761303396, 2.8985267278915199, -19.981167223464801, -18.310196540769098, 1.3631485584979499, -1.4104996470922699, 0.000167515045034934, 10.6237721447983, 9.6125946891096099, -0.20829092726741699, 28.481388931713699, -22.584157610136199, -17.8392407006579, 11.6781776869203, -110.705963174229, 0.192721307745398, 1.4471736958685699, -11.629464509211299, 19.0388155304672, -0.23390314175395899, 0.62505732559282601, -19.284349111137399, -11.6199046959709, 56.562315732201498, 53.440734762614099, -13.464260193464, 6.5494922727750904, -0.00064712664753083498, 0.51012013976619996, -0.40601608060218902, -0.010304898323864499, -1.9162384482042301, 0.67040773560745603, 1.4195140953666501, 1.89175006728124, 8.4997123797302105, -0.053837688493721801, -0.0081694468687663092, 7.5841687069424202, -3.9864241641726901, 0.82441242748559596, 1.28841942280286, 2.4602644684099202, -0.65833650503714802, -2.93422340475106, -4.7994849299481297, -3.1153746742144999, 0.76509679552570997, -0.00094253467883977896, 4.5884404541075803, 2.5577714145483599, -0.100362327319965, 18.711173319888399, -7.5191542625802104, -11.814804467633101, 7.51205003788884, -36.605280961279099, 0.11460812693040601, 0.498461399643222, -10.903564320961401, 13.2948947844546, -0.64349351510306596, 1.9974412451213299, -11.727821769419799, -4.9603602940684901, 17.916362650168399, 17.291804112001799, -7.9761250950845, 3.6407278735208699, -0.000183321670183587, 6.4691421816769399, 6.0512576241625498, -0.15162968127745899, 23.395366108183801, -14.5381852262701, -14.606223833564799, 10.199271998597199, -73.975176230999594, 0.109352036334604, 0.939662287060122, -5.0493506777824901, 12.432450504307001, 0.66340082972807302, 0.89171490853171798, -14.301193838340501, -7.1767924210601599, 37.417730343433, 34.621199008384998, -12.2257905481279, 5.0337643040644098, 0.00077853683475417402, -4.0437466042030499, -3.2232682351578399, 0.038202731665628202, -12.153196028398099, 6.5027616010011799, 7.2973627140258399, -12.054113026894999, 23.6623418919025, 0.0029087480524890102, -0.465988240269751, -5.8215678299339997, -0.92982871489462304, 0.72875377435640498, -1.76856112702097, 3.9100682853776498, 4.3638012685037904, -12.532035664209801, -10.8596693966264, 12.5729914998231, -1.17795314966104, -0.00047116201805309901, 2.7712702890005598, 1.4259517039641101, -0.060855532638316702, 9.8783846948200704, -5.3156162802238898, -6.24217543532784, 4.0955113938692902, -22.6133771249789, 0.0576846298115802, 0.37261538596098298, -5.69311024324454, 6.6165547759347501, -0.31572322723037299, 1.2076815066994999, -7.13883450856141, -3.0036796657518701, 12.888731168100399, 10.144844547714699, -3.4202567509716602, 2.2424073656324301, 0.00046719815518450402, -6.1786048720593501, -4.9366254575058903, 0.121293000821164, -13.5354546658637, 11.122151465656, 8.2996176249675795, -7.8492497139147304, 53.792699096533298, -0.056207389907105297, -0.72284563910330601, -0.034988476570927102, -5.8914910450597402, -0.57259031868870103, -1.3110690999933601, 8.9888650972260002, 6.8430482968640902, -26.406527264610599, -25.8419474444987, 8.95444342115516, -4.1168180484580699, 0.00068908057573134802, -2.0076563509740999, -3.65231424825159, 0.042894239647239998, -9.7520285174303201, 7.9819862061298199, 6.2214414143151, -1.1841920217922099, 31.911005041941699, -0.080053013664620296, -0.54185675163812796, 8.0781654837979193, -9.3493294125201594, -1.24083642122091, -1.6208022544009499, 8.8607449463367196, 2.3445831189331501, -16.218420387174199, -15.8119148955707, 1.7389982134136399, -1.0509978817476, -3.48584361237575e-05, 0.61330220442703598, 2.33052219623813, -0.0057796507046079101, 5.3801162861110896, -1.7460100802854299, -3.4260231079769401, 1.85323155008146, -1.34565392401789, 0.0020702237459098, 0.147768044797361, -0.43649104760725999, 0.997972495465969, 0.056933085588242997, 0.0077486424610570597, -0.89070134502194598, -0.68148789029708001, 0.89518325797891696, 0.16523545732706499, -2.8298454160600501, 0.26096748561569599, -3.9951230141139501e-05, 2.6625953366596802, 0.159171360187916, -0.0080654609832386693, 14.485659114429501, 0.26188806209423798, -8.9564367313419204, 9.5170929366304993, 3.6594343436186199, 0.017879567938259198, 0.0042052494877241001, -1.4377710841437801, 5.8763150360799203, 0.47441391996743998, -0.014783250610591801, -7.06163381200634, -2.9885184999935599, -1.42889911045556, -2.4433038426403901, -9.8958894810457991, 0.55194555716779503, -5.7250805560848302e-05, 0.98372766353792995, 3.2392588139392098, -0.0119630481344816, 0.14153713576169, -2.73924503033615, 0.060309030316031902, 2.34167965625057, -3.8604817562043001, 0.012593073725828199, 0.22349082635471901, -0.35749918018293803, 2.0835157939561699, 0.13368765195851301, 0.0515445449292352, -2.95655438325227, -1.09680637412728, 2.2418386652533302, 1.2169977713442901, -1.20005576483735, 0.48385142427875799}; +double Slater_inv5[441] = {-0.054189244668834902, -105.426713929607, -88.458496476283003, 1.5333775291907901, -306.17152423250297, 211.834723659242, 189.348181800731, -164.85602878397, 1001.02895803198, -19.086531171244101, -14.1862411100869, 93.929906236367501, -177.880045125896, -6.7382862272631598, -14.511503830974201, 198.86948709278099, 116.24375034946701, -509.187787693936, -474.82187536023201, 185.49468275501101, -68.704359475869197, 0.066396729468773799, 128.61396390514599, 107.279152808508, -3.2214077352586501, 377.39638500462598, -258.32727230254102, -233.50899542599601, 202.73053181330999, -1222.6711957145401, 23.374193247961198, 17.0231928902612, -115.31992914359, 218.34781344598201, 8.5868800406738099, 17.706454078785399, -244.13052330624399, -142.42769283244499, 622.15335091370196, 579.15535219316803, -228.72024346964599, 85.262861528059901, 0.042977214694503003, -75.818887039648899, -63.4429496117761, 1.89037149893251, -221.440571714557, 152.54192851849001, 136.92110635753301, -119.073716594494, 720.98982202338402, -13.516656591400601, -9.7291496308540406, 67.372278162472895, -128.19425354399101, -4.9638472213270699, -10.200417492010599, 143.31769471617801, 83.615852083439094, -366.86654819753397, -341.426964056759, 133.98241248588599, -50.230799667840699, -0.074440153582489205, 131.003888225851, 110.340015781723, -1.92534262087524, 381.482058581253, -264.51148724341499, -236.035513173862, 204.43864191351099, -1249.3967405711001, 23.404380739562701, 17.427737318703301, -116.737852869633, 221.189913802663, 8.4677080090305399, 17.684126766935599, -247.44394443997601, -145.031902348194, 635.53348480709997, 592.58164589603302, -230.87850923206801, 85.694308069456397, -0.038299262589364599, -74.702005824131604, -63.171412849899497, 1.0859859506457199, -217.148397050222, 150.25957665606299, 134.431598757773, -117.013550651343, 708.34335491195498, -13.4940069422526, -9.5788103819957797, 66.593490547156307, -125.80391712960601, -4.7671091217963504, -10.2632044954116, 140.809682960885, 82.366527572926103, -360.28206877713399, -335.74815599116999, 131.925760239261, -48.660685665615503, -0.060749768867194, 106.92546569584999, 88.790343162838894, -2.6692288353747702, 312.16097467403699, -214.903931604847, -193.215823966269, 167.781122174079, -1018.10641886182, 19.107519450141002, 14.388719322765001, -95.267373183568594, 180.40857560667001, 6.9728512293157801, 14.4102075774752, -201.83015329787199, -117.917199027973, 518.09179195913805, 482.46342773412402, -189.25708821193001, 70.869624357767506, -0.000187411047696029, -11.9846117540694, -9.5726690972884096, 0.23970985157893901, -31.525734707294099, 26.424001662617101, 19.629541977294, -12.8111861333484, 126.186955595279, -0.21994779537689901, -1.75278408990554, 12.699562562401301, -19.050321348645301, 0.28466729039388, -1.07057307471916, 20.675591706275501, 13.1048598424623, -64.121267975873096, -59.394985304548896, 16.918592992744401, -7.70362909966763, 0.00036065684724530402, 12.9068309168011, 12.002712393435401, -0.33194601220397202, 40.326484701927001, -31.878253347415502, -25.170560077575001, 17.9905011861023, -156.05779622500401, 0.28522581276215098, 2.06069522309385, -17.151275363286, 25.397351917205899, 2.08581286823873, 0.91118057859336898, -26.515090998756101, -14.4035822159035, 78.890023885294596, 75.240667711773398, -20.769502289340899, 10.973365712218101, 0.00054214253230406803, -2.29504518628212, -2.1312244512866698, 0.047562978801466302, -10.6318457557031, 3.0591772010668401, 6.6375862982055702, -4.4363733110097296, 16.291945106274301, -0.062929125223047597, -0.16835581689436099, 6.0820271877694996, -5.8351950377758204, 0.35401259185447298, -0.90070453596893996, 6.0382685793059503, 2.4785619931575602, -8.4908203096171402, -8.6197966065449307, 5.8804527059182696, -1.67757738078734, 0.00096800508899916803, -2.4934502646428101, -4.5195305250493698, 0.052900907147883501, -6.5403147654399101, 8.5375829900159896, 4.1350660479474399, -1.63386715634978, 39.5635438458416, -0.11054656518749099, -0.56905231469759199, 10.2311793759502, -8.8014973731182806, -1.42214511908425, -1.9356586876592501, 7.4277556761303396, 2.8985267278915199, -19.981167223464801, -18.310196540769098, 1.3631485584979499, -1.4104996470922699, 0.000167515045034934, 10.6237721447983, 9.6125946891096099, -0.20829092726741699, 28.481388931713699, -22.584157610136199, -17.8392407006579, 11.6781776869203, -110.705963174229, 0.192721307745398, 1.4471736958685699, -11.629464509211299, 19.0388155304672, -0.23390314175395899, 0.62505732559282601, -19.284349111137399, -11.6199046959709, 56.562315732201498, 53.440734762614099, -13.464260193464, 6.5494922727750904, -0.00064712664753083498, 0.51012013976619996, -0.40601608060218902, -0.010304898323864499, -1.9162384482042301, 0.67040773560745603, 1.4195140953666501, 1.89175006728124, 8.4997123797302105, -0.053837688493721801, -0.0081694468687663092, 7.5841687069424202, -3.9864241641726901, 0.82441242748559596, 1.28841942280286, 2.4602644684099202, -0.65833650503714802, -2.93422340475106, -4.7994849299481297, -3.1153746742144999, 0.76509679552570997, -0.00094253467883977896, 4.5884404541075803, 2.5577714145483599, -0.100362327319965, 18.711173319888399, -7.5191542625802104, -11.814804467633101, 7.51205003788884, -36.605280961279099, 0.11460812693040601, 0.498461399643222, -10.903564320961401, 13.2948947844546, -0.64349351510306596, 1.9974412451213299, -11.727821769419799, -4.9603602940684901, 17.916362650168399, 17.291804112001799, -7.9761250950845, 3.6407278735208699, -0.000183321670183587, 6.4691421816769399, 6.0512576241625498, -0.15162968127745899, 23.395366108183801, -14.5381852262701, -14.606223833564799, 10.199271998597199, -73.975176230999594, 0.109352036334604, 0.939662287060122, -5.0493506777824901, 12.432450504307001, 0.66340082972807302, 0.89171490853171798, -14.301193838340501, -7.1767924210601599, 37.417730343433, 34.621199008384998, -12.2257905481279, 5.0337643040644098, 0.00077853683475417402, -4.0437466042030499, -3.2232682351578399, 0.038202731665628202, -12.153196028398099, 6.5027616010011799, 7.2973627140258399, -12.054113026894999, 23.6623418919025, 0.0029087480524890102, -0.465988240269751, -5.8215678299339997, -0.92982871489462304, 0.72875377435640498, -1.76856112702097, 3.9100682853776498, 4.3638012685037904, -12.532035664209801, -10.8596693966264, 12.5729914998231, -1.17795314966104, -0.00047116201805309901, 2.7712702890005598, 1.4259517039641101, -0.060855532638316702, 9.8783846948200704, -5.3156162802238898, -6.24217543532784, 4.0955113938692902, -22.6133771249789, 0.0576846298115802, 0.37261538596098298, -5.69311024324454, 6.6165547759347501, -0.31572322723037299, 1.2076815066994999, -7.13883450856141, -3.0036796657518701, 12.888731168100399, 10.144844547714699, -3.4202567509716602, 2.2424073656324301, 0.00046719815518450402, -6.1786048720593501, -4.9366254575058903, 0.121293000821164, -13.5354546658637, 11.122151465656, 8.2996176249675795, -7.8492497139147304, 53.792699096533298, -0.056207389907105297, -0.72284563910330601, -0.034988476570927102, -5.8914910450597402, -0.57259031868870103, -1.3110690999933601, 8.9888650972260002, 6.8430482968640902, -26.406527264610599, -25.8419474444987, 8.95444342115516, -4.1168180484580699, 0.00068908057573134802, -2.0076563509740999, -3.65231424825159, 0.042894239647239998, -9.7520285174303201, 7.9819862061298199, 6.2214414143151, -1.1841920217922099, 31.911005041941699, -0.080053013664620296, -0.54185675163812796, 8.0781654837979193, -9.3493294125201594, -1.24083642122091, -1.6208022544009499, 8.8607449463367196, 2.3445831189331501, -16.218420387174199, -15.8119148955707, 1.7389982134136399, -1.0509978817476, -3.48584361237575e-05, 0.61330220442703598, 2.33052219623813, -0.0057796507046079101, 5.3801162861110896, -1.7460100802854299, -3.4260231079769401, 1.85323155008146, -1.34565392401789, 0.0020702237459098, 0.147768044797361, -0.43649104760725999, 0.997972495465969, 0.056933085588242997, 0.0077486424610570597, -0.89070134502194598, -0.68148789029708001, 0.89518325797891696, 0.16523545732706499, -2.8298454160600501, 0.26096748561569599, -3.9951230141139501e-05, 2.6625953366596802, 0.159171360187916, -0.0080654609832386693, 14.485659114429501, 0.26188806209423798, -8.9564367313419204, 9.5170929366304993, 3.6594343436186199, 0.017879567938259198, 0.0042052494877241001, -1.4377710841437801, 5.8763150360799203, 0.47441391996743998, -0.014783250610591801, -7.06163381200634, -2.9885184999935599, -1.42889911045556, -2.4433038426403901, -9.8958894810457991, 0.55194555716779503, -5.7250805560848302e-05, 0.98372766353792995, 3.2392588139392098, -0.0119630481344816, 0.14153713576169, -2.73924503033615, 0.060309030316031902, 2.34167965625057, -3.8604817562043001, 0.012593073725828199, 0.22349082635471901, -0.35749918018293803, 2.0835157939561699, 0.13368765195851301, 0.0515445449292352, -2.95655438325227, -1.09680637412728, 2.2418386652533302, 1.2169977713442901, -1.20005576483735, 0.48385142427875799}; -rc = qmckl_sherman_morrison_c(context, Dim, N_updates1, Updates1, Updates_index1, breakdown, Slater_inv1); +N_updates_p = &N_updates1; +assert(Dim_p != NULL); +assert(N_updates_p != NULL); +assert(Updates1 != NULL); +assert(Updates_index1 != NULL); +assert(breakdown_p != NULL); +assert(Slater_inv1 != NULL); +rc = qmckl_sherman_morrison(context, Dim_p, N_updates_p, Updates1, Updates_index1, breakdown_p, Slater_inv1); for (unsigned int i = 0; i < Dim; i++) { for (unsigned int j = 0; j < Dim; j++) { res[i * Dim + j] = 0; @@ -282,13 +336,13 @@ assert(rc == QMCKL_SUCCESS); #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_woodbury_2_c ( + qmckl_exit_code qmckl_woodbury_2( const qmckl_context context, - const uint64_t Dim, + const uint64_t* Dim_p, const double* Updates, const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv ); + const double* breakdown_p, + double* Slater_inv); #+end_src *** Source @@ -298,20 +352,20 @@ assert(rc == QMCKL_SUCCESS); #include #include "qmckl.h" -qmckl_exit_code qmckl_woodbury_2_c(const qmckl_context context, - const uint64_t Dim, +qmckl_exit_code qmckl_woodbury_2_c_(const qmckl_context context, + const uint64_t* Dim_p, const double* Updates, const uint64_t* Updates_index, - const double breakdown, - double * Slater_inv) { + const double* breakdown_p, + double* Slater_inv) { /* C := S^{-1} * U, dim x 2 B := 1 + V * C, 2 x 2 D := V * S^{-1}, 2 x dim ,*/ -// #ifdef DEBUG // Leave commented out since debugging information is not yet implemented in QMCkl. -// std::cerr << "Called Woodbury 2x2 kernel" << std::endl; -// #endif + + const uint64_t Dim = *Dim_p; + const double breakdown = *breakdown_p; const uint64_t row1 = (Updates_index[0] - 1); const uint64_t row2 = (Updates_index[1] - 1); @@ -382,12 +436,61 @@ qmckl_exit_code qmckl_woodbury_2_c(const qmckl_context context, #+CALL: generate_c_interface(table=qmckl_woodbury_2_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + #+RESULTS: + #+begin_src f90 :tangle (eval f) :comments org :exports none + integer(c_int32_t) function qmckl_woodbury_2 & + (context, Dim, Updates, Updates_index, breakdown, Slater_inv) & + bind(C) result(info) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) :: Dim + real (c_double ) , intent(in) :: Updates(2*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(2) + real (c_double ) , intent(in) :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + + integer(c_int32_t), external :: qmckl_woodbury_2_c + info = qmckl_woodbury_2_c & + (context, Dim, Updates, Updates_index, breakdown, Slater_inv) + + end function qmckl_woodbury_2 + #+end_src + #+CALL: generate_f_interface(table=qmckl_woodbury_2_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + #+RESULTS: + #+begin_src f90 :tangle (eval fh_func) :comments org :exports none + interface + integer(c_int32_t) function qmckl_woodbury_2 & + (context, Dim, Updates, Updates_index, breakdown, Slater_inv) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) :: Dim + real (c_double ) , intent(in) :: Updates(2*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(2) + real (c_double ) , intent(in) :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + + end function qmckl_woodbury_2 + end interface + #+end_src + *** Test :noexport: #+begin_src c :tangle (eval c_test) -rc = qmckl_woodbury_2_c(context, Dim, Updates2, Updates_index2, breakdown, Slater_inv2); +assert(Dim_p != NULL); +assert(Updates2 != NULL); +assert(Updates_index2 != NULL); +assert(breakdown_p != NULL); +assert(Slater_inv2 != NULL); +rc = qmckl_woodbury_2(context, Dim_p, Updates2, Updates_index2, breakdown_p, Slater_inv2); for (unsigned int i = 0; i < Dim; i++) { for (unsigned int j = 0; j < Dim; j++) { res[i * Dim + j] = 0; @@ -450,13 +553,13 @@ assert(rc == QMCKL_SUCCESS); #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_woodbury_3_c ( + qmckl_exit_code qmckl_woodbury_3( const qmckl_context context, - const uint64_t Dim, + const uint64_t* Dim_p, const double* Updates, const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv ); + const double* breakdown_p, + double* Slater_inv); #+end_src *** Source @@ -466,20 +569,20 @@ assert(rc == QMCKL_SUCCESS); #include #include "qmckl.h" -qmckl_exit_code qmckl_woodbury_3_c(const qmckl_context context, - const uint64_t Dim, +qmckl_exit_code qmckl_woodbury_3_c_(const qmckl_context context, + const uint64_t* Dim_p, const double* Updates, const uint64_t* Updates_index, - const double breakdown, - double * Slater_inv) { + const double* breakdown_p, + double* Slater_inv) { /* C := S^{-1} * U, dim x 3 B := 1 + V * C, 3 x 3 D := V * S^{-1}, 3 x dim ,*/ -// #ifdef DEBUG // Leave commented out since debugging information is not yet implemented in QMCkl. -// std::cerr << "Called Woodbury 3x3 kernel" << std::endl; -// #endif + + const uint64_t Dim = *Dim_p; + const double breakdown = *breakdown_p; const uint64_t row1 = (Updates_index[0] - 1); const uint64_t row2 = (Updates_index[1] - 1); @@ -549,7 +652,6 @@ qmckl_exit_code qmckl_woodbury_3_c(const qmckl_context context, return QMCKL_SUCCESS; } - #+end_src *** Performance... @@ -566,12 +668,61 @@ qmckl_exit_code qmckl_woodbury_3_c(const qmckl_context context, #+CALL: generate_c_interface(table=qmckl_woodbury_3_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + #+RESULTS: + #+begin_src f90 :tangle (eval f) :comments org :exports none + integer(c_int32_t) function qmckl_woodbury_3 & + (context, Dim, Updates, Updates_index, breakdown, Slater_inv) & + bind(C) result(info) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) :: Dim + real (c_double ) , intent(in) :: Updates(3*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(3) + real (c_double ) , intent(in) :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + + integer(c_int32_t), external :: qmckl_woodbury_3_c + info = qmckl_woodbury_3_c & + (context, Dim, Updates, Updates_index, breakdown, Slater_inv) + + end function qmckl_woodbury_3 + #+end_src + #+CALL: generate_f_interface(table=qmckl_woodbury_3_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + #+RESULTS: + #+begin_src f90 :tangle (eval fh_func) :comments org :exports none + interface + integer(c_int32_t) function qmckl_woodbury_3 & + (context, Dim, Updates, Updates_index, breakdown, Slater_inv) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) :: Dim + real (c_double ) , intent(in) :: Updates(3*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(3) + real (c_double ) , intent(in) :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + + end function qmckl_woodbury_3 + end interface + #+end_src + *** Test :noexport: #+begin_src c :tangle (eval c_test) -rc = qmckl_woodbury_3_c(context, Dim, Updates3, Updates_index3, breakdown, Slater_inv3_1); +assert(Dim_p != NULL); +assert(Updates3 != NULL); +assert(Updates_index3 != NULL); +assert(breakdown_p != NULL); +assert(Slater_inv3_1 != NULL); +rc = qmckl_woodbury_3(context, Dim_p, Updates3, Updates_index3, breakdown_p, Slater_inv3_1); for (unsigned int i = 0; i < Dim; i++) { for (unsigned int j = 0; j < Dim; j++) { res[i * Dim + j] = 0; @@ -639,14 +790,14 @@ assert(rc == QMCKL_SUCCESS); #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_sherman_morrison_splitting_c ( + qmckl_exit_code qmckl_sherman_morrison_splitting( const qmckl_context context, - const uint64_t Dim, - const uint64_t N_updates, + const uint64_t* Dim, + const uint64_t* N_updates, const double* Updates, const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv ); + const double* breakdown, + double* Slater_inv); #+end_src *** Source @@ -655,26 +806,23 @@ assert(rc == QMCKL_SUCCESS); #include #include "qmckl.h" -qmckl_exit_code qmckl_sherman_morrison_splitting_c(const qmckl_context context, - const uint64_t Dim, - const uint64_t N_updates, +qmckl_exit_code qmckl_sherman_morrison_splitting_c_(const qmckl_context context, + const uint64_t* Dim, + const uint64_t* N_updates, const double* Updates, const uint64_t* Updates_index, - const double breakdown, - double * Slater_inv) { -// #ifdef DEBUG // Leave commented out since debugging information is not yet implemented in QMCkl. -// std::cerr << "Called qmckl_sherman_morrison_splitting with " << N_updates << " updates" << std::endl; -// #endif - - double later_updates[Dim * N_updates]; - uint64_t later_index[N_updates]; + const double* breakdown, + double* Slater_inv) { + + double later_updates[*Dim * *N_updates]; + uint64_t later_index[*N_updates]; uint64_t later = 0; - (void) qmckl_slagel_splitting_c(Dim, N_updates, Updates, Updates_index, - breakdown, Slater_inv, later_updates, later_index, &later); + (void) qmckl_slagel_splitting_c(*Dim, *N_updates, Updates, Updates_index, + *breakdown, Slater_inv, later_updates, later_index, &later); if (later > 0) { - (void) qmckl_sherman_morrison_splitting_c(context, Dim, later, + (void) qmckl_sherman_morrison_splitting_c_(context, Dim, &later, later_updates, later_index, breakdown, Slater_inv); } @@ -696,12 +844,65 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_c(const qmckl_context context, #+CALL: generate_c_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + #+RESULTS: + #+begin_src f90 :tangle (eval f) :comments org :exports none + integer(c_int32_t) function qmckl_sherman_morrison_splitting & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv) & + bind(C) result(info) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) :: Dim + integer (c_int64_t) , intent(in) :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + + integer(c_int32_t), external :: qmckl_sherman_morrison_splitting_c + info = qmckl_sherman_morrison_splitting_c & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv) + + end function qmckl_sherman_morrison_splitting + #+end_src + #+CALL: generate_f_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + #+RESULTS: + #+begin_src f90 :tangle (eval fh_func) :comments org :exports none + interface + integer(c_int32_t) function qmckl_sherman_morrison_splitting & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) :: Dim + integer (c_int64_t) , intent(in) :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + + end function qmckl_sherman_morrison_splitting + end interface + #+end_src + *** Test :noexport: #+begin_src c :tangle (eval c_test) -rc = qmckl_sherman_morrison_splitting_c(context, Dim, N_updates3, Updates3, Updates_index3, breakdown, Slater_inv3_2); +N_updates_p = &N_updates3; +assert(Dim_p != NULL); +assert(N_updates_p != NULL); +assert(Updates3 != NULL); +assert(Updates_index3 != NULL); +assert(breakdown_p != NULL); +assert(Slater_inv3_2 != NULL); +rc = qmckl_sherman_morrison_splitting(context, Dim_p, N_updates_p, Updates3, Updates_index3, breakdown_p, Slater_inv3_2); for (unsigned int i = 0; i < Dim; i++) { for (unsigned int j = 0; j < Dim; j++) { res[i * Dim + j] = 0; @@ -764,14 +965,14 @@ assert(rc == QMCKL_SUCCESS); #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_sherman_morrison_smw32s_c ( + qmckl_exit_code qmckl_sherman_morrison_smw32s( const qmckl_context context, - const uint64_t Dim, - const uint64_t N_updates, + const uint64_t* Dim_p, + const uint64_t* N_updates_p, const double* Updates, const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv ); + const double* breakdown_p, + double* Slater_inv); #+end_src *** Source @@ -780,17 +981,17 @@ assert(rc == QMCKL_SUCCESS); #include #include "qmckl.h" -qmckl_exit_code qmckl_sherman_morrison_smw32s_c(const qmckl_context context, - const uint64_t Dim, - const uint64_t N_updates, +qmckl_exit_code qmckl_sherman_morrison_smw32s_c_(const qmckl_context context, + const uint64_t* Dim_p, + const uint64_t* N_updates_p, const double* Updates, const uint64_t* Updates_index, - const double breakdown, - double * Slater_inv) { -// #ifdef DEBUG // Leave commented out since debugging information is not yet implemented in QMCkl. -// std::cerr << "Called qmckl_sherman_morrison_woodbury_3 with " << N_updates -// << " updates" << std::endl; -// #endif + const double* breakdown_p, + double* Slater_inv) { + + const uint64_t Dim = *Dim_p; + const uint64_t N_updates = *N_updates_p; + const double breakdown = *breakdown_p; qmckl_exit_code rc; @@ -807,7 +1008,7 @@ qmckl_exit_code qmckl_sherman_morrison_smw32s_c(const qmckl_context context, for (uint64_t i = 0; i < n_of_3blocks; i++) { const double *Updates_3block = &Updates[i * length_3block]; const uint64_t *Updates_index_3block = &Updates_index[i * 3]; - rc = qmckl_woodbury_3_c(context, Dim, Updates_3block, Updates_index_3block, breakdown, Slater_inv); + rc = qmckl_woodbury_3_c_(context, &Dim, Updates_3block, Updates_index_3block, &breakdown, Slater_inv); if (rc != 0) { // Send the entire block to slagel_splitting uint64_t l = 0; rc = qmckl_slagel_splitting_c(Dim, 3, Updates_3block, Updates_index_3block, @@ -817,10 +1018,11 @@ qmckl_exit_code qmckl_sherman_morrison_smw32s_c(const qmckl_context context, } } - if (remainder == 2) { // Apply last remaining block of 2 updates with Woodbury 2x2 kernel + // Apply last remaining block of 2 updates with Woodbury 2x2 kernel + if (remainder == 2) { const double *Updates_2block = &Updates[n_of_3blocks * length_3block]; const uint64_t *Updates_index_2block = &Updates_index[3 * n_of_3blocks]; - rc = qmckl_woodbury_2_c(context, Dim, Updates_2block, Updates_index_2block, breakdown, Slater_inv); + rc = qmckl_woodbury_2_c_(context, &Dim, Updates_2block, Updates_index_2block, &breakdown, Slater_inv); if (rc != 0) { // Send the entire block to slagel_splitting uint64_t l = 0; (void) qmckl_slagel_splitting_c(Dim, 2, Updates_2block, Updates_index_2block, @@ -828,7 +1030,8 @@ qmckl_exit_code qmckl_sherman_morrison_smw32s_c(const qmckl_context context, later = later + l; } } - else if (remainder == 1) { // Apply last remaining update with slagel_splitting + // Apply last remaining update with slagel_splitting + else if (remainder == 1) { const double *Updates_1block = &Updates[n_of_3blocks * length_3block]; const uint64_t *Updates_index_1block = &Updates_index[3 * n_of_3blocks]; uint64_t l = 0; @@ -838,7 +1041,7 @@ qmckl_exit_code qmckl_sherman_morrison_smw32s_c(const qmckl_context context, } if (later > 0) { - (void) qmckl_sherman_morrison_splitting_c(context, Dim, later, later_updates, later_index, breakdown, Slater_inv); + (void) qmckl_sherman_morrison_splitting_c_(context, &Dim, &later, later_updates, later_index, &breakdown, Slater_inv); } return QMCKL_SUCCESS; } @@ -858,17 +1061,70 @@ qmckl_exit_code qmckl_sherman_morrison_smw32s_c(const qmckl_context context, #+CALL: generate_c_interface(table=qmckl_sherman_morrison_smw32s_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + #+RESULTS: + #+begin_src f90 :tangle (eval f) :comments org :exports none + integer(c_int32_t) function qmckl_sherman_morrison_smw32s & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv) & + bind(C) result(info) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) :: Dim + integer (c_int64_t) , intent(in) :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + + integer(c_int32_t), external :: qmckl_sherman_morrison_smw32s_c + info = qmckl_sherman_morrison_smw32s_c & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv) + + end function qmckl_sherman_morrison_smw32s + #+end_src + #+CALL: generate_f_interface(table=qmckl_sherman_morrison_smw32s_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + #+RESULTS: + #+begin_src f90 :tangle (eval fh_func) :comments org :exports none + interface + integer(c_int32_t) function qmckl_sherman_morrison_smw32s & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) :: Dim + integer (c_int64_t) , intent(in) :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + + end function qmckl_sherman_morrison_smw32s + end interface + #+end_src + *** Test :noexport: #+begin_src c :tangle (eval c_test) -rc = qmckl_sherman_morrison_smw32s_c(context, Dim, N_updates5, Updates5, Updates_index5, breakdown, Slater_inv5_3); +N_updates_p = &N_updates5; +assert(Dim_p != NULL); +assert(N_updates_p != NULL); +assert(Updates5 != NULL); +assert(Updates_index5 != NULL); +assert(breakdown_p != NULL); +assert(Slater_inv5 != NULL); +rc = qmckl_sherman_morrison_smw32s(context, Dim_p, N_updates_p, Updates5, Updates_index5, breakdown_p, Slater_inv5); for (unsigned int i = 0; i < Dim; i++) { for (unsigned int j = 0; j < Dim; j++) { res[i * Dim + j] = 0; for (unsigned int k = 0; k < Dim; k++) { - res[i * Dim + j] += Slater5[i * Dim + k] * Slater_inv5_3[k * Dim + j]; + res[i * Dim + j] += Slater5[i * Dim + k] * Slater_inv5[k * Dim + j]; } } } @@ -1042,8 +1298,8 @@ with Sherman-Morrison and update splitting. Please look at the performance recco #+begin_src c :comments link :tangle (eval c_test) assert (qmckl_context_destroy(context) == QMCKL_SUCCESS); return 0; + } - #+end_src # -*- mode: org -*-