Beispiel #1
0
ExprVector::ExprVector(const Array<const ExprNode>& comp, bool in_row) :
		ExprNAryOp(comp, vec_dim(dims(comp),in_row)) {
}
Beispiel #2
0
ExprVector::ExprVector(const ExprNode** comp, int n, bool in_row) :
		ExprNAryOp(comp, n, vec_dim(dims(comp,n),in_row)) {
}
Beispiel #3
0
void TestDim::vec() {
	Dim sca;
	Dim row2(Dim::row_vec(2));
	Dim row3(Dim::row_vec(3));
	Dim col2(Dim::col_vec(2));
	Dim col3(Dim::col_vec(3));
	Dim mat22(Dim::matrix(2,2));
	Dim mat32(Dim::matrix(3,2));
	Dim mat23(Dim::matrix(2,3));
	Dim mat33(Dim::matrix(3,3));

	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(sca),true)==sca);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(sca),false)==sca);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(sca,sca),true)==row2);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(sca,sca),false)==col2);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(sca,sca,sca),true)==row3);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(sca,sca,sca),false)==col3);

	CPPUNIT_ASSERT_THROW(vec_dim(Array<const Dim>(sca,col2),true),DimException);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(sca,col2),false)==col3);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(sca,row2),true)==row3);
	CPPUNIT_ASSERT_THROW(vec_dim(Array<const Dim>(sca,row2),false),DimException);
	CPPUNIT_ASSERT_THROW(vec_dim(Array<const Dim>(sca,mat22),true),DimException);
	CPPUNIT_ASSERT_THROW(vec_dim(Array<const Dim>(sca,mat22),false),DimException);

	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(col2),true)==col2);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(col2),false)==col2);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(col2,col2),true)==mat22);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(col2,col2),false)==Dim::col_vec(4));
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(col2,col2,col2),true)==mat23);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(col2,col2,col2),false)==Dim::col_vec(6));
	CPPUNIT_ASSERT_THROW(vec_dim(Array<const Dim>(col2,row2),true),DimException);
	CPPUNIT_ASSERT_THROW(vec_dim(Array<const Dim>(col2,row2),false),DimException);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(col2,mat22),true)==mat23);
	CPPUNIT_ASSERT_THROW(vec_dim(Array<const Dim>(col2,mat22),false),DimException);
	CPPUNIT_ASSERT      (vec_dim(Array<const Dim>(col2,mat22,col2),true)==Dim::matrix(2,4));
}