Package org.renjin.gcc.runtime

Examples of org.renjin.gcc.runtime.IntPtr


  public void arraysNonZeroLowerBound() throws Exception {
    Class clazz = compile("lbound.f", "LBound");

    Method test = clazz.getMethod("test_", DoublePtr.class, IntPtr.class);
    DoublePtr x = new DoublePtr( 0,0,0,);
    test.invoke(null, x, new IntPtr(4));

    assertThat(x.array[0], equalTo(1d*3d));
    assertThat(x.array[1], equalTo(2d*3d));
    assertThat(x.array[2], equalTo(3d*3d));
    assertThat(x.array[3], equalTo(4d*3d));
 
View Full Code Here


  @Test
  public void logicalToInt() throws Exception {
    Class clazz = compile("bool2int.f", "LogicalInt");
    Method method = clazz.getMethod("test_", IntPtr.class, IntPtr.class);

    IntPtr x = new IntPtr(43);
    IntPtr y = new IntPtr(0);

    method.invoke(null, x, y);

  }
View Full Code Here

  public void switchStatement() throws Exception {
    Class clazz = compile("switch.c", "SwitchTest");

    Method distance = clazz.getMethod("R_distance", IntPtr.class, int.class, int.class);

    assertThat((Integer)distance.invoke(null, new IntPtr(1), 13, 14), equalTo(1));
    assertThat((Integer)distance.invoke(null, new IntPtr(2), 3, 4), equalTo(-1));

  }
View Full Code Here

    Class clazz = compile("logical.f", "Logical");

    clazz.getMethod("runtest_").invoke(null);

    Method iftest = clazz.getMethod("iftest_", IntPtr.class, IntPtr.class);
    IntPtr x = new IntPtr(0);

    iftest.invoke(null, new IntPtr(12), x);

    assertThat(x.unwrap(), equalTo(1));

  }
View Full Code Here

    Method method = clazz.getMethod("test_", DoublePtr.class, IntPtr.class);
   
    double[] x = new double[9];

    method.invoke(null, new DoublePtr(x, 0), new IntPtr(3));
   
    System.out.println(x);
   
    assertThat(x[0], equalTo(1d));
    assertThat(x[4], equalTo(4d));
View Full Code Here

            0.906247654231265,0.0680010921787471,0.397506368579343,
            0.836464448831975,0.460515640443191,0.927493635797873,
            0.219096470857039,0.300599258393049,0.561568872537464,
            0.20270675746724,0.303500573383644,0.967535280855373);

    IntPtr ldx = new IntPtr(3);
    IntPtr n = new IntPtr(3);
    IntPtr p = new IntPtr(4);
    DoublePtr tol = new DoublePtr(1e-07);
    IntPtr k = new IntPtr(new int[1]);
    DoublePtr qraux = new DoublePtr(new double[p.unwrap()]);
    IntPtr jpvt = new IntPtr(new int[] { 1, 2, 3, 4 });
    DoublePtr work = new DoublePtr(new double[2*p.unwrap()]);
   
   
    // check some sub-calcs first
    double nrmxl = (Double)dnrm2.invoke(null, n, x, new IntPtr(1));

    assertThat(nrmxl, closeTo(0.99192755400699972, 1e-5));

    dqrdc2.invoke(null, x, ldx, n, p, tol, k, qraux, jpvt, work);

View Full Code Here

    Method method = clazz.getMethod("test_", DoublePtr.class, IntPtr.class);

    double[] x = new double[9];

    method.invoke(null, new DoublePtr(x, 0), new IntPtr(3));

    System.out.println(x);

    assertThat(x[0], equalTo(1d));
    assertThat(x[4], equalTo(4d));
View Full Code Here

        fortranArgs[i] = new DoublePtr(array, 0);
        returnValues.add(callArguments.getName(i), DoubleArrayVector.unsafe(array, vector.getAttributes()));

      } else if(fortranTypes[i].equals(IntPtr.class)) {
        int[] array = vector.toIntArray();
        fortranArgs[i] = new IntPtr(array, 0);
        returnValues.add(callArguments.getName(i), IntArrayVector.unsafe(array, vector.getAttributes()));
      } else {
        throw new UnsupportedOperationException("fortran type: " + fortranTypes[i]);
      }
    }
