List of usage examples for org.apache.commons.math.linear MatrixUtils createRealIdentityMatrix
public static RealMatrix createRealIdentityMatrix(int dimension)
dimension x dimension identity matrix. From source file:gda.images.camera.ScannableSampleMovementServiceTest.java
public void testWithBasicSettings() throws Exception { sms.setOmegaDirection(OmegaDirection.ANTICLOCKWISE); sms.setAxisOrientationMatrix(MatrixUtils.createRealIdentityMatrix(3)); sms.afterPropertiesSet();//from w w w .j a va2s . c o m assertPositionsEqual(ZERO_POSITION, sampleXyz.getPositionArray()); assertEquals(0, omega.getAngle(), DELTA); sms.moveSampleByMicrons(10, 20, 30); assertPositionsEqual(new double[] { 10, 20, 30 }, sampleXyz.getPositionArray()); assertEquals(0, omega.getAngle(), DELTA); }
From source file:gda.images.camera.ScannableSampleMovementServiceTest.java
public void testWithNonZeroOmega() throws Exception { sms.setOmegaDirection(OmegaDirection.ANTICLOCKWISE); sms.setAxisOrientationMatrix(MatrixUtils.createRealIdentityMatrix(3)); sms.afterPropertiesSet();// w w w . j a v a2s .co m omega.moveTo(90); assertPositionsEqual(ZERO_POSITION, sampleXyz.getPositionArray()); assertEquals(90, omega.getAngle(), DELTA); sms.moveSampleByMicrons(10, 20, 30); assertPositionsEqual(new double[] { 10, -30, 20 }, sampleXyz.getPositionArray()); assertEquals(90, omega.getAngle(), DELTA); }
From source file:gda.images.camera.ScannableSampleMovementServiceTest.java
public void testWithClockwisePhiDirection() throws Exception { sms.setOmegaDirection(OmegaDirection.CLOCKWISE); sms.setAxisOrientationMatrix(MatrixUtils.createRealIdentityMatrix(3)); sms.afterPropertiesSet();/* w ww.ja v a 2 s. c o m*/ omega.moveTo(90); assertPositionsEqual(ZERO_POSITION, sampleXyz.getPositionArray()); assertEquals(90, omega.getAngle(), DELTA); sms.moveSampleByMicrons(10, 20, 30); assertPositionsEqual(new double[] { 10, 30, -20 }, sampleXyz.getPositionArray()); assertEquals(90, omega.getAngle(), DELTA); }
From source file:org.eclipse.recommenders.jayes.transformation.SmoothedFactorDecomposition.java
@Override protected List<double[]> getBasis(AbstractFactor f, List<double[]> vectors) { List<double[]> basis = new ArrayList<double[]>(); int d = MathUtils.product(f.getDimensions()) / vectors.size(); double[] ones = new double[d]; Arrays.fill(ones, 1);/*from w w w.ja va2 s . c o m*/ basis.add(ones); for (double[] e : MatrixUtils.createRealIdentityMatrix(d).getData()) { basis.add(e); } return basis; }