package analyzer;

public class NetInputCalculator {

	private float[] mInput;
	private float[][] mWeight;
	private int mNeuronsNumber;
	private boolean mNormalize;

	public NetInputCalculator(float input[], float[][] weight, int neuronsNumber, boolean normalize) {
		mInput = input;
		mWeight = weight;
		mNeuronsNumber = neuronsNumber;
		mNormalize = normalize;
	}

	public float[] getNetInput() {
		float[] netInput = new float[mNeuronsNumber];

		for (int i = 0; i < mNeuronsNumber; i++)
			netInput[i] = 0;

		for (int i = 0; i < mNeuronsNumber; i++) {
			for (int j = 0; j < mWeight[i].length; j++)
				netInput[i] += mWeight[i][j] * mInput[j];
			if (mNormalize)
				netInput[i] -= (int) netInput[i]; // Hazard Scaler
		}

		return netInput;
	}
}
