<commit_before>/*************************************************************************
 *                                                                       *
 * Open Dynamics Engine 4J, Copyright (C) 2007-2010 <NAME>      *
 * All rights reserved.  Email: <EMAIL>   Web: www.ode4j.org        *
 *                                                                       *
 * This library is free software; you can redistribute it and/or         *
 * modify it under the terms of EITHER:                                  *
 *   (1) The GNU Lesser General Public License as published by the Free  *
 *       Software Foundation; either version 2.1 of the License, or (at  *
 *       your option) any later version. The text of the GNU Lesser      *
 *       General Public License is included with this library in the     *
 *       file LICENSE.TXT.                                               *
 *   (2) The BSD-style license that is included with this library in     *
 *       the file ODE4J-LICENSE-BSD.TXT.                                 *
 *                                                                       *
 * This library is distributed in the hope that it will be useful,       *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
 * LICENSE.TXT and ODE4J-LICENSE-BSD.TXT for more details.               *
 *                                                                       *
 *************************************************************************/
package org.ode4j.tests.math;

import org.junit.Test;
import org.ode4j.math.DMatrix3;
import org.ode4j.math.DVector3;
import org.ode4j.math.DMatrix3.DVector3ColView;
import org.ode4j.math.DMatrix3.DVector3RowTView;

public class TestDMatrix3 extends OdeTestCase {

	@Test public void main() {
		
	}
	
	@Test
	public void testGet(){
		DMatrix3 x = newM3();
		assertEquals(x.get00(), 1.);
		assertEquals(x.get01(), 2.);
		assertEquals(x.get02(), 3.);
		assertEquals(x.get10(), 4.);
		assertEquals(x.get11(), 5.);
		assertEquals(x.get12(), 6.);
		assertEquals(x.get20(), 7.);
		assertEquals(x.get21(), 8.);
		assertEquals(x.get22(), 9.);
		assertEquals(x.get(0, 0), 1.);
		assertEquals(x.get(0, 1), 2.);
		assertEquals(x.get(0, 2), 3.);
		assertEquals(x.get(1, 0), 4.);
		assertEquals(x.get(1, 1), 5.);
		assertEquals(x.get(1, 2), 6.);
		assertEquals(x.get(2, 0), 7.);
		assertEquals(x.get(2, 1), 8.);
		assertEquals(x.get(2, 2), 9.);
	}		
		
	@Test
	public void testEqual(){
		DMatrix3 x = newM3();
		DMatrix3 xx = newM3();
		DMatrix3 x1 = new DMatrix3();
		assertTrue(x.isEqual(xx));
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				x1.set(xx);
				x1.set(i, j, 0);
				assertFalse(x.isEqual(x1));
			}
		}
	}		
		
	@Test
	public void testSet(){
		DMatrix3 x = new DMatrix3();
		DMatrix3 x2 = newM3();
		
		//test setIJ()
		x.set00(1);
		assertEquals(x.get00(), 1.);
		x.set01(2);
		assertEquals(x.get01(), 2.);
		x.set02(3);
		assertEquals(x.get02(), 3.);
		x.set10(4);
		assertEquals(x.get10(), 4.);
		x.set11(5);
		assertEquals(x.get11(), 5.);
		x.set12(6);
		assertEquals(x.get12(), 6.);
		x.set20(7);
		assertEquals(x.get20(), 7.);
		x.set21(8);
		assertEquals(x.get21(), 8.);
		x.set22(9);
		assertEquals(x.get22(), 9.);
		assertEquals(x, x2);
		
		//test set(i, j)
		x = new DMatrix3();
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				x.set(i, j, 1 + j + 3*i);
				assertEquals(x.get(i, j), 1 + j + 3*i);
			}
		}
		assertEquals(x, x2);

		//test set(d0, d1, ...)
		x = new DMatrix3();
		x.set(1, 2, 3, 4, 5, 6, 7, 8, 9);
		assertEquals(x, x2);
		
		//
		x = new DMatrix3();
		x.set(x2);
		assertEquals(x, x2);

		//TODO This ",0" should be removed at some point (?)
		x = new DMatrix3();
		x.set12( new double[]{ 1, 2, 3, 0, 4, 5, 6, 0, 7, 8, 9, 0} , 0);
		assertEquals(x, x2);

