本文整理汇总了C++中Mat::get_CoeffRing方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat::get_CoeffRing方法的具体用法?C++ Mat::get_CoeffRing怎么用?C++ Mat::get_CoeffRing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat
的用法示例。
在下文中一共展示了Mat::get_CoeffRing方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dot_product
virtual bool dot_product(size_t c1, size_t c2, ring_elem &result) const
{
size_t ncols = n_cols();
if (error_column_bound(c1,ncols) || error_column_bound(c2,ncols))
return false;
elem a;
mat.get_CoeffRing()->set_zero(a);
mat.dot_product(c1,c2,a);
mat.get_CoeffRing()->to_ring_elem(result,a);
return true;
}
示例2: lead_row
virtual size_t lead_row(size_t col, ring_elem &result) const
/* returns the largest index row which has a non-zero value in column 'col'.
Also sets result to be the entry at this index.
returns -1 if the column is 0 */
{
elem b;
mat.get_CoeffRing()->set_zero(b);
size_t ret = mat.lead_row(col, b);
if (ret >= 0)
mat.get_CoeffRing()->to_ring_elem(result, b);
return ret;
}
示例3: get_entry
virtual bool get_entry(size_t r, size_t c, ring_elem &result) const
// Returns false if (r,c) is out of range or if result is 0. No error
// is returned. result <-- this(r,c), and is set to zero if false is returned.
{
if (r >= 0 && r < n_rows() && c >= 0 && c < n_cols())
{
elem a;
mat.get_CoeffRing()->set_zero(a);
if (mat.get_entry(r,c,a))
{
mat.get_CoeffRing()->to_ring_elem(result,a);
return true;
}
}
result = mat.get_ring()->zero();
return false;
}
示例4: row
virtual bool row2by2(size_t r1, size_t r2,
ring_elem a1, ring_elem a2,
ring_elem b1, ring_elem b2)
/* row(r1) <- a1 * row(r1) + a2 * row(r2),
row(r2) <- b1 * row(r1) + b2 * row(r2)
*/
{
size_t nrows = n_rows();
if (error_row_bound(r1,nrows) || error_row_bound(r2,nrows))
return false;
if (r1 == r2) return true;
elem aa1, aa2, bb1, bb2;
mat.get_CoeffRing()->from_ring_elem(aa1,a1);
mat.get_CoeffRing()->from_ring_elem(aa2,a2);
mat.get_CoeffRing()->from_ring_elem(bb1,b1);
mat.get_CoeffRing()->from_ring_elem(bb2,b2);
mat.row2by2(r1,r2,aa1,aa2,bb1,bb2);
return true;
}
示例5: column
virtual bool column2by2(size_t c1, size_t c2,
ring_elem a1, ring_elem a2,
ring_elem b1, ring_elem b2)
/* column(c1) <- a1 * column(c1) + a2 * column(c2),
column(c2) <- b1 * column(c1) + b2 * column(c2)
*/
{
size_t ncols = n_cols();
if (error_column_bound(c1,ncols) || error_column_bound(c2,ncols))
return false;
if (c1 == c2) return true;
elem aa1, aa2, bb1, bb2;
mat.get_CoeffRing()->from_ring_elem(aa1,a1);
mat.get_CoeffRing()->from_ring_elem(aa2,a2);
mat.get_CoeffRing()->from_ring_elem(bb1,b1);
mat.get_CoeffRing()->from_ring_elem(bb2,b2);
mat.column2by2(c1,c2,aa1,aa2,bb1,bb2);
return true;
}
示例6: set_entry
virtual bool set_entry(size_t r, size_t c, const ring_elem a)
// Returns false if (r,c) is out of range, or the ring of a is wrong.
{
if (error_row_bound(r,n_rows())) return false;
if (error_column_bound(c,n_cols())) return false;
elem b;
mat.get_CoeffRing()->from_ring_elem(b,a);
mat.set_entry(r,c,b);
return true;
}
示例7: divide_column
virtual bool divide_column(size_t i, ring_elem r)
/* column(i) <- column(i) / r */
{
size_t ncols = n_cols();
if (error_column_bound(i,ncols))
return false;
elem b;
mat.get_CoeffRing()->from_ring_elem(b,r);
mat.divide_column(i,b);
return true;
}
示例8: divide_row
virtual bool divide_row(size_t i, ring_elem r)
/* row(i) <- row(i) / r */
{
size_t nrows = n_rows();
if (error_row_bound(i,nrows))
return false;
elem b;
mat.get_CoeffRing()->from_ring_elem(b,r);
mat.divide_row(i,b);
return true;
}
示例9: column_op
virtual bool column_op(size_t i, ring_elem r, size_t j)
/* column(i) <- column(i) + r * column(j) */
{
size_t ncols = n_cols();
if (error_column_bound(i,ncols) || error_column_bound(j,ncols))
return false;
if (i == j) return true;
elem b;
mat.get_CoeffRing()->from_ring_elem(b,r);
mat.column_op(i,b,j);
return true;
}
示例10: row_op
virtual bool row_op(size_t i, ring_elem r, size_t j)
/* row(i) <- row(i) + r * row(j) */
{
size_t nrows = n_rows();
if (error_row_bound(i,nrows) || error_row_bound(j,nrows))
return false;
if (i == j) return true;
elem b;
mat.get_CoeffRing()->from_ring_elem(b,r);
mat.row_op(i,b,j);
return true;
}