Macaulay2 Engine
Loading...
Searching...
No Matches

◆ IM2_Matrix_lift()

const Matrix * IM2_Matrix_lift ( int * success_return,
const FreeModule * newTarget,
const Matrix * f )

Definition at line 792 of file matrix.cpp.

795{
796 try
797 {
798 ring_elem a;
799 const Ring *R = f->get_ring();
800 const Ring *S = newTarget->get_ring();
801 MatrixConstructor mat(newTarget, f->n_cols());
802 Matrix::iterator i(f);
803 for (int c = 0; c < f->n_cols(); c++)
804 for (i.set(c); i.valid(); i.next())
805 if (R->lift(S, i.entry(), a))
806 mat.set_entry(i.row(), c, a);
807 else
808 {
809 // ERROR("cannot lift given matrix");
810 return nullptr;
811 }
812 mat.compute_column_degrees();
813 *success_return = 1;
814 return mat.to_matrix();
815 } catch (const exc::engine_error& e)
816 {
817 ERROR(e.what());
818 return nullptr;
819 }
820}
const Ring * get_ring() const
Definition freemod.hpp:102
const Ring * get_ring() const
Definition matrix.hpp:134
int n_cols() const
Definition matrix.hpp:147
Mutable builder used to assemble an immutable Matrix one column (or one term) at a time.
virtual bool lift(const Ring *R, const ring_elem f, ring_elem &result) const =0
xxx xxx xxx
Definition ring.hpp:102
const int ERROR
Definition m2-mem.cpp:55

References MatrixConstructor::compute_column_degrees(), Matrix::iterator::entry(), ERROR, FreeModule::get_ring(), Matrix::get_ring(), Ring::lift(), Matrix, Matrix::n_cols(), Matrix::iterator::next(), Matrix::iterator::row(), Matrix::iterator::set(), MatrixConstructor::set_entry(), MatrixConstructor::to_matrix(), and Matrix::iterator::valid().