Changeset 6fd83c4 in git
- Timestamp:
- Jan 5, 2012, 1:03:48 PM (11 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- 34e062be492e096661b73e4bf540240303bdc2ec
- Parents:
- f9b796e144ec0a1fae5662e82e689bdaa9c6727f
- git-author:
- Martin Lee <martinlee84@web.de>2012-01-05 13:03:48+01:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-02-10 14:16:43+01:00
- Location:
- factory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cfNewtonPolygon.cc
rf9b796e r6fd83c4 145 145 i++; 146 146 } 147 if (i + 1 < sizePoints)147 if (i + 1 <= sizePoints || i == sizePoints) 148 148 { 149 149 int relArea= … … 681 681 } 682 682 #endif 683 684 //assumes the input is a Newton polygon of a bivariate polynomial which is 685 //primitive wrt. x and y, i.e. there is at least one point of the polygon lying 686 //on the x-axis and one lying on the y-axis 687 int* getRightSide (int** polygon, int sizeOfPolygon, int& sizeOfOutput) 688 { 689 int maxY= polygon [0][0]; 690 int indexY= 0; 691 for (int i= 1; i < sizeOfPolygon; i++) 692 { 693 if (maxY < polygon [i][0]) 694 { 695 maxY= polygon [i][0]; 696 indexY= i; 697 } 698 else if (maxY == polygon [i][0]) 699 { 700 if (polygon [indexY][1] < polygon[i][1]) 701 indexY= i; 702 } 703 if (maxY > polygon [i][0]) 704 break; 705 } 706 707 int count= -1; 708 for (int i= indexY; i < sizeOfPolygon; i++) 709 { 710 if (polygon[i][0] == 0) 711 { 712 count= i - indexY; 713 break; 714 } 715 } 716 717 int * result; 718 int index= 0; 719 if (count < 0) 720 { 721 result= new int [sizeOfPolygon - indexY]; 722 sizeOfOutput= sizeOfPolygon - indexY; 723 count= sizeOfPolygon - indexY - 1; 724 result [0]= polygon[sizeOfPolygon - 1][0] - polygon [0] [0]; 725 index= 1; 726 } 727 else 728 { 729 sizeOfOutput= count; 730 result= new int [count]; 731 } 732 733 for (int i= indexY + count; i > indexY; i--, index++) 734 result [index]= polygon [i - 1] [0] - polygon [i] [0]; 735 736 return result; 737 } -
factory/cfNewtonPolygon.h
rf9b796e r6fd83c4 49 49 ); 50 50 51 /// get the y-direction slopes of all edges with positive slope in y-direction 52 /// of a convex polygon with at least one point of the polygon lying on the 53 /// x-axis and one lying on the y-axis 54 /// 55 /// @return an array containing the slopes as described above 56 int* getRightSide (int** polygon, ///<[in] vertices of a polygon 57 int sizeOfPolygon, ///<[in] number of vertices 58 int& sizeOfOutput ///<[in,out] size of the output 59 ); 60 51 61 #ifdef HAVE_NTL 52 62 /// Algorithm 5 as described in Convex-Dense Bivariate Polynomial Factorization
Note: See TracChangeset
for help on using the changeset viewer.