View Full Code Here

    AtomicVector vector = (AtomicVector)sexp;
    int[] array = new int[vector.length()];
    for(int i=0;i!=array.length;++i) {
      array[i] = vector.getElementAsInt(i);
    }
    return new IntPtr(array, 0);
  }
View Full Code Here



    Assert.assertTrue(x.array.length == y.array.length);

    IntPtr nxy = new IntPtr(x.array.length);
   // DoublePtr xout = new DoublePtr(-2.30767524297072, -2.29992185076731, -2.2921684585639, -2.28441506636049, -2.27666167415708, -2.26890828195368, -2.26115488975027, -2.25340149754686, -2.24564810534345, -2.23789471314004, -2.23014132093664, -2.22238792873323, -2.21463453652982, -2.20688114432641, -2.199127752123, -2.1913743599196, -2.18362096771619, -2.17586757551278, -2.16811418330937, -2.16036079110597, -2.15260739890256, -2.14485400669915, -2.13710061449574, -2.12934722229233, -2.12159383008893, -2.11384043788552, -2.10608704568211, -2.0983336534787, -2.0905802612753, -2.08282686907189, -2.07507347686848, -2.06732008466507, -2.05956669246166, -2.05181330025826, -2.04405990805485, -2.03630651585144, -2.02855312364803, -2.02079973144462, -2.01304633924122, -2.00529294703781, -1.9975395548344, -1.98978616263099, -1.98203277042758, -1.97427937822418, -1.96652598602077, -1.95877259381736, -1.95101920161395, -1.94326580941054, -1.93551241720714, -1.92775902500373, -1.92000563280032, -1.91225224059691, -1.90449884839351, -1.8967454561901, -1.88899206398669, -1.88123867178328, -1.87348527957987, -1.86573188737647, -1.85797849517306, -1.85022510296965, -1.84247171076624, -1.83471831856283, -1.82696492635943, -1.81921153415602, -1.81145814195261, -1.8037047497492, -1.79595135754579, -1.78819796534239, -1.78044457313898, -1.77269118093557, -1.76493778873216, -1.75718439652876, -1.74943100432535, -1.74167761212194, -1.73392421991853, -1.72617082771512, -1.71841743551172, -1.71066404330831, -1.7029106511049, -1.69515725890149, -1.68740386669808, -1.67965047449468, -1.67189708229127, -1.66414369008786, -1.65639029788445, -1.64863690568104, -1.64088351347764, -1.63313012127423, -1.62537672907082, -1.61762333686741, -1.60986994466401, -1.6021165524606, -1.59436316025719, -1.58660976805378, -1.57885637585037, -1.57110298364697, -1.56334959144356, -1.55559619924015, -1.54784280703674, -1.54008941483333, -1.53233602262993, -1.52458263042652, -1.51682923822311, -1.5090758460197, -1.5013224538163, -1.49356906161289, -1.48581566940948, -1.47806227720607, -1.47030888500266, -1.46255549279926, -1.45480210059585, -1.44704870839244, -1.43929531618903, -1.43154192398562, -1.42378853178222, -1.41603513957881, -1.4082817473754, -1.40052835517199, -1.39277496296858, -1.38502157076518, -1.37726817856177, -1.36951478635836, -1.36176139415495, -1.35400800195155, -1.34625460974814, -1.33850121754473, -1.33074782534132, -1.32299443313791, -1.31524104093451, -1.3074876487311, -1.29973425652769, -1.29198086432428, -1.28422747212087, -1.27647407991747, -1.26872068771406, -1.26096729551065, -1.25321390330724, -1.24546051110383, -1.23770711890043, -1.22995372669702, -1.22220033449361, -1.2144469422902, -1.2066935500868, -1.19894015788339, -1.19118676567998, -1.18343337347657, -1.17567998127316, -1.16792658906976, -1.16017319686635, -1.15241980466294, -1.14466641245953, -1.13691302025612, -1.12915962805272, -1.12140623584931, -1.1136528436459, -1.10589945144249, -1.09814605923908, -1.09039266703568, -1.08263927483227, -1.07488588262886, -1.06713249042545, -1.05937909822205, -1.05162570601864, -1.04387231381523, -1.03611892161182, -1.02836552940841, -1.02061213720501, -1.0128587450016, -1.00510535279819, -0.99735196059478, -0.98959856839137, -0.98184517618797, -0.97409178398456, -0.96633839178115, -0.95858499957774, -0.95083160737434, -0.94307821517093, -0.93532482296752, -0.92757143076411, -0.9198180385607, -0.9120646463573, -0.90431125415389, -0.89655786195048, -0.88880446974707, -0.88105107754366, -0.87329768534026, -0.86554429313685, -0.85779090093344, -0.85003750873003, -0.84228411652662, -0.83453072432322, -0.82677733211981, -0.8190239399164, -0.81127054771299, -0.80351715550958, -0.79576376330618, -0.78801037110277, -0.78025697889936, -0.77250358669595, -0.76475019449255, -0.75699680228914, -0.74924341008573, -0.74149001788232, -0.73373662567891, -0.72598323347551, -0.7182298412721, -0.71047644906869, -0.70272305686528, -0.69496966466187, -0.68721627245847, -0.67946288025506, -0.67170948805165, -0.66395609584824, -0.65620270364484, -0.64844931144143, -0.64069591923802, -0.63294252703461, -0.6251891348312, -0.6174357426278, -0.60968235042439, -0.60192895822098, -0.59417556601757, -0.58642217381416, -0.57866878161076, -0.57091538940735, -0.56316199720394, -0.55540860500053, -0.54765521279712, -0.53990182059372, -0.53214842839031, -0.5243950361869, -0.51664164398349, -0.50888825178009, -0.50113485957668, -0.49338146737327, -0.48562807516986, -0.47787468296645, -0.47012129076305, -0.46236789855964, -0.45461450635623, -0.44686111415282, -0.43910772194941, -0.43135432974601, -0.4236009375426, -0.41584754533919, -0.40809415313578, -0.40034076093237, -0.39258736872897, -0.38483397652556, -0.37708058432215, -0.36932719211874, -0.36157379991534, -0.35382040771193, -0.34606701550852, -0.33831362330511, -0.3305602311017, -0.3228068388983, -0.31505344669489, -0.30730005449148, -0.29954666228807, -0.29179327008466, -0.28403987788126, -0.27628648567785, -0.26853309347444, -0.26077970127103, -0.25302630906762, -0.24527291686422, -0.23751952466081, -0.2297661324574, -0.22201274025399, -0.21425934805059, -0.20650595584718, -0.19875256364377, -0.19099917144036, -0.18324577923695, -0.17549238703355, -0.16773899483014, -0.15998560262673, -0.15223221042332, -0.14447881821991, -0.13672542601651, -0.1289720338131, -0.12121864160969, -0.11346524940628, -0.10571185720287, -0.09795846499947, -0.09020507279606, -0.08245168059265, -0.07469828838924, -0.06694489618584, -0.05919150398243, -0.05143811177902, -0.04368471957561, -0.0359313273722, -0.0281779351688, -0.02042454296539, -0.01267115076198, -0.00491775855857, 0.00283563364484, 0.01058902584824, 0.01834241805165, 0.02609581025506, 0.03384920245847, 0.04160259466187, 0.04935598686528, 0.05710937906869, 0.0648627712721, 0.07261616347551, 0.08036955567891, 0.08812294788232, 0.09587634008573, 0.10362973228914, 0.11138312449255, 0.11913651669595, 0.12688990889936, 0.13464330110277, 0.14239669330618, 0.15015008550959, 0.15790347771299, 0.1656568699164, 0.17341026211981, 0.18116365432322, 0.18891704652662, 0.19667043873003, 0.20442383093344, 0.21217722313685, 0.21993061534026, 0.22768400754366, 0.23543739974707, 0.24319079195048, 0.25094418415389, 0.2586975763573, 0.2664509685607, 0.27420436076411, 0.28195775296752, 0.28971114517093, 0.29746453737434, 0.30521792957774, 0.31297132178115, 0.32072471398456, 0.32847810618797, 0.33623149839137, 0.34398489059478, 0.35173828279819, 0.3594916750016, 0.36724506720501, 0.37499845940841, 0.38275185161182, 0.39050524381523, 0.39825863601864, 0.40601202822205, 0.41376542042545, 0.42151881262886, 0.42927220483227, 0.43702559703568, 0.44477898923909, 0.45253238144249, 0.4602857736459, 0.46803916584931, 0.47579255805272, 0.48354595025612, 0.49129934245953, 0.49905273466294, 0.50680612686635, 0.51455951906976, 0.52231291127316, 0.53006630347657, 0.53781969567998, 0.54557308788339, 0.5533264800868, 0.5610798722902, 0.56883326449361, 0.57658665669702, 0.58434004890043, 0.59209344110384, 0.59984683330724, 0.60760022551065, 0.61535361771406, 0.62310700991747, 0.63086040212087, 0.63861379432428, 0.64636718652769, 0.6541205787311, 0.66187397093451, 0.66962736313791, 0.67738075534132, 0.68513414754473, 0.69288753974814, 0.70064093195155, 0.70839432415495, 0.71614771635836, 0.72390110856177, 0.73165450076518, 0.73940789296859, 0.74716128517199, 0.7549146773754, 0.76266806957881, 0.77042146178222, 0.77817485398562, 0.78592824618903, 0.79368163839244, 0.80143503059585, 0.80918842279926, 0.81694181500266, 0.82469520720607, 0.83244859940948, 0.84020199161289, 0.8479553838163, 0.8557087760197, 0.86346216822311, 0.87121556042652, 0.87896895262993, 0.88672234483334, 0.89447573703674, 0.90222912924015, 0.90998252144356, 0.91773591364697, 0.92548930585037, 0.93324269805378, 0.94099609025719, 0.9487494824606, 0.95650287466401, 0.96425626686741, 0.97200965907082, 0.97976305127423, 0.98751644347764, 0.99526983568105, 1.00302322788445, 1.01077662008786, 1.01853001229127, 1.02628340449468, 1.03403679669808, 1.04179018890149, 1.0495435811049, 1.05729697330831, 1.06505036551172, 1.07280375771512, 1.08055714991853, 1.08831054212194, 1.09606393432535, 1.10381732652876, 1.11157071873216, 1.11932411093557, 1.12707750313898, 1.13483089534239, 1.1425842875458, 1.1503376797492, 1.15809107195261, 1.16584446415602, 1.17359785635943, 1.18135124856283, 1.18910464076624, 1.19685803296965, 1.20461142517306, 1.21236481737647, 1.22011820957987, 1.22787160178328, 1.23562499398669, 1.2433783861901, 1.25113177839351, 1.25888517059691, 1.26663856280032, 1.27439195500373, 1.28214534720714, 1.28989873941055, 1.29765213161395, 1.30540552381736, 1.31315891602077, 1.32091230822418, 1.32866570042758, 1.33641909263099, 1.3441724848344, 1.35192587703781, 1.35967926924122, 1.36743266144462, 1.37518605364803, 1.38293944585144, 1.39069283805485, 1.39844623025826, 1.40619962246166, 1.41395301466507, 1.42170640686848, 1.42945979907189, 1.4372131912753, 1.4449665834787, 1.45271997568211, 1.46047336788552, 1.46822676008893, 1.47598015229233, 1.48373354449574, 1.49148693669915, 1.49924032890256, 1.50699372110597, 1.51474711330937, 1.52250050551278, 1.53025389771619, 1.5380072899196, 1.54576068212301, 1.55351407432641, 1.56126746652982, 1.56902085873323, 1.57677425093664, 1.58452764314005, 1.59228103534345, 1.60003442754686, 1.60778781975027, 1.61554121195368, 1.62329460415708, 1.63104799636049, 1.6388013885639, 1.64655478076731, 1.65430817297072);
    DoublePtr xout = new DoublePtr(-2.30767524297072);

    IntPtr nout = new IntPtr(xout.array.length);
    IntPtr interpolationMethod = new IntPtr(1);
    DoublePtr yleft = new DoublePtr(DoubleVector.NA);
    DoublePtr yright = new DoublePtr(DoubleVector.NA);
    DoublePtr f = new DoublePtr(0);

    method.invoke(null, x, y, nxy, xout, nout, interpolationMethod, yleft, yright, f);
View Full Code Here

TOP

Related Classes of org.renjin.gcc.runtime.IntPtr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.