package deepDriver.dl.aml.math.test;

import deepDriver.dl.aml.dnc.DNCChecker;
import deepDriver.dl.aml.math.ContentBasedWeighting;

public class TestCBW {
	
	public static void main2(String[] args) {
		double dv1 = 0;
		double dr = 0;
		double a = 1.2971816481099791E-106;
		double v2 = -1.349154308251241E-109;
		double s = 1.2237193692894797E-106;
		System.out.println(v2/a);
		System.out.println(Math.pow(a * a, -1.5) * a );
		System.out.println(dr *( v2/a - 0.5 * s * Math.pow(a * a, -1.5) * 2.0 * dv1));
//		dr *( v2[i]/a - 0.5 * s * Math.pow(a * a, -1.5) * 2.0 * dv1[i]);
		
	}
	
	public static void main(String[] args) {
		
		double [] dc = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
		double [] krs = {1.0383932189457568,37.97559184578004,-21.493963564483586,-38.12874302183579,
				-24.89526747739125,18.735761294600522,-74.34326503248982,109.98380012169248,
				-77.13264906008058,-21.14945914894032};
		double betas = 1.0;
		double [][] memory = {
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109},
				{1.0773444502339597E-109,-1.349154308251241E-109,7.714846203853398E-110,1.7265922455320224E-109,9.803159270475082E-110,-7.273788060673175E-111,1.973534904486378E-109,-5.268333612399604E-109,3.699966950523354E-109,2.5476505007247524E-109}

		};
		ContentBasedWeighting cbw = new ContentBasedWeighting();
		
		cbw.setMatrix(memory);
//		cbw.weighting();
		cbw.backWeighting(dc, krs, betas);
		
		double [][] dm2 = cbw.getDm(); 		
		boolean bb = DNCChecker.checkBg(dm2, "read head dm2 ", 0);
		DNCChecker.print(dm2);
	}

}
