Jama.Matrix.solve()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(187)

本文整理了Java中Jama.Matrix.solve()方法的一些代码示例,展示了Matrix.solve()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.solve()方法的具体详情如下:
包路径:Jama.Matrix
类名称:Matrix
方法名:solve

Matrix.solve介绍

暂无

代码示例

代码示例来源:origin: marytts/marytts

Matrix x = new Matrix(A).solve(new Matrix(b));
double[] coeffs = new double[order + 1];
for (int j = 0; j <= order; j++) {

代码示例来源:origin: marytts/marytts

Matrix x = new Matrix(A).solve(new Matrix(b));
double[] coeffs = new double[order + 1];
for (int j = 0; j <= order; j++) {

代码示例来源:origin: marytts/marytts

X = dataX;
y = datay;
b = X.solve(y);
coeffs = new double[b.getRowDimension()];
for (int j = 0; j < b.getRowDimension(); j++) {

代码示例来源:origin: marytts/marytts

X = dataX;
y = datay;
b = X.solve(y);
coeffs = new double[b.getRowDimension()];
for (int j = 0; j < b.getRowDimension(); j++) {

代码示例来源:origin: gov.nist.math/jama

/** Matrix inverse or pseudoinverse
@return     inverse(A) if A is square, pseudoinverse otherwise.
*/
public Matrix inverse () {
 return solve(identity(m,m));
}

代码示例来源:origin: stackoverflow.com

double[][] array = {{1.,2.,3},{4.,5.,6.},{7.,8.,10.}}; 
Matrix A = new Matrix(array); 
Matrix b = Matrix.random(3,1); 
Matrix x = A.solve(b); 
Matrix Residual = A.times(x).minus(b);

代码示例来源:origin: stackoverflow.com

double[][] lhsArray = {{1,1},{2, 0}};
double[] rhsArray = {10,2};
Matrix lhs = new Matrix(lhsArray);
Matrix rhs = new Matrix(rhsArray, 2);
Matrix ans = lhs.solve(rhs);

代码示例来源:origin: stackoverflow.com

double[][] lhsArray = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}};
double[] rhsArray = {1, 2, 3, 4};
Matrix lhs = new Matrix(lhsArray);
Matrix rhs = new Matrix(rhsArray, 4);
Matrix ans = lhs.solve(rhs);

代码示例来源:origin: gov.nist.math/jama

/** Solve X*A = B, which is also A'*X' = B'
@param B    right hand side
@return     solution if A is square, least squares solution otherwise.
*/
public Matrix solveTranspose (Matrix B) {
 return transpose().solve(B.transpose());
}

代码示例来源:origin: stackoverflow.com

Matrix m = ...;
Matrix mt = m.transpose();
float det = mt.determinant();
Vector x = ..;
Vector b = ..;
Vector y = m.solve(x,b);

代码示例来源:origin: org.ujmp/ujmp-jama

public Matrix solve(Matrix b) {
  if (b instanceof JamaDenseDoubleMatrix2D) {
    JamaDenseDoubleMatrix2D b2 = (JamaDenseDoubleMatrix2D) b;
    Jama.Matrix x = matrix.solve(b2.matrix);
    return new JamaDenseDoubleMatrix2D(x);
  } else {
    return super.solve(b);
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix solve(Matrix b) {
  if (b instanceof JamaDenseDoubleMatrix2D) {
    JamaDenseDoubleMatrix2D b2 = (JamaDenseDoubleMatrix2D) b;
    Jama.Matrix x = matrix.solve(b2.matrix);
    return new JamaDenseDoubleMatrix2D(x);
  } else {
    return super.solve(b);
  }
}

代码示例来源:origin: org.scijava/jep

public void run(Stack s) throws ParseException
{
  Object r = s.pop();
  if(!(r instanceof Matrix))
    throw new ParseException("solve: can only be applied to a matrix");
  Object l = s.pop();
  if(!(l instanceof Matrix))
    throw new ParseException("solve: can only be applied to a matrix");
  Jama.Matrix m = JamaUtil.toJama((Matrix) l);
  Jama.Matrix b = JamaUtil.toJama((Matrix) r);
  Jama.Matrix solve = m.solve(b);
  Matrix res = JamaUtil.fromJama(solve);
  s.push(res);
}

代码示例来源:origin: senbox-org/s1tbx

private static double[] computePolynomialCoefficients(
    double slantRangeToFirstPixel, double slantRangeToMidPixel, double slantRangeToLastPixel, int imageWidth) {
  final int firstPixel = 0;
  final int midPixel = imageWidth / 2;
  final int lastPixel = imageWidth - 1;
  final double[] idxArray = {firstPixel, midPixel, lastPixel};
  final double[] rangeArray = {slantRangeToFirstPixel, slantRangeToMidPixel, slantRangeToLastPixel};
  final Matrix A = Maths.createVandermondeMatrix(idxArray, 2);
  final Matrix b = new Matrix(rangeArray, 3);
  final Matrix x = A.solve(b);
  return x.getColumnPackedCopy();
}

代码示例来源:origin: senbox-org/s1tbx

private static double[] computePolynomialCoefficients(
    double slantRangeToFirstPixel, double slantRangeToMidPixel, double slantRangeToLastPixel, int imageWidth) {
  final int firstPixel = 0;
  final int midPixel = imageWidth / 2;
  final int lastPixel = imageWidth - 1;
  final double[] idxArray = {firstPixel, midPixel, lastPixel};
  final double[] rangeArray = {slantRangeToFirstPixel, slantRangeToMidPixel, slantRangeToLastPixel};
  final Matrix A = Maths.createVandermondeMatrix(idxArray, 2);
  final Matrix b = new Matrix(rangeArray, 3);
  final Matrix x = A.solve(b);
  return x.getColumnPackedCopy();
}

代码示例来源:origin: senbox-org/s1tbx

private static double[] computePolynomialCoefficients(
    double slantRangeToFirstPixel, double slantRangeToMidPixel, double slantRangeToLastPixel, int imageWidth) {
  final int firstPixel = 0;
  final int midPixel = imageWidth / 2;
  final int lastPixel = imageWidth - 1;
  final double[] idxArray = {firstPixel, midPixel, lastPixel};
  final double[] rangeArray = {slantRangeToFirstPixel, slantRangeToMidPixel, slantRangeToLastPixel};
  final Matrix A = Maths.createVandermondeMatrix(idxArray, 2);
  final Matrix b = new Matrix(rangeArray, 3);
  final Matrix x = A.solve(b);
  return x.getColumnPackedCopy();
}

代码示例来源:origin: senbox-org/s1tbx

private static double[] computePolynomialCoefficients(
    double slantRangeToFirstPixel, double slantRangeToMidPixel, double slantRangeToLastPixel, int imageWidth) {
  final int firstPixel = 0;
  final int midPixel = imageWidth / 2;
  final int lastPixel = imageWidth - 1;
  final double[] idxArray = {firstPixel, midPixel, lastPixel};
  final double[] rangeArray = {slantRangeToFirstPixel, slantRangeToMidPixel, slantRangeToLastPixel};
  final Matrix A = Maths.createVandermondeMatrix(idxArray, 2);
  final Matrix b = new Matrix(rangeArray, 3);
  final Matrix x = A.solve(b);
  return x.getColumnPackedCopy();
}

代码示例来源:origin: com.github.yannrichet/JMathArray

public static double[][] solve(double[][] A, double[][] B) {
  return new Matrix(A).solve(new Matrix(B)).getArray();
}

代码示例来源:origin: org.fudaa/jep

public MatrixValueI calcValue(MatrixValueI res, MatrixValueI lhs,MatrixValueI rhs)
  throws ParseException
{
  if(!(lhs instanceof Matrix))
    throw new ParseException("solve: can only be applied to a matrix");
  if(!(res instanceof Matrix))
    throw new ParseException("inverse: result should be a matrix");
  Jama.Matrix m = JamaUtil.toJama((Matrix) lhs);
  Jama.Matrix b = JamaUtil.toJama((Matrix) rhs);
  Jama.Matrix solve = m.solve(b);
  JamaUtil.fromJama(solve,(Matrix) res);
  return res;
}

代码示例来源:origin: org.scijava/jep

public MatrixValueI calcValue(MatrixValueI res, MatrixValueI lhs,MatrixValueI rhs)
  throws ParseException
{
  if(!(lhs instanceof Matrix))
    throw new ParseException("solve: can only be applied to a matrix");
  if(!(res instanceof Matrix))
    throw new ParseException("inverse: result should be a matrix");
  Jama.Matrix m = JamaUtil.toJama((Matrix) lhs);
  Jama.Matrix b = JamaUtil.toJama((Matrix) rhs);
  Jama.Matrix solve = m.solve(b);
  JamaUtil.fromJama(solve,(Matrix) res);
  return res;
}

相关文章