// Path: src/java/cd4017be/kineng/Main.java
// @Mod(modid = Main.ID, useMetadata = true)
// public class Main {
// 
// 	public static final String ID = "kineng";
// 
// 	@Instance(ID)
// 	public static Main instance;
// 
// 	public static Logger LOG;
// 
// 	@SidedProxy(clientSide = "cd4017be." + ID + ".ClientProxy", serverSide = "cd4017be." + ID + ".CommonProxy")
// 	public static CommonProxy proxy;
// 
// 	public Main() {
// 		RecipeScriptContext.scriptRegistry.add(new Version("kinetic", "/assets/" + ID + "/config/recipes.rcp"));
// 	}
// 
// 	@Mod.EventHandler
// 	public void preInit(FMLPreInitializationEvent event) {
// 		LOG = event.getModLog();
// 		proxy.preInit();
// 		StructureLocations.register();
// 		RecipeScriptContext.instance.run("kinetic.PRE_INIT");
// 	}
// 
// 	@Mod.EventHandler
// 	public void load(FMLInitializationEvent event) {
// 		Objects.init();
// 		proxy.init(new ConfigConstants(RecipeScriptContext.instance.modules.get("kinetic")));
// 	}
// 
// 	@Mod.EventHandler
// 	public void postInit(FMLPostInitializationEvent event) {
// 		Ticking.init();
// 	}
// 
// 	@Mod.EventHandler
// 	public void onShutdown(FMLServerStoppingEvent event) {
// 		Ticking.clear();
// 	}
// 
// }


import java.util.Arrays;
import java.util.Formatter;
import cd4017be.kineng.Main;

	public static float[][] MATRIX = new float[4][8];
	public static int m, n;

	/** initialize the {@link #MATRIX} with zeroes and increase size if necessary
	 * @param m number of rows
	 * @param n number of columns
	 */
	public static void initMatrix(int m, int n) {
		int oldM = MATRIX.length, oldN = MATRIX[0].length;
		boolean grow = false;
		if (m > oldM) {
			oldM = Math.max(m, oldM << 1);
			grow = true;
		}
		if (n > oldN) {
			oldN = Math.max(n, oldN << 1);
			grow = true;
		}
		if (grow) MATRIX = new float[m][n];
		else for (int i = 0; i < m; i++)
			Arrays.fill(MATRIX[i], 0, n, 0F);
		Formula.m = m;
		Formula.n = n;
	}

	/** solve the system of linear equations previously set up in {@link #MATRIX},
	 * leaving the solution in columns {@link #m} ... {@link #n} - 1.
	 */
	public static void solveMatrix() {
		if (n < m) throw new IllegalStateException("can't solve with less columns than rows!");

// Path: src/java/cd4017be/kineng/Main.java
// @Mod(modid = Main.ID, useMetadata = true)
// public class Main {
// 
// 	public static final String ID = "kineng";
// 
// 	@Instance(ID)
// 	public static Main instance;
// 
// 	public static Logger LOG;
// 
// 	@SidedProxy(clientSide = "cd4017be." + ID + ".ClientProxy", serverSide = "cd4017be." + ID + ".CommonProxy")
// 	public static CommonProxy proxy;
// 
// 	public Main() {
// 		RecipeScriptContext.scriptRegistry.add(new Version("kinetic", "/assets/" + ID + "/config/recipes.rcp"));
// 	}
// 
// 	@Mod.EventHandler
// 	public void preInit(FMLPreInitializationEvent event) {
// 		LOG = event.getModLog();
// 		proxy.preInit();
// 		StructureLocations.register();
// 		RecipeScriptContext.instance.run("kinetic.PRE_INIT");
// 	}
// 
// 	@Mod.EventHandler
// 	public void load(FMLInitializationEvent event) {
// 		Objects.init();
// 		proxy.init(new ConfigConstants(RecipeScriptContext.instance.modules.get("kinetic")));
// 	}
// 
// 	@Mod.EventHandler
// 	public void postInit(FMLPostInitializationEvent event) {
// 		Ticking.init();
// 	}
// 
// 	@Mod.EventHandler
// 	public void onShutdown(FMLServerStoppingEvent event) {
// 		Ticking.clear();
// 	}
// 
// }


// Path: src/java/cd4017be/kineng/physics/Formula.java
import java.util.Arrays;
import java.util.Formatter;
import cd4017be.kineng.Main;

	public static float[][] MATRIX = new float[4][8];
	public static int m, n;

	/** initialize the {@link #MATRIX} with zeroes and increase size if necessary
	 * @param m number of rows
	 * @param n number of columns
	 */
	public static void initMatrix(int m, int n) {
		int oldM = MATRIX.length, oldN = MATRIX[0].length;
		boolean grow = false;
		if (m > oldM) {
			oldM = Math.max(m, oldM << 1);
			grow = true;
		}
		if (n > oldN) {
			oldN = Math.max(n, oldN << 1);
			grow = true;
		}
		if (grow) MATRIX = new float[m][n];
		else for (int i = 0; i < m; i++)
			Arrays.fill(MATRIX[i], 0, n, 0F);
		Formula.m = m;
		Formula.n = n;
	}

	/** solve the system of linear equations previously set up in {@link #MATRIX},
	 * leaving the solution in columns {@link #m} ... {@link #n} - 1.
	 */
	public static void solveMatrix() {
		if (n < m) throw new IllegalStateException("can't solve with less columns than rows!");

		if (Ticking.DEBUG) Main.LOG.info(printMatrix());
