当前位置: 首页>>代码示例>>Java>>正文


Java UJMPSettings类代码示例

本文整理汇总了Java中org.ujmp.core.util.UJMPSettings的典型用法代码示例。如果您正苦于以下问题:Java UJMPSettings类的具体用法?Java UJMPSettings怎么用?Java UJMPSettings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UJMPSettings类属于org.ujmp.core.util包,在下文中一共展示了UJMPSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pinv

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public Matrix pinv(int k) {
	Matrix[] usv = svd(k);
	Matrix u = usv[0];
	Matrix s = usv[1];
	Matrix v = usv[2];

	for (int i = (int) Math.min(s.getRowCount(), s.getColumnCount()); --i >= 0;) {
		double d = s.getAsDouble(i, i);
		if (Math.abs(d) > UJMPSettings.getInstance().getTolerance()) {
			s.setAsDouble(1.0 / d, i, i);
		} else {
			s.setAsDouble(0.0, i, i);
		}
	}

	return v.mtimes(s.transpose()).mtimes(u.transpose());
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:18,代码来源:AbstractMatrix.java

示例2: tanh

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public Matrix tanh() {
	final int rows = MathUtil.longToInt(getRowCount());
	final int cols = MathUtil.longToInt(getColumnCount());
	final Matrix result = Matrix.Factory.zeros(rows, cols);
	if (UJMPSettings.getInstance().getNumberOfThreads() > 1 && rows >= 100 && cols >= 100) {
		new PForEquidistant(0, rows - 1) {
			public void step(int i) {
				for (int c = 0; c < cols; c++) {
					result.setAsDouble(Math.tanh(getAsDouble(i, c)), i, c);
				}
			}
		};
	} else {
		for (int r = 0; r < rows; r++) {
			for (int c = 0; c < cols; c++) {
				result.setAsDouble(Math.tanh(getAsDouble(r, c)), r, c);
			}
		}
	}
	return result;
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:22,代码来源:AbstractMatrix.java

示例3: getDouble

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public double getDouble(long... coordinates) {
	if (pinv == null) {

		Matrix[] usv = getSource().svd();
		Matrix u = usv[0];
		Matrix s = usv[1];
		Matrix v = usv[2];

		for (int i = (int) Math.min(s.getRowCount(), s.getColumnCount()); --i >= 0;) {
			double d = s.getAsDouble(i, i);
			if (Math.abs(d) > UJMPSettings.getInstance().getTolerance()) {
				s.setAsDouble(1.0 / d, i, i);
			} else {
				s.setAsDouble(0.0, i, i);
			}
		}

		pinv = v.mtimes(s.transpose()).mtimes(u.transpose());

	}
	return pinv.getAsDouble(coordinates);
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:23,代码来源:Pinv.java

示例4: calc

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public final Matrix[] calc(Matrix source) {
	QR<Matrix> qr = null;
	if (UJMPSettings.getInstance().isUseOjalgo()) {
		qr = DecompositionOps.QR_OJALGO;
	}
	if (qr == null && UJMPSettings.getInstance().isUseEJML()) {
		qr = DecompositionOps.QR_EJML;
	}
	if (qr == null && UJMPSettings.getInstance().isUseMTJ()) {
		qr = DecompositionOps.QR_MTJ;
	}
	if (qr == null) {
		qr = UJMP;
	}
	return qr.calc(source);
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:17,代码来源:QR.java

示例5: solve

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public final Matrix solve(Matrix source, Matrix b) {
	QR<Matrix> qr = null;
	if (UJMPSettings.getInstance().isUseOjalgo()) {
		qr = DecompositionOps.QR_OJALGO;
	}
	if (qr == null && UJMPSettings.getInstance().isUseEJML()) {
		qr = DecompositionOps.QR_EJML;
	}
	if (qr == null && UJMPSettings.getInstance().isUseMTJ()) {
		qr = DecompositionOps.QR_MTJ;
	}
	if (qr == null) {
		qr = UJMP;
	}
	return qr.solve(source, b);
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:17,代码来源:QR.java

示例6: calc

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public final Matrix calc(Matrix source) {
	if (source.getDimensionCount() != 2 || source.getRowCount() != source.getColumnCount()) {
		throw new RuntimeException(
				"inverse only possible for square matrices. use pinv or ginv instead");
	}
	if (UJMPSettings.getInstance().getNumberOfThreads() == 1) {
		if (source.getRowCount() >= THRESHOLD && source.getColumnCount() >= THRESHOLD) {
			return MATRIXLARGESINGLETHREADED.calc(source);
		} else {
			return MATRIXSMALLSINGLETHREADED.calc(source);
		}
	} else {
		if (source.getRowCount() >= THRESHOLD && source.getColumnCount() >= THRESHOLD) {
			return MATRIXLARGEMULTITHREADED.calc(source);
		} else {
			return MATRIXSMALLMULTITHREADED.calc(source);
		}
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:20,代码来源:InvSymm.java

示例7: calc

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public final Matrix[] calc(Matrix source) {
	SVD<Matrix> svd = null;
	if (UJMPSettings.getInstance().isUseMTJ()) {
		svd = DecompositionOps.SVD_MTJ;
	}
	if (svd == null && UJMPSettings.getInstance().isUseOjalgo()) {
		svd = DecompositionOps.SVD_OJALGO;
	}
	if (svd == null && UJMPSettings.getInstance().isUseEJML()) {
		svd = DecompositionOps.SVD_EJML;
	}
	if (svd == null) {
		svd = UJMP;
	}
	return svd.calc(source);
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:17,代码来源:SVD.java

示例8: calc

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public final Matrix calc(Matrix a, Matrix b) {
	SolveSPD<Matrix> solve = null;
	if (UJMPSettings.getInstance().isUseJBlas()) {
		solve = DecompositionOps.SOLVESPD_JBLAS;
	}
	if (solve == null && UJMPSettings.getInstance().isUseOjalgo()) {
		solve = DecompositionOps.SOLVESPD_OJALGO;
	}
	if (solve == null && UJMPSettings.getInstance().isUseEJML()) {
		solve = DecompositionOps.SOLVESPD_EJML;
	}
	if (solve == null && UJMPSettings.getInstance().isUseMTJ()) {
		solve = DecompositionOps.SOLVESPD_MTJ;
	}
	if (solve == null) {
		solve = UJMPSQUARE;
	}
	return solve.calc(a, b);
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:20,代码来源:SolveSPD.java

示例9: calc

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public final Matrix calc(Matrix a, Matrix b) {
	// no special implementation for symmetric matrices
	Solve<Matrix> solve = null;
	if (UJMPSettings.getInstance().isUseJBlas()) {
		solve = DecompositionOps.SOLVE_JBLAS;
	}
	if (solve == null && UJMPSettings.getInstance().isUseOjalgo()) {
		solve = DecompositionOps.SOLVE_OJALGO;
	}
	if (solve == null && UJMPSettings.getInstance().isUseEJML()) {
		solve = DecompositionOps.SOLVE_EJML;
	}
	if (solve == null && UJMPSettings.getInstance().isUseMTJ()) {
		solve = DecompositionOps.SOLVE_MTJ;
	}
	if (solve == null) {
		solve = UJMPSQUARE;
	}
	return solve.calc(a, b);
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:21,代码来源:SolveSymm.java

示例10: calc

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public Matrix[] calc(Matrix source) {
	Eig<Matrix> eig = null;
	if (UJMPSettings.getInstance().isUseJBlas()) {
		eig = DecompositionOps.EIG_JBLAS;
	}
	if (eig == null && UJMPSettings.getInstance().isUseOjalgo()) {
		eig = DecompositionOps.EIG_OJALGO;
	}
	if (eig == null && UJMPSettings.getInstance().isUseEJML()) {
		eig = DecompositionOps.EIG_EJML;
	}
	if (eig == null) {
		eig = UJMP;
	}
	return eig.calc(source);
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:17,代码来源:Eig.java

示例11: calc

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public final Matrix calc(Matrix a, Matrix b) {
	Solve<Matrix> solve = null;
	if (UJMPSettings.getInstance().isUseJBlas()) {
		solve = DecompositionOps.SOLVE_JBLAS;
	}
	if (solve == null && UJMPSettings.getInstance().isUseOjalgo()) {
		solve = DecompositionOps.SOLVE_OJALGO;
	}
	if (solve == null && UJMPSettings.getInstance().isUseEJML()) {
		solve = DecompositionOps.SOLVE_EJML;
	}
	if (solve == null && UJMPSettings.getInstance().isUseMTJ()) {
		solve = DecompositionOps.SOLVE_MTJ;
	}
	if (solve == null) {
		solve = UJMPSQUARE;
	}
	return solve.calc(a, b);
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:20,代码来源:Solve.java

示例12: BlockDenseDoubleMatrix2D

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
/**
 * Create a new matrix with the specified size, and specified block stripe
 * size.
 * 
 * @param rows
 *            - number of rows of the matrix.
 * @param cols
 *            - number of columns of the matrix.
 * @param blockStripeSize
 *            - length of one side of a square block.
 * @throws IllegalArgumentException
 *             if rows, cols or blockStripeSize are 0 or less, or blockOrder
 *             is null.
 */
public BlockDenseDoubleMatrix2D(final int rows, final int cols, final int blockStripeSize,
		final BlockOrder blockOrder) {
	super(rows, cols);
	verifyTrue(rows > 0, "rows<=0");
	verifyTrue(cols > 0, "cols<=0");
	verifyTrue(blockStripeSize > 0, "blockStripeSize<=0");
	verifyTrue(blockOrder != null, "blockOrder == null");

	if (UJMPSettings.getInstance().getNumberOfThreads() != 1) {
		System.err.println("WARNING: setting number of threads to 1 for BlockMatrix");
		UJMPSettings.getInstance().setNumberOfThreads(1);
	}

	this.size = new long[] { rows, cols };

	// layout structure for the blocks in the matrix
	this.layout = new BlockMatrixLayout(rows, cols, blockStripeSize, blockOrder);

	this.data = new double[this.layout.numberOfBlocks][];
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:35,代码来源:BlockDenseDoubleMatrix2D.java

示例13: download

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public static void download(URL url, OutputStream output) throws IOException {
	URLConnection connection = url.openConnection();
	connection.setRequestProperty("User-Agent", UJMPSettings.getInstance().getUserAgent());
	connection.setUseCaches(false);
	connection.setDoInput(true);
	connection.setDoOutput(true);
	connection.setConnectTimeout(3000);

	InputStream input = connection.getInputStream();
	byte[] buffer = new byte[8192];
	int n = -1;
	while ((n = input.read(buffer)) != -1) {
		if (n > 0) {
			output.write(buffer, 0, n);
		}
	}
	output.flush();
	input.close();
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:20,代码来源:HttpUtil.java

示例14: calc

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public final void calc(final Matrix source, final double factor, final Matrix target) {
	if (source instanceof DenseMatrix && target instanceof DenseMatrix) {
		TimesScalar.DENSEMATRIX.calc((DenseMatrix) source, factor, (DenseMatrix) target);
	} else if (source instanceof SparseMatrix && target instanceof SparseMatrix) {
		TimesScalar.SPARSEMATRIX.calc((SparseMatrix) source, factor, (SparseMatrix) target);
	} else {
		calc(source, new BigDecimal(factor, UJMPSettings.getInstance().getMathContext()),
				target);
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:11,代码来源:TimesScalar.java

示例15: calc

import org.ujmp.core.util.UJMPSettings; //导入依赖的package包/类
public final void calc(final Matrix source, final double value, final Matrix target) {
	if (source instanceof DenseMatrix && target instanceof DenseMatrix) {
		PlusScalar.DENSEMATRIX.calc((DenseMatrix) source, value, (DenseMatrix) target);
	} else if (source instanceof SparseMatrix && target instanceof SparseMatrix) {
		PlusScalar.SPARSEMATRIX.calc((SparseMatrix) source, value, (SparseMatrix) target);
	} else {
		calc(source, new BigDecimal(value, UJMPSettings.getInstance().getMathContext()), target);
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:10,代码来源:PlusScalar.java


注:本文中的org.ujmp.core.util.UJMPSettings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。