Package org.jamesii.core.math

Examples of org.jamesii.core.math.Matrix.addRows()


    double[][] res1 = new double[][] { { 5, 7, 9 }, { 4, 5, 6 }, { 7, 8, 9 } };
    double[][] res2 =
        new double[][] { { 5, 7, 9 }, { 18, 21, 24 }, { 7, 8, 9 } };

    Matrix m = new Matrix(data);
    m.addRows(0, 1);
    for (int c = 0; c < m.getColumns(); c++) {
      for (int r = 0; r < m.getRows(); r++) {
        assertEquals(res1[r][c], m.getElement(r, c));
      }
    }
View Full Code Here


      for (int r = 0; r < m.getRows(); r++) {
        assertEquals(res1[r][c], m.getElement(r, c));
      }
    }

    m.addRows(1, 2, 2);
    for (int c = 0; c < m.getColumns(); c++) {
      for (int r = 0; r < m.getRows(); r++) {
        assertEquals(res2[r][c], m.getElement(r, c));
      }
    }
View Full Code Here

    Matrix m = new Matrix(3);

    // test addRows(int, int)

    try {
      m.addRows(1, 3);
      fail();
    } catch (ArrayIndexOutOfBoundsException e) {
      assertTrue(true);
    } catch (Throwable e) {
      fail();
View Full Code Here

    } catch (Throwable e) {
      fail();
    }

    try {
      m.addRows(5, 2);
      fail();
    } catch (ArrayIndexOutOfBoundsException e) {
      assertTrue(true);
    } catch (Throwable e) {
      fail();
View Full Code Here

    } catch (Throwable e) {
      fail();
    }

    try {
      m.addRows(-1, 1);
      fail();
    } catch (ArrayIndexOutOfBoundsException e) {
      assertTrue(true);
    } catch (Throwable e) {
      fail();
View Full Code Here

    } catch (Throwable e) {
      fail();
    }

    try {
      m.addRows(1, -3);
      fail();
    } catch (ArrayIndexOutOfBoundsException e) {
      assertTrue(true);
    } catch (Throwable e) {
      fail();
View Full Code Here

    }

    // test addRows(int, int, double)

    try {
      m.addRows(1, 3, 1);
      fail();
    } catch (ArrayIndexOutOfBoundsException e) {
      assertTrue(true);
    } catch (Throwable e) {
      fail();
View Full Code Here

    } catch (Throwable e) {
      fail();
    }

    try {
      m.addRows(5, 2, 2);
      fail();
    } catch (ArrayIndexOutOfBoundsException e) {
      assertTrue(true);
    } catch (Throwable e) {
      fail();
View Full Code Here

    } catch (Throwable e) {
      fail();
    }

    try {
      m.addRows(-1, 1, 3);
      fail();
    } catch (ArrayIndexOutOfBoundsException e) {
      assertTrue(true);
    } catch (Throwable e) {
      fail();
View Full Code Here

    } catch (Throwable e) {
      fail();
    }

    try {
      m.addRows(1, -3, 4);
      fail();
    } catch (ArrayIndexOutOfBoundsException e) {
      assertTrue(true);
    } catch (Throwable e) {
      fail();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.