/** * Returns A = A * s, where A is this matrix, and s is a scalar. * @param s the scalar s. * @return A = A * s. */ public DMatrix timesEquals(double s) { mul(_a,s,_a); return this; }
/** * Returns A = A .* B, where A is this matrix. * The symbol .* denotes element-by-element multiplication. * @param b the matrix B. * @return A = A .* B. */ public DMatrix arrayTimesEquals(DMatrix b) { mul(_a,b._a,_a); return this; }
/** * Returns A = A .* B, where A is this matrix. * The symbol .* denotes element-by-element multiplication. * @param b the matrix B. * @return A = A .* B. */ public DMatrix arrayTimesEquals(DMatrix b) { mul(_a,b._a,_a); return this; }
/** * Returns A = A * s, where A is this matrix, and s is a scalar. * @param s the scalar s. * @return A = A * s. */ public DMatrix timesEquals(double s) { mul(_a,s,_a); return this; }
/** * Returns C = A * s, where A is this matrix, and s is a scalar. * @param s the scalar s. * @return C = A * s. */ public DMatrix times(double s) { DMatrix c = new DMatrix(_m,_n); mul(_a,s,c._a); return c; }
/** * Returns C = A .* B, where A is this matrix. * The symbol .* denotes element-by-element multiplication. * @param b the matrix B. * @return C = A .* B. */ public DMatrix arrayTimes(DMatrix b) { DMatrix c = new DMatrix(_m,_n); mul(_a,b._a,c._a); return c; }
/** * Returns C = A * s, where A is this matrix, and s is a scalar. * @param s the scalar s. * @return C = A * s. */ public DMatrix times(double s) { DMatrix c = new DMatrix(_m,_n); mul(_a,s,c._a); return c; }
/** * Returns C = A .* B, where A is this matrix. * The symbol .* denotes element-by-element multiplication. * @param b the matrix B. * @return C = A .* B. */ public DMatrix arrayTimes(DMatrix b) { DMatrix c = new DMatrix(_m,_n); mul(_a,b._a,c._a); return c; }
private static float dot(float[] x, float[] y) { return sum(mul(x,y)); } private static float dot(float[][] x, float[][] y) {
private static float dot(float[][] x, float[][] y) { return sum(mul(x,y)); } private static float dot(float[][][] x, float[][][] y) {
private static float dot(float[] x, float[] y) { return sum(mul(x,y)); } private static float dot(float[][] x, float[][] y) {
private static float dot(float[][] x, float[][] y) { return sum(mul(x,y)); } private static float dot(float[][][] x, float[][][] y) {
private static float dot(float[] x, float[] y) { return sum(mul(x,y)); } private static float dot(float[][] x, float[][] y) {
private static float dot(float[][] x, float[][] y) { return sum(mul(x,y)); } private static float dot(float[][][] x, float[][][] y) {
private static float dot(float[][][] x, float[][][] y) { return sum(mul(x,y)); }
private static float dot(float[][] x, float[][] y) { return sum(mul(x,y)); } private static float dot(float[][][] x, float[][][] y) {
private static float dot(float[][] x, float[][] y) { return sum(mul(x,y)); } private static float dot(float[][][] x, float[][][] y) {
private static void plot1() { int nx = 301; float dx = 0.1f; float fx = 0.0f; Sampling sx = new Sampling(nx,dx,fx); float[] x = rampfloat(fx,dx,nx); float[] f = sub(mul(x,sin(x)),1.0f); SimplePlot.asPoints(sx,f); } private static void plot2() {
private static float[][][] sampleTestFunction(int n1, int n2) { Random r = new Random(3); float[] x1 = mul(2.0f,randfloat(r,n1)); float[] x2 = mul(2.0f,randfloat(r,n2)); quickSort(x1); quickSort(x2); float[][] y = new float[n2][n1]; for (int i2=0; i2<n2; ++i2) for (int i1=0; i1<n1; ++i1) y[i2][i1] = testFunction00(x1[i1],x2[i2]); return new float[][][]{new float[][]{x1,x2},y}; } private static float testFunction00(float x1, float x2) {
private static float[][][] sampleTestFunction(int n1, int n2) { Random r = new Random(3); float[] x1 = mul(2.0f,randfloat(r,n1)); float[] x2 = mul(2.0f,randfloat(r,n2)); quickSort(x1); quickSort(x2); float[][] y = new float[n2][n1]; for (int i2=0; i2<n2; ++i2) for (int i1=0; i1<n1; ++i1) y[i2][i1] = testFunction00(x1[i1],x2[i2]); return new float[][][]{new float[][]{x1,x2},y}; } private static float testFunction00(float x1, float x2) {