/** * Determines whether the specified array of arrays of arrays is regular. * The array is regular if each of its elements, which are arrays of arrays, * has the same length and is regular. * @param a the array. * @return true, if regular; false, otherwise. */ public static boolean isRegular(float[][][] a) { int n3 = a.length; int n2 = a[0].length; for (int i3=0; i3<n3; ++i3) { if (a[i3].length!=n2 || !isRegular(a[i3])) return false; } return true; }
/** * Determines whether the specified array of arrays of arrays is regular. * The array is regular if each of its elements, which are arrays of arrays, * has the same length and is regular. * @param a the array. * @return true, if regular; false, otherwise. */ public static boolean isRegular(short[][][] a) { int n3 = a.length; int n2 = a[0].length; for (int i3=0; i3<n3; ++i3) { if (a[i3].length!=n2 || !isRegular(a[i3])) return false; } return true; }
/** * Determines whether the specified array of arrays of arrays is regular. * The array is regular if each of its elements, which are arrays of arrays, * has the same length and is regular. * @param a the array. * @return true, if regular; false, otherwise. */ public static boolean isRegular(byte[][][] a) { int n3 = a.length; int n2 = a[0].length; for (int i3=0; i3<n3; ++i3) { if (a[i3].length!=n2 || !isRegular(a[i3])) return false; } return true; }
/** * Determines whether the specified array of arrays of arrays is regular. * The array is regular if each of its elements, which are arrays of arrays, * has the same length and is regular. * @param a the array. * @return true, if regular; false, otherwise. */ public static boolean isRegular(int[][][] a) { int n3 = a.length; int n2 = a[0].length; for (int i3=0; i3<n3; ++i3) { if (a[i3].length!=n2 || !isRegular(a[i3])) return false; } return true; }
/** * Determines whether the specified array of arrays of arrays is regular. * The array is regular if each of its elements, which are arrays of arrays, * has the same length and is regular. * @param a the array. * @return true, if regular; false, otherwise. */ public static boolean isRegular(double[][][] a) { int n3 = a.length; int n2 = a[0].length; for (int i3=0; i3<n3; ++i3) { if (a[i3].length!=n2 || !isRegular(a[i3])) return false; } return true; }
/** * Constructs a matrix from the specified array. Does not copy array * elements into a new array. Rather, the new matrix simply references * the specified array. * <p> * The specified array must be regular. That is, each row much contain * the same number of columns, and each column must contain the same * number of rows. * @param a the array. */ public DMatrix(double[][] a) { Check.argument(isRegular(a),"array a is regular"); _m = a.length; _n = a[0].length; _a = a; }
private static void checkArrays(float[][][] x, float[][][] y) { Check.argument(x.length==y.length,"x.length==y.length"); Check.argument(x[0].length==y[0].length,"x[0].length==y[0].length"); Check.argument(x[0][0].length==y[0][0].length, "x[0][0].length==y[0][0].length"); Check.argument(isRegular(x),"x is regular"); Check.argument(isRegular(y),"y is regular"); }
/** * Constructs a matrix from the specified array. Copies array elements * a[i][j] to the i'th row and j'th column of this matrix. In other * words, the specified array contains matrix elements ordered by rows. * <p> * The specified array must be regular. That is, each row much contain * the same number of columns, and each column must contain the same * number of rows. * @param a the array. */ public DMatrix(double[][] a) { Check.argument(isRegular(a),"array a is regular"); _m = a.length; _n = a[0].length; _a = new double[_m*_n]; set(a); }
private static void checkArrays(float[][][] x, float[][][] y) { Check.argument(x.length==y.length,"x.length==y.length"); Check.argument(x[0].length==y[0].length,"x[0].length==y[0].length"); Check.argument(x[0][0].length==y[0][0].length, "x[0][0].length==y[0][0].length"); Check.argument(isRegular(x),"x is regular"); Check.argument(isRegular(y),"y is regular"); } }
private static void checkArrays(float[][][] x, float[][][] y) { Check.argument(x.length==y.length,"x.length==y.length"); Check.argument(x[0].length==y[0].length,"x[0].length==y[0].length"); Check.argument(x[0][0].length==y[0][0].length, "x[0][0].length==y[0][0].length"); Check.argument(isRegular(x),"x is regular"); Check.argument(isRegular(y),"y is regular"); }
/** * Sets the input arrays to be cross-correlated. * The input arrays f and g can be the same array. * @param f the input array f; by reference, not copied. * @param g the input array g; by reference, not copied. */ public void setInputs(float[][] f, float[][] g) { if (f==null || g==null) { _dimension = _n1 = _n2 = _n3 = 0; _f = null; _g = null; } else { Check.argument(f[0].length==g[0].length,"f[0].length==g[0].length"); Check.argument(f.length==g.length,"f.length==g.length"); Check.argument(isRegular(f),"f is regular"); Check.argument(isRegular(g),"g is regular"); _dimension = 2; _n1 = f[0].length; _n2 = f.length; _n3 = 0; _f = new float[1][][]; _g = new float[1][][]; _f[0] = f; _g[0] = g; } _s = null; }
private void initA(float[][] a) { Check.argument(isRegular(a),"a is regular"); initA(a[0]); int ni = a.length; _ai = copy(a); _ai0 = new float[ni]; _ai0i = new float[ni]; for (int ii=0; ii<ni; ++ii) { _ai0[ii] = a[ii][0]; _ai0i[ii] = 1.0f/a[ii][0]; } } }
/** * Sets the input arrays to be cross-correlated. * The input arrays f and g can be the same array. * @param f the input array f; by reference, not copied. * @param g the input array g; by reference, not copied. */ public void setInputs(float[][][] f, float[][][] g) { if (f==null || g==null) { _dimension = _n1 = _n2 = _n3 = 0; _f = null; _g = null; } else { Check.argument( f[0][0].length==g[0][0].length,"f[0][0].length==g[0][0].length"); Check.argument(f[0].length==g[0].length,"f[0].length==g[0].length"); Check.argument(f.length==g.length,"f.length==g.length"); Check.argument(isRegular(f),"f is regular"); Check.argument(isRegular(g),"g is regular"); _dimension = 3; _n1 = f[0][0].length; _n2 = f[0].length; _n3 = f.length; _f = f; _g = g; } _s = null; }
private void checkDimensions(float[][] c) { Check.argument(isRegular(c),"c is regular"); Check.argument(_n1==c[0].length,"array dimension 1 is valid"); Check.argument(_n2==c.length,"array dimension 2 is valid"); checkDimension(2); }
private void checkDimensions(float[][][] c) { Check.argument(isRegular(c),"c is regular"); Check.argument(_n1==c[0][0].length,"array dimension 1 is valid"); Check.argument(_n2==c[0].length,"array dimension 2 is valid"); Check.argument(_n3==c.length,"array dimension 3 is valid"); checkDimension(3); }
/** * Sets the sampled function f(x1,x2) for this view. * @param s1 the sampling of the variable x1; must be uniform. * @param s2 the sampling of the variable x2; must be uniform. * @param f array[n2][n1] of sampled function values f(x1,x2), where * n1 and n2 denote the number of samples in s1 and s2, respectively. */ public void set(Sampling s1, Sampling s2, float[][] f) { Check.argument(s1.isUniform(),"s1 is uniform"); Check.argument(s2.isUniform(),"s2 is uniform"); Check.argument(isRegular(f),"f is regular"); Check.argument(s1.getCount()==f[0].length,"s1 consistent with f"); Check.argument(s2.getCount()==f.length,"s2 consistent with f"); _s1 = s1; _s2 = s2; _f = copy(f); _clips = new Clips(f); updateArraySampling(); _cs = null; _cl = null; }
Check.argument(s1.isUniform(),"s1 is uniform"); Check.argument(s2.isUniform(),"s2 is uniform"); Check.argument(isRegular(f),"f is regular"); Check.argument(s1.getCount()==f[0][0].length,"s1 consistent with f"); Check.argument(s2.getCount()==f[0].length,"s2 consistent with f");