Mercurial > hg > libxtract
view swig/java/test.java @ 113:72a9a393d5bd
- Fixed bugs in xtract_flatness(), or at least added necessary
documentation and error checking to avoid problems
- Added xtract_is_denormal() helper function and XTRACT_DENORMAL_FOUND
return code
- Replaced all instances of log, sqrt, exp etc. with respective
floating point counterparts (logf etc.)
- Added check for architecture endianness to configure script
- Bug fix to PD example, now no longer crashes if no arguments are
given
- Minor documentation updates
author | Jamie Bullock <jamie@postlude.co.uk> |
---|---|
date | Fri, 15 Feb 2008 12:43:13 +0000 |
parents | 35a3bb5c3ffd |
children | 15bc88384ecd |
line wrap: on
line source
import xtract.core.*; public class test { public static void main(String argv[]) { try { System.loadLibrary("jxtract"); } catch (UnsatisfiedLinkError e) { System.out.println("Failed to load the library \"jxtract\""); System.out.println(e.toString()); } System.out.println("\nRunning libxtract Java bindings test...\n"); int len = 5; int retval = 0; float result[]; floatArray a = new floatArray(len); SWIGTYPE_p_void myvoid = null; result = new float[1]; System.out.print("The mean of: "); for (int i = 0; i < len; i++){ System.out.print(i * 2 + ", "); a.setitem(i, i * 2); } System.out.print("is: "); retval = xtract.xtract_mean(a.cast(), len, myvoid, result); System.out.print(result[0] + "\n"); System.out.println("\nFinished!\n\n"); } }