/* SCCS @(#)NslBound.java 1.3---09/01/99--00:18:25 */ // Copyright: Copyright (c) 1997 University of Southern California Brain Project. // Copyright: This software may be freely copied provided the toplevel // Copyright: COPYRIGHT file is included with each such copy. // Copyright: Email nsl@java.usc.edu. //////////////////////////////////////////////////////////// // // Boundry routines // // /** Boundry routines. There are four basic format for the evaluation method in this routine: 1, eval(a) -> c a is the input parameter to pass the threshold function: if a < 0, c = 0, else if 0 <= a < 1, c = a; else c = 1. 2. eval(dest, a) -> c a is the parameter of the threshold function and dest is the temporary space to hold the result. The method returns the reference to dest. 3. eval(a, kx1, kx2, ky1, ky2) -> c if a < kx1, c = ky1, else if kx1 <= a < kx2, c= a else, c = ky2. 2. eval(dest, a, kx1, kx2, ky1, ky2) -> c a is the parameter of the threshold function and dest is the temporary space to hold the result. The method returns the reference to dest. */ //////////////////////////////////////////////////////////////////////////////// // Boundry functions package nslj.src.math; import nslj.src.lang.*; public final class NslBound { // doubles public static double value(double x, double kx1, double kx2, double ky1, double ky2) { if (x=kx2) return ky2; return x; } public static double eval(double a) { return eval(a,0,1,0,1); } public static double[] eval(double[] a) { return eval(a,0,1,0,1); } public static double[][] eval(double[][] a) { return eval(a,0,1,0,1); } public static double[][][] eval(double[][][] a) { return eval(a,0,1,0,1); } public static double[][][][] eval(double[][][][] a) { return eval(a,0,1,0,1); } public static double[] eval(double[] dest, double[] a) { return eval(dest,a,0,1,0,1); } public static double[][] eval(double[][] dest, double[][] a) { return eval(dest,a,0,1,0,1); } public static double[][][] eval(double[][][] dest, double[][][] a) { return eval(dest,a,0,1,0,1); } public static double[][][][] eval(double[][][][] dest, double[][][][] a) { return eval(dest,a,0,1,0,1); } public static double eval(double a, double kx1, double kx2, double ky1, double ky2) { return value(a, kx1, kx2, ky1, ky2); } public static double[] eval (double[] a, double kx1, double kx2, double ky1, double ky2) { double[] dest = new double[a.length]; return eval(dest, a, kx1, kx2, ky1, ky2); } public static double[] eval (double[] dest, double[] a, double kx1, double kx2, double ky1, double ky2) { int i; if (dest.length!=a.length) { dest = new double[a.length]; } for (i=0; i=kx2) return ky2; return x; } public static float eval(float a) { return eval(a,0,1,0,1); } public static float[] eval(float[] a) { return eval(a,0,1,0,1); } public static float[][] eval(float[][] a) { return eval(a,0,1,0,1); } public static float[][][] eval(float[][][] a) { return eval(a,0,1,0,1); } public static float[][][][] eval(float[][][][] a) { return eval(a,0,1,0,1); } public static float[] eval(float[] dest, float[] a) { return eval(dest,a,0,1,0,1); } public static float[][] eval(float[][] dest, float[][] a) { return eval(dest,a,0,1,0,1); } public static float[][][] eval(float[][][] dest, float[][][] a) { return eval(dest,a,0,1,0,1); } public static float[][][][] eval(float[][][][] dest, float[][][][] a) { return eval(dest,a,0,1,0,1); } public static float eval(float a, float kx1, float kx2, float ky1, float ky2) { return value(a, kx1, kx2, ky1, ky2); } public static float[] eval (float[] a, float kx1, float kx2, float ky1, float ky2) { float[] dest = new float[a.length]; return eval(dest, a, kx1, kx2, ky1, ky2); } public static float[] eval (float[] dest, float[] a, float kx1, float kx2, float ky1, float ky2) { int i; if (dest.length!=a.length) { dest = new float[a.length]; } for (i=0; i=kx2) return ky2; return x; } public static int eval(int a) { return eval(a,0,1,0,1); } public static int[] eval(int[] a) { return eval(a,0,1,0,1); } public static int[][] eval(int[][] a) { return eval(a,0,1,0,1); } public static int[][][] eval(int[][][] a) { return eval(a,0,1,0,1); } public static int[][][][] eval(int[][][][] a) { return eval(a,0,1,0,1); } public static int[] eval(int[] dest, int[] a) { return eval(dest,a,0,1,0,1); } public static int[][] eval(int[][] dest, int[][] a) { return eval(dest,a,0,1,0,1); } public static int[][][] eval(int[][][] dest, int[][][] a) { return eval(dest,a,0,1,0,1); } public static int[][][][] eval(int[][][][] dest, int[][][][] a) { return eval(dest,a,0,1,0,1); } public static int eval(int a, int kx1, int kx2, int ky1, int ky2) { return value(a, kx1, kx2, ky1, ky2); } public static int[] eval (int[] a, int kx1, int kx2, int ky1, int ky2) { int[] dest = new int[a.length]; return eval(dest, a, kx1, kx2, ky1, ky2); } public static int[] eval (int[] dest, int[] a, int kx1, int kx2, int ky1, int ky2) { int i; if (dest.length!=a.length) { dest = new int[a.length]; } for (i=0; i