org.opengis.referencing.operation.Matrix.getNumRow()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(116)

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

Matrix.getNumRow介绍

[英]Returns the number of rows in this matrix.
[中]返回此矩阵中的行数。

代码示例

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

/**
 * Creates a new matrix initialized to the same value than the specified one. The specified
 * matrix size must be {@value #SIZE}×{@value #SIZE}.
 */
public Matrix1(final Matrix matrix) {
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  m00 = matrix.getElement(0, 0);
}

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

/** Used to cast/copy matrix to Matrix2 */
Matrix2 internal(Matrix matrix) {
  if (matrix instanceof Matrix2) {
    return (Matrix2) matrix;
  } else {
    if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
      throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
    }
    return new Matrix2(matrix);
  }
}

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

@Override
public void negate(Matrix matrix) {
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  m00 = -matrix.getElement(0, 0);
}

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

@Override
public void mul(Matrix matrix) {
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  m00 *= matrix.getElement(0, 0);
}

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

@Override
public void sub(Matrix matrix) {
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  m00 -= matrix.getElement(0, 0);
}

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

@Override
public void mul(Matrix matrix1, Matrix matrix2) {
  if (matrix1.getNumRow() != SIZE || matrix1.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  if (matrix2.getNumRow() != SIZE || matrix2.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  m00 = matrix1.getElement(0, 0) * matrix2.getElement(0, 0);
}

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

@Override
public void transpose(Matrix matrix) {
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  m00 = matrix.getElement(0, 0);
}

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

/** {@inheritDoc} */
public final void multiply(final Matrix matrix) {
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  m00 *= matrix.getElement(0, 0);
}

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

@Override
public void mul(double scalar, Matrix matrix) {
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  m00 = scalar * matrix.getElement(0, 0);
}

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

@Override
public void sub(double scalar, Matrix matrix) {
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  m00 = scalar - matrix.getElement(0, 0);
}

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

@Override
  public void sub(Matrix matrix1, Matrix matrix2) {
    if (matrix1.getNumRow() != SIZE || matrix1.getNumCol() != SIZE) {
      throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
    }
    if (matrix2.getNumRow() != SIZE || matrix2.getNumCol() != SIZE) {
      throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
    }
    m00 = matrix1.getElement(0, 0) - matrix2.getElement(0, 0);
  }
}

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

/**
 * Constructs a transform from the specified matrix. The matrix should be affine, but it will
 * not be verified.
 *
 * @param matrix The matrix.
 */
protected ProjectiveTransform(final Matrix matrix) {
  numRow = matrix.getNumRow();
  numCol = matrix.getNumCol();
  elt = new double[numRow * numCol];
  int index = 0;
  for (int j = 0; j < numRow; j++) {
    for (int i = 0; i < numCol; i++) {
      elt[index++] = matrix.getElement(j, i);
    }
  }
}

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

/**
 * Creates a new matrix initialized to the same value than the specified one. The specified
 * matrix size must be {@value #SIZE}&times;{@value #SIZE}.
 */
public Matrix4(final Matrix matrix) {
  super(SIZE);
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  for (int j = 0; j < SIZE; j++) {
    for (int i = 0; i < SIZE; i++) {
      setElement(j, i, matrix.getElement(j, i));
    }
  }
}

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

@Override
public void invert(Matrix matrix) throws SingularMatrixException {
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  if (matrix.getElement(0, 0) == 0) {
    throw new SingularMatrixException("1 dimensional matrix is singular");
  }
  m00 = 1.0 / matrix.getElement(0, 0);
}

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

/** Gets the derivative of this function at a value. */
public double derivative(final double value) throws TransformException {
  final DirectPosition1D p = new DirectPosition1D(value);
  final Matrix m = derivative(p);
  assert m.getNumRow() == 1 && m.getNumCol() == 1;
  return m.getElement(0, 0);
}

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

@Override
public void mul(double scalar, Matrix matrix) {
  DMatrixRMaj a = new DMatrixRMaj(matrix.getNumRow(), matrix.getNumCol());
  CommonOps_DDRM.scale(scalar, internal(matrix), a);
  mat = a;
}

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

/**
 * Creates a new matrix initialized to the same value than the specified one. The specified
 * matrix size must be {@value #SIZE}&times;{@value #SIZE}.
 */
public Matrix3(final Matrix matrix) {
  mat = new DMatrix3x3();
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  for (int j = 0; j < SIZE; j++) {
    for (int i = 0; i < SIZE; i++) {
      setElement(j, i, matrix.getElement(j, i));
    }
  }
}
/**

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

/**
 * Creates a new matrix initialized to the same value than the specified one. The specified
 * matrix size must be {@value #SIZE}&times;{@value #SIZE}.
 */
public Matrix2(final Matrix matrix) {
  if (matrix.getNumRow() != SIZE || matrix.getNumCol() != SIZE) {
    throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_MATRIX_SIZE));
  }
  m00 = matrix.getElement(0, 0);
  m01 = matrix.getElement(0, 1);
  m10 = matrix.getElement(1, 0);
  m11 = matrix.getElement(1, 1);
}

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

/** Asserts that the specified matrix is diagonal. */
  private static void assertDiagonal(final Matrix matrix) {
    final int nrow = matrix.getNumRow();
    final int ncol = matrix.getNumCol();
    for (int j = 0; j < nrow; j++) {
      for (int i = 0; i < ncol; i++) {
        if (i != j) {
          assertEquals("row " + j + ", col " + i, 0.0, matrix.getElement(j, i), EPS);
        }
      }
    }
  }
}

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

/**
 * Compares the matrix computes by {@link AbstractCS#swapAndScaleAxis} with the specified one.
 */
private static void compareMatrix(
    final CoordinateSystem cs1, final CoordinateSystem cs2, final double[] expected) {
  final Matrix matrix = AbstractCS.swapAndScaleAxis(cs1, cs2);
  final int numRow = matrix.getNumRow();
  final int numCol = matrix.getNumCol();
  assertEquals(expected.length, numRow * numCol);
  final Matrix em = new GeneralMatrix(numRow, numCol, expected);
  assertEquals(em, matrix);
}

相关文章