All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sghd.common.utils.guass.RadomGaussResultHandle Maven / Gradle / Ivy

The newest version!
package com.sghd.common.utils.guass;
/**
 * 随机存储的之前的计算值,必须和权重数量一一对应
 */
public class RadomGaussResultHandle {
	private RadomGaussResultHandle() {
	}

	public static RadomGaussResultHandle CreateAHanle(int[] weights, double[] refWeightGaussProbs) {
		if (weights == null || weights.length == 0)
			return null;
		RadomGaussResultHandle handle = new RadomGaussResultHandle();
		handle.refWeightGaussProbs = refWeightGaussProbs;
		handle.setWeights(weights);
		return handle;
	}

	private int[] weights;
	public double[] refWeightGaussProbs;

	/**
	 * 可以使用MD5覆盖实现,简化计算过程
	 * 
	 * @param weights
	 */
	public void setWeights(int[] weights) {
		this.weights = weights;
	}

	public boolean checkWeighsEqual(int[] checkWeights) {
		if (weights == null || checkWeights == null)
			return false;
		if (weights == checkWeights) {
			return true;
		}
		if (weights.length == checkWeights.length) {
			for (int i = 0; i < weights.length; i++) {
				if (weights[i] != checkWeights[i]) {
					return false;
				}
			}
			return true;
		} 
			return false; 
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy