http://apcocoa.uni-passau.de/wiki/api.php?action=feedcontributions&user=134.146.0.22&feedformat=atomApCoCoAWiki - User contributions [en]2024-03-28T10:29:57ZUser contributionsMediaWiki 1.35.0http://apcocoa.uni-passau.de/wiki/index.php?title=CoCoA:HowTo:Plot_order_ideals&diff=91CoCoA:HowTo:Plot order ideals2005-06-23T08:52:29Z<p>134.146.0.22: /* About */</p>
<hr />
<div>==About==<br />
<br />
At the [[SummerSchool05|CoCoA Summer School 2005]] there was a discussion about the possibility to plot order ideals.<br />
An order ideal is simply the complement of an ideal's leading term ideal, otherwise it could be described as a vector space basis <br />
of the quotient space P/I consisting of monomials (this is exactly the B in [[MacCaulys Basis Theorem]] with respect to the notation of Kreuzer's & Robbiano's book).<br />
<br />
The question was, if there is any software to visualize this order ideals for polynomial rings in two or three indeterminates. <br />
During the school, [[User:Bigatti|Anna Bigatti]] and [[User:Dheldt|Daniel Heldt]] developed tools to plot order ideals.<br />
<br />
These tools use [[CoCoA_4|CoCoa 4]] and either [http://povray.com Povray] or Latex. <br />
The code uses CoCoA's [[QuotientBasis]] command, to get a list of all terms to draw and than draws this terms (or selects which of them should be drawn and which are invisible, in case of the latex pictures).<br />
<br />
<br />
The code to plot the order ideals is given in the next sections:<br />
<br />
== CoCoA & Latex Code (1. Version) ==<br />
<br />
Both functions (this and the next one) get as input a zero-dimensional ideal. The output is some text, containing the latex picture enviroment. simply render this to get a picture of your order ideal. You can even change the point of view<br />
of the model, by changing V1, V2, V3 and L1, L2, L3. How this exactly works can be figured out quite easily, having a look at a latex documentation for the picture enviroment.<br />
<br />
Define BorderTeX(I)<br />
String:='\begin{picture}(300,300)';<br />
<br />
// define your coordinate system:<br />
Offset := Vector(150,150);<br />
V1 := Vector(-1,-1);<br />
V2 := Vector(0,1); <br />
V3 := Vector(1,0);<br />
L1 := 14;<br />
L2 := 20;<br />
L3 := 20;<br />
<br />
// get the Vectorspace-Basis of P/I:<br />
<br />
B := QuotientBasis(I);<br />
<br />
// check what to paint for what Basis Element:<br />
<br />
// Check for all Elements in Basis what to draw:<br />
ForEach El_B In B Do<br />
L := Log(El_B); <br />
Start := Offset + L1*L[1]*V1 + L2*L[2]V2 + L3*L[3]*V3;<br />
<br />
If Not(Indet(1)*Indet(2)*El_B IsIn B) And L[3] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V3[1])+','+Sprint(-V3[2])+'){'+Sprint(L3)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
If Not(Indet(1)*Indet(3)*El_B IsIn B) And L[2] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V2[1])+','+Sprint(-V2[2])+'){'+Sprint(L2)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
If Not(Indet(2)*Indet(3)*El_B IsIn B) And L[1] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V1[1])+','+Sprint(-V1[2])+'){'+Sprint(L1)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
<br />
EndForEach;<br />
<br />
Return String+'\end{picture}';<br />
EndDefine;<br />
<br />
code by [[User:Dheldt|dheldt]] 08:37, 22 Jun 2005 (CEST)<br />
<br />
== CoCoA & Latex Code (2. Version) ==<br />
<br />
I created another version, a little bit more sophisticated. It contains coordinate axis and scales the picture enviroment to the right size. The code for this is:<br />
<br />
Define Border(I)<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// define your coordinate system:<br />
Offset := Vector(150,150);<br />
V1 := Vector(-1,-1); L1 := 14;<br />
V2 := Vector(0,1); L2 := 20;<br />
V3 := Vector(1,0); L3 := 20;<br />
<br />
Max1 := 0;<br />
Max2 := 0;<br />
Max3 := 0;<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// get the Vectorspace-Basis of P/I: <br />
B := QuotientBasis(I);<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// Compute picture's size:<br />
ForEach El_B In B Do<br />
L := Log(El_B); <br />
If L[1] > Max1 Then Max1 := L[1]; EndIf;<br />
If L[2] > Max2 Then Max2 := L[2]; EndIf;<br />
If L[3] > Max3 Then Max3 := L[3]; EndIf;<br />
EndForEach;<br />
<br />
Max1:= Max1 + 1; Max2 := Max2 +1; Max3 := Max3 +1;<br />
<br />
Width := Sum([ Abs(LC((Max1+3)*L1*V1[1])),Abs(LC((Max2+3)*L2*V2[1])),Abs(LC((Max3+3)*L3*V3[1])) ]);<br />
Height := Sum([ Abs(LC((Max1+3)*L1*V1[2])),Abs(LC((Max2+3)*L2*V2[2])),Abs(LC((Max3+3)*L3*V3[2])) ]);<br />
<br />
String:='\begin{picture}('+Sprint(Width)+','+Sprint(Height)+')';<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// Compute Offset / (0,0,0):<br />
Offset:=Vector(Abs(Min([ LC((Max1+3)*L1*V1[1]),LC((Max2+3)*L2*V2[1]),LC((Max3+3)*L3*V3[1])])),<br />
Abs(Min([ LC((Max1+3)*L1*V1[2]),LC((Max2+3)*L2*V2[2]),LC((Max3+3)*L3*V3[2])])));<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// Check for all Elements in Basis what to draw:<br />
ForEach El_B In B Do<br />
L := Log(El_B); <br />
Start := Offset + L1*L[1]*V1 + L2*L[2]V2 + L3*L[3]*V3;<br />
<br />
If Not(Indet(1)*Indet(2)*El_B IsIn B) And L[3] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V3[1])+','+Sprint(-V3[2])+'){'+Sprint(L3)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
If Not(Indet(1)*Indet(3)*El_B IsIn B) And L[2] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V2[1])+','+Sprint(-V2[2])+'){'+Sprint(L2)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
If Not(Indet(2)*Indet(3)*El_B IsIn B) And L[1] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V1[1])+','+Sprint(-V1[2])+'){'+Sprint(L1)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
EndForEach;<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// Draw the three axis and the indeterminates names:<br />
<br />
Start := Offset + Max1 * V1 * L1;<br />
String := String + '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\vector('+Sprint(V1[1])+','+Sprint(V1[2])+'){'+Sprint(2*L1)+'}}';<br />
<br />
String := String + '\put('+Sprint(Start[1]+3*L1*V1[1])+','+Sprint(Start[2]+3*L1*V1[2])+')<br />
{$\displaystyle ' +Sprint(Indet(1))+'$}';<br />
<br />
Start := Offset + Max2 * V2 * L2;<br />
String := String + '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\vector('+Sprint(V2[1])+','+Sprint(V2[2])+'){'+Sprint(2*L2)+'}}';<br />
<br />
String := String + '\put('+Sprint(Start[1]+3*L2*V2[1])+','+Sprint(Start[2]+3*L2*V2[2])+')<br />
{$\displaystyle ' +Sprint(Indet(2))+'$}';<br />
<br />
Start := Offset + Max3 * V3 * L3;<br />
String := String + '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\vector('+Sprint(V3[1])+','+Sprint(V3[2])+'){'+Sprint(2*L3)+'}}';<br />
<br />
String := String + '\put('+Sprint(Start[1]+3*L3*V3[1])+','+Sprint(Start[2]+3*L3*V3[2])+')<br />
{$\displaystyle ' +Sprint(Indet(3))+'$}';<br />
<br />
Return String+'\end{picture}';<br />
EndDefine;<br />
<br />
code by [[User:Dheldt|dheldt]] 08:37, 22 Jun 2005 (CEST)<br />
<br />
== Latex Framework ==<br />
<br />
As a framework where to copy&paste the output to, you can use the following latex code:<br />
<br />
\documentclass[12pt,a4paper]{article}<br />
<br />
\usepackage{umlaut,a4wide,amsmath,amssymb,stmaryrd,color,graphicx,fancyhdr,multicol}<br />
\usepackage[latin1]{inputenc}<br />
\setlength{\parindent}{0mm}<br />
<br />
\begin{document}<br />
<br />
% Copy output here!<br />
<br />
\end{document}<br />
code by [[User:Dheldt|dheldt]] 08:37, 22 Jun 2005 (CEST)<br />
<br />
== CoCoA & POV-Ray Code ==<br />
<br />
This function returns some [http://povray.com POV-Ray] code to plot the quotient ideal of the input ideal (not necessarily zero-dimensional).<br />
The output should be saved into a file called "monomials.inc", in order to be included by QuotienBasis.pov:<br />
<br />
ehm... I don't know how to add code here....<br />
<br />
[[Category:CoCoA4]][[Category:HowTo]]</div>134.146.0.22http://apcocoa.uni-passau.de/wiki/index.php?title=CoCoA_talk:HowTo:Plot_order_ideals&diff=96CoCoA talk:HowTo:Plot order ideals2005-06-22T13:31:49Z<p>134.146.0.22: </p>
<hr />
<div>@ anna:<br />
<br />
1.) to add code simply add to blanks in front of every code line... than you get this nice boxes around the code....<br />
<br />
2.) in case your code uses quotientbasis it works only for zero dimensional ideals, because otherwise quotientbasis failes...<br />
<br />
[[User:134.146.0.22|134.146.0.22]] 15:31, 22 Jun 2005 (CEST)</div>134.146.0.22http://apcocoa.uni-passau.de/wiki/index.php?title=CoCoA:HowTo:Plot_order_ideals&diff=46CoCoA:HowTo:Plot order ideals2005-06-22T07:13:50Z<p>134.146.0.22: </p>
<hr />
<div>==About==<br />
<br />
At the [[SummerSchool05|CoCoA Summer School 2005]] there was a discussion about the possibility to plot order ideals.<br />
An order ideal is simply the complement of an ideal's leading term ideal (ToDo: add more explanation?).<br />
<br />
The question was, if there is any software to visualize this order ideals for polynomial rings in two or three indeterminates. <br />
During the school, first [[User:Bigatti|Anna Bigatti]] and [[User:Dheldt|myself]] developed tools to plot order ideals.<br />
<br />
These tools use [[CoCoA_4|CoCoa 4]] and either [http://povray.com Povray] or Latex. <br />
<br />
The code to plot the order ideals is given in the next sections:<br />
<br />
<br />
== CoCoA & Latex Code (1. Version) ==<br />
<br />
Both functions (this and the next one) get as input a zero-dimensional ideal. The output is some text, containing the latex picture enviroment. simply render this to get a picture of your order ideal. You can even change the point of view<br />
of the model, by changing V1, V2, V3 and L1, L2, L3. How this exactly works can be figured out quite easily, having a look at a latex documentation for the picture enviroment.<br />
<br />
Define BorderTeX(I)<br />
String:='\begin{picture}(300,300)';<br />
<br />
// define your coordinate system:<br />
Offset := Vector(150,150);<br />
V1 := Vector(-1,-1);<br />
V2 := Vector(0,1); <br />
V3 := Vector(1,0);<br />
L1 := 14;<br />
L2 := 20;<br />
L3 := 20;<br />
<br />
// get the Vectorspace-Basis of P/I:<br />
<br />
B := QuotientBasis(I);<br />
<br />
// check what to paint for what Basis Element:<br />
<br />
// Check for all Elements in Basis what to draw:<br />
ForEach El_B In B Do<br />
L := Log(El_B); <br />
Start := Offset + L1*L[1]*V1 + L2*L[2]V2 + L3*L[3]*V3;<br />
<br />
If Not(Indet(1)*Indet(2)*El_B IsIn B) And L[3] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V3[1])+','+Sprint(-V3[2])+'){'+Sprint(L3)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
If Not(Indet(1)*Indet(3)*El_B IsIn B) And L[2] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V2[1])+','+Sprint(-V2[2])+'){'+Sprint(L2)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
If Not(Indet(2)*Indet(3)*El_B IsIn B) And L[1] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V1[1])+','+Sprint(-V1[2])+'){'+Sprint(L1)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
<br />
EndForEach;<br />
<br />
Return String+'\end{picture}';<br />
EndDefine;<br />
<br />
code by [[User:Dheldt|dheldt]] 08:37, 22 Jun 2005 (CEST)<br />
<br />
== CoCoA & Latex Code (2. Version) ==<br />
<br />
I created another version, a little bit more sophisticated. It contains coordinate axis and scales the picture enviroment to the right size. The code for this is:<br />
<br />
Define Border(I)<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// define your coordinate system:<br />
Offset := Vector(150,150);<br />
V1 := Vector(-1,-1); L1 := 14;<br />
V2 := Vector(0,1); L2 := 20;<br />
V3 := Vector(1,0); L3 := 20;<br />
<br />
Max1 := 0;<br />
Max2 := 0;<br />
Max3 := 0;<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// get the Vectorspace-Basis of P/I: <br />
B := QuotientBasis(I);<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// Compute picture's size:<br />
ForEach El_B In B Do<br />
L := Log(El_B); <br />
If L[1] > Max1 Then Max1 := L[1]; EndIf;<br />
If L[2] > Max2 Then Max2 := L[2]; EndIf;<br />
If L[3] > Max3 Then Max3 := L[3]; EndIf;<br />
EndForEach;<br />
<br />
Max1:= Max1 + 1; Max2 := Max2 +1; Max3 := Max3 +1;<br />
<br />
Width := Sum([ Abs(LC((Max1+3)*L1*V1[1])),Abs(LC((Max2+3)*L2*V2[1])),Abs(LC((Max3+3)*L3*V3[1])) ]);<br />
Height := Sum([ Abs(LC((Max1+3)*L1*V1[2])),Abs(LC((Max2+3)*L2*V2[2])),Abs(LC((Max3+3)*L3*V3[2])) ]);<br />
<br />
String:='\begin{picture}('+Sprint(Width)+','+Sprint(Height)+')';<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// Compute Offset / (0,0,0):<br />
Offset:=Vector(Abs(Min([ LC((Max1+3)*L1*V1[1]),LC((Max2+3)*L2*V2[1]),LC((Max3+3)*L3*V3[1])])),<br />
Abs(Min([ LC((Max1+3)*L1*V1[2]),LC((Max2+3)*L2*V2[2]),LC((Max3+3)*L3*V3[2])])));<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// Check for all Elements in Basis what to draw:<br />
ForEach El_B In B Do<br />
L := Log(El_B); <br />
Start := Offset + L1*L[1]*V1 + L2*L[2]V2 + L3*L[3]*V3;<br />
<br />
If Not(Indet(1)*Indet(2)*El_B IsIn B) And L[3] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V3[1])+','+Sprint(-V3[2])+'){'+Sprint(L3)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
If Not(Indet(1)*Indet(3)*El_B IsIn B) And L[2] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V2[1])+','+Sprint(-V2[2])+'){'+Sprint(L2)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
If Not(Indet(2)*Indet(3)*El_B IsIn B) And L[1] > 0 Then<br />
Line := '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\line('+Sprint(-V1[1])+','+Sprint(-V1[2])+'){'+Sprint(L1)+'}}';<br />
String := String + Line;<br />
EndIf; <br />
EndForEach;<br />
<br />
//////////////////////////////////////////////////////////////////////////////<br />
// Draw the three axis and the indeterminates names:<br />
<br />
Start := Offset + Max1 * V1 * L1;<br />
String := String + '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\vector('+Sprint(V1[1])+','+Sprint(V1[2])+'){'+Sprint(2*L1)+'}}';<br />
<br />
String := String + '\put('+Sprint(Start[1]+3*L1*V1[1])+','+Sprint(Start[2]+3*L1*V1[2])+')<br />
{$\displaystyle ' +Sprint(Indet(1))+'$}';<br />
<br />
Start := Offset + Max2 * V2 * L2;<br />
String := String + '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\vector('+Sprint(V2[1])+','+Sprint(V2[2])+'){'+Sprint(2*L2)+'}}';<br />
<br />
String := String + '\put('+Sprint(Start[1]+3*L2*V2[1])+','+Sprint(Start[2]+3*L2*V2[2])+')<br />
{$\displaystyle ' +Sprint(Indet(2))+'$}';<br />
<br />
Start := Offset + Max3 * V3 * L3;<br />
String := String + '\put('+Sprint(Start[1])+','+Sprint(Start[2])+')<br />
{\vector('+Sprint(V3[1])+','+Sprint(V3[2])+'){'+Sprint(2*L3)+'}}';<br />
<br />
String := String + '\put('+Sprint(Start[1]+3*L3*V3[1])+','+Sprint(Start[2]+3*L3*V3[2])+')<br />
{$\displaystyle ' +Sprint(Indet(3))+'$}';<br />
<br />
Return String+'\end{picture}';<br />
EndDefine;<br />
<br />
code by [[User:Dheldt|dheldt]] 08:37, 22 Jun 2005 (CEST)<br />
<br />
== Latex Framework ==<br />
<br />
As a framework where to copy&paste the output to, you can use the following latex code:<br />
<br />
\documentclass[12pt,a4paper]{article}<br />
<br />
\usepackage{umlaut,a4wide,amsmath,amssymb,stmaryrd,color,graphicx,fancyhdr,multicol}<br />
\usepackage[latin1]{inputenc}<br />
\setlength{\parindent}{0mm}<br />
<br />
\begin{document}<br />
<br />
% Copy output here!<br />
<br />
\end{document}<br />
code by [[User:Dheldt|dheldt]] 08:37, 22 Jun 2005 (CEST)<br />
<br />
[[Category:CoCoA4]][[Category:HowTo]]</div>134.146.0.22http://apcocoa.uni-passau.de/wiki/index.php?title=CoCoA:CoCoA_4&diff=49CoCoA:CoCoA 42005-06-21T09:31:34Z<p>134.146.0.22: </p>
<hr />
<div>This is stub. We will add more information shortly.<br />
<br />
at the moment there is the following avaiable for CoCoA 4:<br />
<br />
*[[Building_CoCoA4_On_Windows|Building CoCoA 4 on Windows]]<br />
*[[Building_the_gmp| Building the gmp]]<br />
*[[CoCoA4.4_Buglist| CoCoA 4 Buglist]]<br />
<br />
You can get CoCoA 4 for free at [http://cocoa.dima.unige.it/download/ http://cocoa.dima.unige.it/download/]<br />
<br />
[[Category:CoCoA4]]</div>134.146.0.22http://apcocoa.uni-passau.de/wiki/index.php?title=CoCoA:Building_CoCoA4_On_Windows&diff=30CoCoA:Building CoCoA4 On Windows2005-06-21T09:29:16Z<p>134.146.0.22: </p>
<hr />
<div>== Opening Remarks ==<br />
<br />
Unfortunatly CoCoA 4.4 is not open source. We plan to release an open source reimplementation some time in the future. Still, in order to properly document the process of getting CoCoA 4.4 compiled on Windows this page describes it in all details. Should our windows guy be hit by a bus tomorrow at least somebody else should be able to do some of his work without too much difficulty.<br />
<br />
== Getting the Toolchain installed ==<br />
<br />
Unlike earlier releases of CoCoA the Windows build can be build using the MinGW toolchain. MinGW is the Minimalist GNU for Windows environment. Using this toolchain reduces the need to do platform specific hacks, lets us use the same makefiles (since nmake, the make used by Microsoft Windows C and C++ compiler, is quite different from the standard gnu make) and just reduces the complexity of maintainig the project in general. Not having to pay for Visual Studio is just an added bonus.<br />
<br />
First one needs to install MinGW. The version used when we tried this the last time was 4.1.0. You can get the installer from the [http://www.mingw.org/ MinGW] website. Choose the complete install for the time being, installed it should weigh in around 150MB. Since you probably don't want to use the default Windows command prompt you stall also install MSYS which is a shell that can be used in conjunction with the MinGW tools. You can get MSYS from the [http://www.mingw.org/download.shtml Downloadsection] of the MinGW website. Current version at the time of this writing was 1.0.10, which was less than 3M in size. If the install goes successfully you should end up with an MSYS icon on the desktop. The last package we need is the MSYS Developer Tool Kit, which provide the tools to build the gmp in the next step. Install the package and we are ready to do the next step.<br />
<br />
== Building the gmp ==<br />
<br />
The gmp is the GNU Multiple Precision Arithmetic Library. Since compiling the library is pretty much the same procedure on all of the platforms we build CoCoA on check out [[Building_the_gmp]] on instructions how to do it.<br />
<br />
== Building QT ==<br />
<br />
Due to its closed source nature you need a commercial qt license to build CoCoA 4.4. Since you have the sources you probably know the right person in the CoCoA project to get that licensing information and the needed setup files. When building qt on Windows stick with the defaults. Make sure to use MinGW as your compiler if you have more compilers installed.<br />
<br />
== Bugs ==<br />
<br />
For a list check out [[CoCoA4.4_Buglist]]<br />
<br />
== ToDo ==<br />
<br />
* Finish page [[User:Mabshoff|Mabshoff]] 11:20, 21 Jun 2005 (CEST)<br />
<br />
[[Category:CoCoA4]]</div>134.146.0.22http://apcocoa.uni-passau.de/wiki/index.php?title=CoCoALib:CoCoALib_and_Cygwin_FAQ&diff=15CoCoALib:CoCoALib and Cygwin FAQ2005-06-21T06:30:14Z<p>134.146.0.22: /* Compiling CoCoALib */</p>
<hr />
<div>(just a first dirty test how to set up a page....)<br />
<br />
== Opening Remarks ==<br />
<br />
This document was written with the 0.92 release of CoCoALib in mind. Much of it will probably directly apply to future versions of CoCoALib, but as differences will crop up expect an update to this document.<br />
<br />
CoCoALib is primarily developed on Linux and MaxOSX, while some testing is done on a variety of commercial and free UNIX platforms, mainly Solaris at the moment. Since Microsoft Windows is the dominant desktop operating system at the time we also try to support it. Unfortunetly, Microsoft Windows does not properly support many of the APIs directly, so we use cygwin to compile CoCoALib on Windows. This may change in the future since there is an attempt under way to replace the platform specific code, i.e. fork() and BSD-sockets, with a cross-platform library, so that our code will just compile using MSCV or the Intel compiler out of the box on Windows too. But there are still some issues to be worked out. Anybody who has ever tried to compile the gmp with MSVC can tell that it isn't a feat done easily since there is little support for the autotools on Windows. Plenty of info regarding this is available in the archives of the gmp mailing list.<br />
<br />
In this document We assume that you know how to use basic tools like compression utilities and are able to start programs by clicking on some icon. Since CoCoALib is written in C++ one can assume that those skills will be available to you.<br />
<br />
Ok, now that we got the opening remarks out of the way we will first go on to install all the required software, i.e. cygwin, first.<br />
<br />
Feedback, improvements and suggestions are always welcome to make this document better. If you would like to contribute please send an email to Michael.Abshoff(at)math.uni-dortmund.de. Since I get lots of spam and also have a high volume of mail traffic from mailing lists please make sure that the subject of your email contains something like [CoCoALib] in order to raise my attention. An empty subject will pretty much ensure that your email will be deleted without reading.<br />
<br />
Michael Abshoff, University of Dortmund<br />
<br />
== Installing Cygwin ==<br />
<br />
Go to http://www.cygwin.com/ and get setup.exe. At the moment of writing this document the current version was 1.5.17-1. Start setup.exe and install it to C:\cygwin (with default settings). Besides the default packages select<br />
<br />
* automake1.9<br />
* gcc-g++<br />
* make<br />
<br />
from the devel-section. These packages will enable you to compile the gmp library and CoCoALib.<br />
<br />
== Getting and compiling gmp ==<br />
<br />
Get gmp-4.1.4 from http://www.swox.com/gmp/ (since GMP 4.1.3 contains a critical bug affecting CoCoA::RingFloat). Unpack to /home/Administrator/ which translates to C:\cygwin\home\Administrator. Change to /home/Administrator/gmp-4.1.4. Now we have to configure gmp by typing<br />
<br />
Administrator@sprocket ~/gmp-4.1.4<br />
$ ./configure --prefix=/home/Administrator/gmp-4.1.4-static --enable-static<br />
<br />
Lots of stuff scrolls by, when finished it should look something like:<br />
<br />
checking build system type... athlon-pc-cygwin<br />
checking host system type... athlon-pc-cygwin<br />
checking for a BSD compatible install... /usr/bin/install -c<br />
...<br />
config.status: linking ./mpn/x86/k7/mmx/copyi.asm to mpn/copyi.asm<br />
config.status: linking ./mpn/x86/k7/mmx/copyd.asm to mpn/copyd.asm<br />
config.status: linking ./mpn/x86/k7/mmx/com_n.asm to mpn/com_n.asm<br />
config.status: linking ./mpn/x86/k7/gmp-mparam.h to gmp-mparam.h<br />
<br />
Ok, now enter "make", wait a while and enter "make install" and the gmp should build. Take a look into /home/Administrator/gmp-4.1.4-static and you should see something like<br />
<br />
Administrator@sprocket ~/gmp-4.1.4-static<br />
$ ls -al<br />
total 8<br />
drwxr-xr-x+ 5 Administrator Kein 0 Jun 8 13:55 .<br />
drwxrwxrwx+ 4 Administrator Kein 4096 Jun 8 13:55 ..<br />
drwxr-xr-x+ 2 Administrator Kein 0 Jun 8 13:55 include<br />
drwxr-xr-x+ 2 Administrator Kein 4096 Jun 8 13:55 info<br />
drwxr-xr-x+ 2 Administrator Kein 0 Jun 8 13:55 lib<br />
<br />
Ok, now we have the required library to buid CoCoALib. If you encounter problems when building the gmp you can always do a "make check" to verify that the gmp is working correctly on your platform. Since the gmp is well tested on cygwin this seems rather unlikely, though.<br />
<br />
== Compiling CoCoALib ==<br />
<br />
Get the CoCoALib and unpack it to /home/Administrator, using cygwin's tar and gunzip command (using winzip or other windows tools can lead to errors, reasoned in the different handling of newlines). Yoou will find a directory called CoCoALib-0.92. Before we compile we have to do some minor tweaks to the common.mki and src/Makefile-dependencies. Since those files were written on Linux use an editor that can handle those kinds if line-breaks (Emacs works, notepad doesn't) Open common.mki. We have to tell make where the gmp can be found. If you did everything as above enter:<br />
<br />
GMP_LIB=/home/Administrator/gmp-4.1.4-static/lib/libgmp.a # win32-cygwin<br />
GMP_INCLUDE=-I/home/Administrator/gmp-4.1.4-static/include # win32-cygwin<br />
<br />
and make sure that<br />
<br />
# Optimized -- for the final version<br />
OPTFLAGS = -O2 <br />
<br />
is not commented out and that<br />
<br />
# Normal (Debug And Leaks)<br />
# OPTFLAGS = -O2 -g -DCoCoA_DEBUG -DCoCoA_MEMPOOL_DEBUG=1<br />
<br />
is commented out since performance will otherwise be not as good as it could be. Now open src/Makefiledependecies. Replace line 76 with the line<br />
<br />
echo -n " $(COCOA_ROOT)/src/$$ofile" >> Makefile_dependencies; \<br />
<br />
i.e. remove the "-e" option from the echo command since cygwin's echo doesn't know that option and will produce a faulty makefile. Make alsio sure that the "$" before "(COCOA_ROOT)" is there since at least on my Windows-Box there was the character "\044" (FIXME: issue with code-pages?) Anyways, you can find the source with the modifications in fsmath.mathematik.uni-dortmund.de/~mabshoff/CoCoA/misc/CoCoALib-0.92-cyg.tar.gz After we are done with the modifications change to /home/Administrator/CoCoALib-0.92 and type<br />
<br />
make library<br />
<br />
This will take a while and you get:<br />
<br />
Administrator@sprocket ~/CoCoALib-0.92<br />
$ make library<br />
COMPILING THE COCOA LIBRARY -- this may take some time<br />
Rebuilding Makefile_dependencies in directory COCOA_ROOT/src<br />
Compiling cputime.o<br />
Compiling config.o<br />
...<br />
Compiling PPMonoidEvOv.o<br />
Compiling OpenMath.o<br />
Compiling OpenMathXML.o<br />
COMPILATION OF THE COCOA LIBRARY COMPLETED<br />
<br />
Ok, now CoCoAlib has been successfully build and can be found in lib/libcocoa.a. Now we want to make sure that everything is working properly. To do that we type in<br />
<br />
make check<br />
<br />
and CoCoALib will build a number of tests and runs those. Output will look like<br />
<br />
$ make check<br />
make[1]: Entering directory `/home/Administrator/CoCoALib-0.92'<br />
COMPILING THE COCOA LIBRARY -- this may take some time<br />
COMPILATION OF THE COCOA LIBRARY COMPLETED<br />
make[1]: Leaving directory `/home/Administrator/CoCoALib-0.92'<br />
Makefile:119: Makefile_dependencies: No such file or directory<br />
Compiling and running the CoCoA Test suite...<br />
Compiling test-RingZ1<br />
...<br />
Compiling test-RingHom2<br />
Compiling test-bug1<br />
Running test-RingZ1...OK<br />
Running test-RingZmodN1...OK<br />
...<br />
Running test-RingHom2...OK<br />
Running test-bug1...OK<br />
===========================<br />
Good news: all tests passed<br />
===========================<br />
<br />
CoCoA test completed -- tidying up.<br />
Cleaning directory COCOA_ROOT/src/tests<br />
<br />
Now everything works and one can start to develop software with CoCoALib.<br />
<br />
==ToDo==<br />
<br />
*add section regarding binmode</div>134.146.0.22http://apcocoa.uni-passau.de/wiki/index.php?title=CoCoA_talk:CoCoA5_Faq&diff=1404CoCoA talk:CoCoA5 Faq2005-06-21T06:28:10Z<p>134.146.0.22: </p>
<hr />
<div>Hi. I think here should be a more generous FAQ about CoCoA 5, leading to different special aspects. <br />
I added [[CoCoA Lib 5 and Cygwin FAQ]] and put in your text... I will write it in a nice way this eveening....<br />
please add the texts as mabshoff, not as admin :) <br />
<br />
regards,<br />
<br />
daniel<br />
<br />
-- <br />
<br />
Ok, as Karsten requested I corrected some of the structual issues. We are all still learning. What's the best way to do a verbatim section, i.e. code listing or console output?<br />
<br />
I agree about the extend of the FAQ. I am currently working on 4.4 on Windows. I would suggest breaking out the stuff about the gmp since that info applies to CoCoA 4 as well as the CoCoALib on all platforms.<br />
<br />
Michael<br />
<br />
--<br />
<br />
I would not break the gmp infos out. you need it to install the lib on that specific plattform. otherwise you have to look at different locations to collect everything you need, so it's better to leave it in the FAQ.</div>134.146.0.22