//		x = new DMatrix3();
//		x.setValues(2);
//		assertEquals(x, new DMatrix3(2, 2, 2, 2, 2, 2, 2, 2, 2));

		x = new DMatrix3();
		assertFalse(x.isEqual(x2));<commit_msg>Updated DMatrix3, DMatrix3C, DVector3I, DVector3View with Javadocs. Also made some minor refactoring favoring the use of using interface references as parameters to methods over their concrete classes.<commit_after>/*************************************************************************
 *                                                                       *
 * Open Dynamics Engine 4J, Copyright (C) 2007-2010 <NAME>      *
 * All rights reserved.  Email: <EMAIL>   Web: www.ode4j.org        *
 *                                                                       *
 * This library is free software; you can redistribute it and/or         *
 * modify it under the terms of EITHER:                                  *
 *   (1) The GNU Lesser General Public License as published by the Free  *
 *       Software Foundation; either version 2.1 of the License, or (at  *
 *       your option) any later version. The text of the GNU Lesser      *
 *       General Public License is included with this library in the     *
 *       file LICENSE.TXT.                                               *
 *   (2) The BSD-style license that is included with this library in     *
 *       the file ODE4J-LICENSE-BSD.TXT.                                 *
 *                                                                       *
 * This library is distributed in the hope that it will be useful,       *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
 * LICENSE.TXT and ODE4J-LICENSE-BSD.TXT for more details.               *
 *                                                                       *
 *************************************************************************/
package org.ode4j.tests.math;

import org.junit.Test;
import org.ode4j.math.DMatrix3;
import org.ode4j.math.DVector3;
import org.ode4j.math.DMatrix3.DVector3ColView;
import org.ode4j.math.DMatrix3.DVector3RowTView;

public class TestDMatrix3 extends OdeTestCase {

	@Test public void main() {
		
	}
	
	@Test
	public void testGet(){
		DMatrix3 x = newM3();
		assertEquals(x.get00(), 1.);
		assertEquals(x.get01(), 2.);
		assertEquals(x.get02(), 3.);
		assertEquals(x.get10(), 4.);
		assertEquals(x.get11(), 5.);
		assertEquals(x.get12(), 6.);
		assertEquals(x.get20(), 7.);
		assertEquals(x.get21(), 8.);
		assertEquals(x.get22(), 9.);
		assertEquals(x.get(0, 0), 1.);
		assertEquals(x.get(0, 1), 2.);
		assertEquals(x.get(0, 2), 3.);
		assertEquals(x.get(1, 0), 4.);
		assertEquals(x.get(1, 1), 5.);
		assertEquals(x.get(1, 2), 6.);
		assertEquals(x.get(2, 0), 7.);
		assertEquals(x.get(2, 1), 8.);
		assertEquals(x.get(2, 2), 9.);
	}		
		
	@Test
	public void testEqual(){
		DMatrix3 x = newM3();
		DMatrix3 xx = newM3();
		DMatrix3 x1 = new DMatrix3();
		assertTrue(x.isEqual(xx));
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				x1.set(xx);
				x1.set(i, j, 0);
				assertFalse(x.isEqual(x1));
			}
		}
	}		
		
	@Test
	public void testSet(){
		DMatrix3 x = new DMatrix3();
		DMatrix3 x2 = newM3();
		
		//test setIJ()
		x.set00(1);
		assertEquals(x.get00(), 1.);
		x.set01(2);
		assertEquals(x.get01(), 2.);
		x.set02(3);
		assertEquals(x.get02(), 3.);
		x.set10(4);
		assertEquals(x.get10(), 4.);
		x.set11(5);
		assertEquals(x.get11(), 5.);
		x.set12(6);
		assertEquals(x.get12(), 6.);
		x.set20(7);
		assertEquals(x.get20(), 7.);
		x.set21(8);
		assertEquals(x.get21(), 8.);
		x.set22(9);
		assertEquals(x.get22(), 9.);
		assertEquals(x, x2);
		
		//test set(i, j)
		x = new DMatrix3();
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				x.set(i, j, 1 + j + 3*i);
				assertEquals(x.get(i, j), 1 + j + 3*i);
			}
		}
		assertEquals(x, x2);

		//test set(d0, d1, ...)
		x = new DMatrix3();
		x.set(1, 2, 3, 4, 5, 6, 7, 8, 9);
		assertEquals(x, x2);
		
		//
		x = new DMatrix3();
		x.set(x2);
		assertEquals(x, x2);

		//TODO This ",0" should be removed at some point (?)
		x = new DMatrix3();
		x.set( new double[]{ 1, 2, 3, 0, 4, 5, 6, 0, 7, 8, 9, 0} , 0);
		assertEquals(x, x2);

//		x = new DMatrix3();
//		x.setValues(2);
//		assertEquals(x, new DMatrix3(2, 2, 2, 2, 2, 2, 2, 2, 2));

		x = new DMatrix3();
		assertFalse(x.isEqual(x2));
{'fraction_non_alphanumeric': 0.18778497720182385, 'fraction_numerical': 0.05231581473482121, 'mean_word_length': 2.1228924690895465, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2759259', 'n_tokens_mistral': 3319, 'n_tokens_neox': 2781, 'n_words': 791}