当前位置: 首页>>代码示例>>C++>>正文


C++ Matrix2::coldim方法代码示例

本文整理汇总了C++中Matrix2::coldim方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix2::coldim方法的具体用法?C++ Matrix2::coldim怎么用?C++ Matrix2::coldim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix2的用法示例。


在下文中一共展示了Matrix2::coldim方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testaxpycblasConsistency

bool testaxpycblasConsistency  (LELA::Context<Ring, Modules1> &ctx1,
				LELA::Context<Ring, Modules2> &ctx2,
				const char *text,
				const typename Ring::Element &a,
				const Matrix1 &A1, const Matrix2 &A2,
				const Matrix3 &A3, const Matrix4 &A4)
{

        ostringstream str;
        str << "Testing " << text << " axpy consistency" << std::ends;
        commentator.start (str.str ().c_str ());

	std::ostream &report = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);

        bool pass = true;

	typename Matrix3::ContainerType A6 (A1.rowdim (), A1.coldim ());

	BLAS3::copy(ctx1, A1, A6);

        typename Matrix2::ContainerType A7 (A2.rowdim (), A2.coldim ());
        typename Matrix4::ContainerType A8 (A2.rowdim (), A2.coldim ());

	BLAS3::copy(ctx1, A2, A7);
	BLAS3::copy(ctx1, A2, A8);

        report << "Matrix A_1: "<< std::endl;
	BLAS3::write (ctx1, report, A1);

        report << "Matrix A_2: "<< std::endl;
	BLAS3::write (ctx1, report, A7);

	BLAS3::axpy (ctx1, a, A1, A7);

        report << "Matrix a A_1 + A_2: " << std::endl;;
	BLAS3::write (ctx1, report, A7);

        report << "Matrix A_1: "<< std::endl;
	BLAS3::write (ctx1, report, A6);

        report << "Matrix A_2: "<< std::endl;
	BLAS3::write (ctx1, report, A8);

	BLAS3::axpy (ctx2, a, A6, A8);

        report << "Matrix a A_3 + A_4: " << std::endl;
	BLAS3::write (ctx2, report, A8);

        if (!BLAS3::equal (ctx1, A7, A8))
	{
		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
			<< "ERROR: a A_1 + A_2  !=  a A_3 + A_4 " << std::endl;
		pass = false;
	}

        commentator.stop (MSG_STATUS (pass));

        return pass;
}
开发者ID:malex984,项目名称:LELA-Spielwiese,代码行数:59,代码来源:test-blas-cblas-module.C

示例2: testgemmcblasConsistency

bool testgemmcblasConsistency  (LELA::Context<Ring, Modules1> &ctx1,
				LELA::Context<Ring, Modules2> &ctx2,
				const char *text,
				const typename Ring::Element &a, const typename Ring::Element &b,
				const Matrix1 &A1, const Matrix2 &A2,
				const Matrix3 &A3, const Matrix4 &A4,
				const Matrix5 &A5, const Matrix6 &A6)
{

        ostringstream str;
        str << "Testing " << text << " gemm consistency" << std::ends;
        commentator.start (str.str ().c_str ());

	std::ostream &report = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);

        bool pass = true;

        typename Matrix4::ContainerType A7 (A1.rowdim (), A1.coldim ());
	typename Matrix5::ContainerType A8 (A2.rowdim (), A2.coldim ());

	BLAS3::copy(ctx1, A1, A7);
	BLAS3::copy(ctx1, A2, A8);

        typename Matrix3::ContainerType A9 (A3.rowdim (), A3.coldim ());
	typename Matrix6::ContainerType A10 (A3.rowdim (), A3.coldim ());

	BLAS3::copy(ctx1, A3, A9);
	BLAS3::copy(ctx1, A3, A10);

        report << "Matrix A_1: "<< std::endl;
	BLAS3::write (ctx1, report, A1);

        report << "Matrix A_2: "<< std::endl;
	BLAS3::write (ctx1, report, A2);

	report << "Coefficient b: ";
	ctx1.F.write (report, b) << std::endl;

	report << "Matrix A_3: "<< std::endl;
	BLAS3::write (ctx1, report, A9);

	BLAS3::gemm (ctx1, ctx1.F.one (), A1, A2, b, A9);

        report << "Matrix a A_1 A_2 + b A_3: " << std::endl;
	BLAS3::write (ctx1, report, A9);

        report << "Matrix A_4: "<< std::endl;
	BLAS3::write (ctx1, report, A7);

        report << "Matrix A_5: "<< std::endl;
	BLAS3::write (ctx1, report, A8);

        report << "Matrix A_6: "<< std::endl;
	BLAS3::write (ctx1, report, A10);

	BLAS3::gemm (ctx2, ctx2.F.one (), A7, A8, b, A10);

        report << "Matrix a A_4 A_5 + b A_6: " << std::endl;
	BLAS3::write (ctx2, report, A10);

        if (!BLAS3::equal (ctx1, A9, A10))
		{
			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
				<< "ERROR: a A_1 A_2 + b A_3  !=  a A_4 A_5 + b A_6 " << std::endl;
			pass = false;
		}

        commentator.stop (MSG_STATUS (pass));

        return pass;
}
开发者ID:malex984,项目名称:LELA-Spielwiese,代码行数:71,代码来源:test-blas-cblas-module.C


注:本文中的Matrix2::coldim方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。