3 * searches for the next unit in the components of the module arg and * returns the first one; */
| 2693 | * returns the first one; |
| 2694 | */ |
| 2695 | static int id_ReadOutPivot(ideal arg,int* comp, const ring r) |
| 2696 | { |
| 2697 | int i=0,j, generator=-1; |
| 2698 | int rk_arg=arg->rank; //idRankFreeModule(arg); |
| 2699 | int * componentIsUsed =(int *)omAlloc((rk_arg+1)*sizeof(int)); |
| 2700 | poly p; |
| 2701 | |
| 2702 | while ((generator<0) && (i<IDELEMS(arg))) |
| 2703 | { |
| 2704 | memset(componentIsUsed,0,(rk_arg+1)*sizeof(int)); |
| 2705 | p = arg->m[i]; |
| 2706 | if (rField_is_Ring(r)) |
| 2707 | { |
| 2708 | while (p!=NULL) |
| 2709 | { |
| 2710 | j = __p_GetComp(p,r); |
| 2711 | if (componentIsUsed[j]==0) |
| 2712 | { |
| 2713 | if (p_LmIsConstantComp(p,r) && |
| 2714 | n_IsUnit(pGetCoeff(p),r->cf)) |
| 2715 | { |
| 2716 | generator = i; |
| 2717 | componentIsUsed[j] = 1; |
| 2718 | } |
| 2719 | else |
| 2720 | { |
| 2721 | componentIsUsed[j] = -1; |
| 2722 | } |
| 2723 | } |
| 2724 | else if (componentIsUsed[j]>0) |
| 2725 | { |
| 2726 | (componentIsUsed[j])++; |
| 2727 | } |
| 2728 | pIter(p); |
| 2729 | } |
| 2730 | } |
| 2731 | else |
| 2732 | { |
| 2733 | while (p!=NULL) |
| 2734 | { |
| 2735 | j = __p_GetComp(p,r); |
| 2736 | if (componentIsUsed[j]==0) |
| 2737 | { |
| 2738 | if (p_LmIsConstantComp(p,r)) |
| 2739 | { |
| 2740 | generator = i; |
| 2741 | componentIsUsed[j] = 1; |
| 2742 | } |
| 2743 | else |
| 2744 | { |
| 2745 | componentIsUsed[j] = -1; |
| 2746 | } |
| 2747 | } |
| 2748 | else if (componentIsUsed[j]>0) |
| 2749 | { |
| 2750 | (componentIsUsed[j])++; |
| 2751 | } |
| 2752 | pIter(p); |
no test coverage detected