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

de.citec.tcs.alignment.ParallelWeightDerivativeEngine Maven / Gradle / Ivy

/* 
 * TCS Alignment Toolbox
 * 
 * Copyright (C) 2013-2015
 * Benjamin Paaßen, Georg Zentgraf
 * AG Theoretical Computer Science
 * Centre of Excellence Cognitive Interaction Technology (CITEC)
 * University of Bielefeld
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 */
package de.citec.tcs.alignment;

import java.util.Map;
import java.util.concurrent.Callable;

/**
 * This allows parallel processing of derivative calculations.
 *
 * @author Benjamin Paassen - [email protected]
 */
public class ParallelWeightDerivativeEngine extends AbstractParallelDerivativeEngine {

	public ParallelWeightDerivativeEngine(
		Map derivableMatrixEntries, int M, int N) {
		super(derivableMatrixEntries, M, N, double[].class);
	}

	public ParallelWeightDerivativeEngine(AlignmentDerivativeAlgorithm[][] derivableMatrixEntries) {
		super(derivableMatrixEntries, double[].class);
	}

	/**
	 * {@inheritDoc }
	 */
	@Override
	public Callable createCallableWithAlgorithm(AlignmentDerivativeAlgorithm algo) {
		return new WeightDerivativeCallable(algo);
	}

	private class WeightDerivativeCallable implements Callable {

		private final AlignmentDerivativeAlgorithm algo;

		public WeightDerivativeCallable(AlignmentDerivativeAlgorithm algo) {
			this.algo = algo;
		}

		@Override
		public double[] call() throws Exception {
			return algo.calculateWeightDerivative();
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy