# Singular

##### 7.5.12.0. ncfactor
Procedure from library `ncfactor.lib` (see ncfactor_lib).

Usage:
ncfactor(h); h is a polynomial in a non-commutative polynomial algebra over a field k.

Return:
list(list)

Purpose:
Compute all factorizations of h.

Theory:
Implements an ansatz-driven factorization method as outlined by Bell, Heinle and Levandovskyy in "On Noncommutative Finite Factorization Domains".

Assume:
- k is a ring, such that factorize can factor any univariate and multivariate commutative polynomial over k.
- There exists at least one variable in the ring.

Note:
- works for both PLURAL and LETTERPLACE subsystems
- Every entry of the output list is a list with factors for one possible factorization. The first factor is always a constant (1, if no nontrivial constant could be excluded).

Example:
 ```LIB "ncfactor.lib"; // first, an example with PLURAL def R = makeUsl2(); setring(R); poly p = e^3*f+e^2*f^2-e^3+e^2*f+2*e*f^2-3*e^2*h-2*e*f*h-8*e^2 +e*f+f^2-4*e*h-2*f*h-7*e+f-h; ncfactor(p); ==> [1]: ==> [1]: ==> 1 ==> [2]: ==> e+1 ==> [3]: ==> ef-e+f-2h-3 ==> [4]: ==> e+f ==> [2]: ==> [1]: ==> 1 ==> [2]: ==> e2f+ef2-e2+f2-2eh-3e-f-2h ==> [3]: ==> e+1 kill R; // an example with LETTERPLACE LIB "freegb.lib"; ==> // ** redefining tstfreegb (LIB "freegb.lib";) ==> // ** redefining tstfreegb (LIB "freegb.lib";) ==> // ** redefining setLetterplaceAttributes (LIB "freegb.lib";) ==> // ** redefining setLetterplaceAttributes (LIB "freegb.lib";) ==> // ** redefining lst2str (LIB "freegb.lib";) ==> // ** redefining mod2str (LIB "freegb.lib";) ==> // ** redefining vct2str (LIB "freegb.lib";) ==> // ** redefining isVar (LIB "freegb.lib";) ==> // ** redefining letplaceGBasis (LIB "freegb.lib";) ==> // ** redefining letplaceGBasis (LIB "freegb.lib";) ==> // ** redefining lieBracket (LIB "freegb.lib";) ==> // ** redefining lieBracket (LIB "freegb.lib";) ==> // ** redefining lpPrint (LIB "freegb.lib";) ==> // ** redefining lpPrint (LIB "freegb.lib";) ==> // ** redefining freeGBasis (LIB "freegb.lib";) ==> // ** redefining freeGBasis (LIB "freegb.lib";) ==> // ** redefining crs (LIB "freegb.lib";) ==> // ** redefining polylen (LIB "freegb.lib";) ==> // ** redefining lpDegBound (LIB "freegb.lib";) ==> // ** redefining lpDegBound (LIB "freegb.lib";) ==> // ** redefining lpVarBlockSize (LIB "freegb.lib";) ==> // ** redefining lpVarBlockSize (LIB "freegb.lib";) ==> // ** redefining isFreeAlgebra (LIB "freegb.lib";) ==> // ** redefining isFreeAlgebra (LIB "freegb.lib";) ==> // ** redefining makeLetterplaceRing (LIB "freegb.lib";) ==> // ** redefining makeLetterplaceRing (LIB "freegb.lib";) ==> // ** redefining makeLetterplaceRing1 (LIB "freegb.lib";) ==> // ** redefining makeLetterplaceRing2 (LIB "freegb.lib";) ==> // ** redefining makeLetterplaceRing4 (LIB "freegb.lib";) ==> // ** redefining makeLetterplaceRing3 (LIB "freegb.lib";) ==> // ** redefining freegbold (LIB "freegb.lib";) ==> // ** redefining stringpoly2lplace (LIB "freegb.lib";) ==> // ** redefining addplaces (LIB "freegb.lib";) ==> // ** redefining sent2lplace (LIB "freegb.lib";) ==> // ** redefining testnumber (LIB "freegb.lib";) ==> // ** redefining str2lplace (LIB "freegb.lib";) ==> // ** redefining strpower2rep (LIB "freegb.lib";) ==> // ** redefining shiftPoly (LIB "freegb.lib";) ==> // ** redefining lastBlock (LIB "freegb.lib";) ==> // ** redefining test_shift (LIB "freegb.lib";) ==> // ** redefining lp2lstr (LIB "freegb.lib";) ==> // ** redefining lp2lstr (LIB "freegb.lib";) ==> // ** redefining strList2poly (LIB "freegb.lib";) ==> // ** redefining file2lplace (LIB "freegb.lib";) ==> // ** redefining lpPower (LIB "freegb.lib";) ==> // ** redefining lpNF (LIB "freegb.lib";) ==> // ** redefining lpNF (LIB "freegb.lib";) ==> // ** redefining lpDivision (LIB "freegb.lib";) ==> // ** redefining lpDivision (LIB "freegb.lib";) ==> // ** redefining lpGBPres2Poly (LIB "freegb.lib";) ==> // ** redefining lpGBPres2Poly (LIB "freegb.lib";) ==> // ** redefining getExpVecs (LIB "freegb.lib";) ==> // ** redefining delSupZero (LIB "freegb.lib";) ==> // ** redefining delSupZeroList (LIB "freegb.lib";) ==> // ** redefining makeDVec (LIB "freegb.lib";) ==> // ** redefining makeDVecL (LIB "freegb.lib";) ==> // ** redefining makeDVecI (LIB "freegb.lib";) ==> // ** redefining dShiftDiv (LIB "freegb.lib";) ==> // ** redefining lpNormalForm1 (LIB "freegb.lib";) ==> // ** redefining lpNormalForm2 (LIB "freegb.lib";) ==> // ** redefining isOrderingShiftInvariant (LIB "freegb.lib";) ==> // ** redefining isOrderingShiftInvariant (LIB "freegb.lib";) ==> // ** redefining lpMonomialsWithHoles (LIB "freegb.lib";) ==> // ** redefining getlpCoeffs (LIB "freegb.lib";) ==> // ** redefining lpReduce (LIB "freegb.lib";) ==> // ** redefining entryViolation (LIB "freegb.lib";) ==> // ** redefining checkAssumptionsLPIV (LIB "freegb.lib";) ==> // ** redefining checkAssumptions (LIB "freegb.lib";) ==> // ** redefining checkLPRing (LIB "freegb.lib";) ==> // ** redefining checkAssumptionIdeal (LIB "freegb.lib";) ==> // ** redefining checkAssumptionPoly (LIB "freegb.lib";) ==> // ** redefining isContainedInVp (LIB "freegb.lib";) ==> // ** redefining extractLinearPart (LIB "freegb.lib";) ==> // ** redefining isLinearVector (LIB "freegb.lib";) ==> // ** redefining lpAssumeViolation (LIB "freegb.lib";) ==> // ** redefining lshift (LIB "freegb.lib";) ==> // ** redefining skip0 (LIB "freegb.lib";) ==> // ** redefining ivL2lpI (LIB "freegb.lib";) ==> // ** redefining ivL2lpI (LIB "freegb.lib";) ==> // ** redefining iv2lp (LIB "freegb.lib";) ==> // ** redefining iv2lp (LIB "freegb.lib";) ==> // ** redefining iv2lpList (LIB "freegb.lib";) ==> // ** redefining iv2lpList (LIB "freegb.lib";) ==> // ** redefining iv2lpMat (LIB "freegb.lib";) ==> // ** redefining iv2lpMat (LIB "freegb.lib";) ==> // ** redefining lpId2ivLi (LIB "freegb.lib";) ==> // ** redefining lpId2ivLi (LIB "freegb.lib";) ==> // ** redefining lp2iv (LIB "freegb.lib";) ==> // ** redefining lp2iv (LIB "freegb.lib";) ==> // ** redefining lp2ivId (LIB "freegb.lib";) ==> // ** redefining lp2ivId (LIB "freegb.lib";) ==> // ** redefining mod_init (LIB "freegb.lib";) ring r = 0,(x,y),Dp; def R = freeAlgebra(r,5); setring(R); poly p = x*y*x - x; ncfactor(p); ==> [1]: ==> [1]: ==> 1 ==> [2]: ==> x*y-1 ==> [3]: ==> x ==> [2]: ==> [1]: ==> 1 ==> [2]: ==> x ==> [3]: ==> y*x-1 ```