OSDN Git Service

solver
authorunknown <hskwk@.(none)>
Wed, 18 Aug 2010 08:32:11 +0000 (17:32 +0900)
committerunknown <hskwk@.(none)>
Wed, 18 Aug 2010 08:32:11 +0000 (17:32 +0900)
dev4/PsychlopsSilverlight4.csproj
dev4/WriteableBitmapEx/Readme.txt
dev4/WriteableBitmapEx/WriteableBitmapEx.XML
dev4/WriteableBitmapEx/WriteableBitmapEx.dll
dev4/WriteableBitmapEx/WriteableBitmapEx.pdb
dev4/psychlops/core/math/util.cs
dev4/psychlops/extention/math/solver.cs
test4/PsychlopsMain.cs
test4/PsychlopsSilverlight4test.csproj

index 481803c..63125e6 100644 (file)
     <Reference Include="mscorlib" />\r
     <Reference Include="system" />\r
     <Reference Include="System.Core" />\r
+    <Reference Include="System.Windows.Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />\r
     <Reference Include="System.Windows.Controls.Data, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />\r
+    <Reference Include="System.Windows.Controls.DataVisualization.Toolkit, Version=4.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />\r
+    <Reference Include="System.Windows.Controls.Toolkit, Version=4.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />\r
     <Reference Include="System.Xml" />\r
     <Reference Include="System.Net" />\r
     <Reference Include="System.Windows.Browser" />\r
@@ -63,6 +66,9 @@
     </Reference>\r
   </ItemGroup>\r
   <ItemGroup>\r
+    <Compile Include="Pages\BinomialSolver.xaml.cs">\r
+      <DependentUpon>BinomialSolver.xaml</DependentUpon>\r
+    </Compile>\r
     <Compile Include="Properties\AssemblyInfo.cs" />\r
     <Compile Include="psychlops\core\app\app.cs" />\r
     <Compile Include="psychlops\core\app\misc.cs" />\r
     <Compile Include="psychlops\psychlops.cs" />\r
     <Compile Include="psychlops\core\graphic\shape.cs" />\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <Page Include="Pages\BinomialSolver.xaml">\r
+      <SubType>Designer</SubType>\r
+      <Generator>MSBuild:Compile</Generator>\r
+    </Page>\r
+  </ItemGroup>\r
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index d271870..9165bc1 100644 (file)
@@ -1,8 +1,8 @@
 Description\r
 °°°°°°°°°°°\r
 \r
-The WriteableBitmapEx library is a collection of extension methods for Silverlight's WriteableBitmap. The WriteableBitmap class was added in Silverlight 3. It allows the direct manipulation of a bitmap and could be used to generate fast procedural images by drawing directly to a bitmap. The WriteableBitmap API is very minimalistic and there's only the raw Pixels array for such operations. The WriteableBitmapEx library tries to compensate that with extensions methods that are easy to use like built in methods. The library extends the WriteableBitmap class with elementary (2D drawing) functionality, supporting common shapes like point, line, ellipse, polyline, quad, rectangle, triangle, cubic Beziér and Cardinal spline. Conversion methods and functions to combine WriteableBitmaps (Blitting) are part of it too\r
-It is possible to use the built assembly that contains all extension methods or just specific methods by using the source CS files directly. The extension methods are grouped into multiple CS files.\r
+The WriteableBitmapEx library is a collection of extension methods for Silverlight's WriteableBitmap. The WriteableBitmap class that was added in Silverlight 3, allows the direct manipulation of a bitmap and could be used to generate fast procedural images by drawing directly to a bitmap. The WriteableBitmap API is very minimalistic and there's only the raw Pixels array for such operations. The WriteableBitmapEx library tries to compensate that with extensions methods that are easy to use like built in methods and offer GDI+ like functionality. The library extends the WriteableBitmap class with elementary and fast (2D drawing) functionality, conversion methods and functions to combine (blit) WriteableBitmaps\r
+The extension methods are grouped into different CS files with a partial class. It is possible to include just a few methods by using the specific source CS files directly or all extension methods through the built library assembly.\r
 \r
 See http://writeablebitmapex.codeplex.com\r
 \r
index 5d8eaeb..a307dd7 100644 (file)
@@ -6,9 +6,6 @@
     <members>\r
         <member name="T:System.Windows.Media.Imaging.WriteableBitmapExtensions">\r
             <summary>\r
-            Collection of blit (copy) extension methods for the Silverlight WriteableBitmap class.\r
-            </summary>\r
-            <summary>\r
             Collection of interchange extension methods for the Silverlight WriteableBitmap class.\r
             </summary>\r
             <summary>\r
             Collection of draw extension methods for the Silverlight WriteableBitmap class.\r
             </summary>\r
             <summary>\r
-            Collection of draw spline extension methods for the Silverlight WriteableBitmap class.\r
+            Collection of blit (copy) extension methods for the Silverlight WriteableBitmap class.\r
             </summary>\r
-        </member>\r
-        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.Blit(System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode)">\r
             <summary>\r
-            Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).\r
+            Collection of draw extension methods for the Silverlight WriteableBitmap class.\r
             </summary>\r
-            <param name="bmp">The destination WriteableBitmap.</param>\r
-            <param name="destRect">The rectangle that defines the destination region.</param>\r
-            <param name="source">The source WriteableBitmap.</param>\r
-            <param name="sourceRect">The rectangle that will be copied from the source to the destination.</param>\r
-            <param name="BlendMode">The blending mode <see cref="T:System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode"/>.</param>\r
-        </member>\r
-        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.Blit(System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect)">\r
             <summary>\r
-            Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).\r
+            Collection of draw spline extension methods for the Silverlight WriteableBitmap class.\r
             </summary>\r
-            <param name="bmp">The destination WriteableBitmap.</param>\r
-            <param name="destRect">The rectangle that defines the destination region.</param>\r
-            <param name="source">The source WriteableBitmap.</param>\r
-            <param name="sourceRect">The rectangle that will be copied from the source to the destination.</param>\r
-        </member>\r
-        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.Blit(System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Point,System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Color,System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode)">\r
             <summary>\r
-            Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).\r
+            Collection of transformation extension methods for the Silverlight WriteableBitmap class.\r
             </summary>\r
-            <param name="bmp">The destination WriteableBitmap.</param>\r
-            <param name="destPosition">The destination position in the destination bitmap.</param>\r
-            <param name="source">The source WriteableBitmap.</param>\r
-            <param name="sourceRect">The rectangle that will be copied from the source to the destination.</param>\r
-            <param name="color">If not Colors.White, will tint the source image. A partially transparent color and the image will be drawn partially transparent.</param>\r
-            <param name="BlendMode">The blending mode <see cref="T:System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode"/>.</param>\r
-        </member>\r
-        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.Blit(System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Color,System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode)">\r
-            <summary>\r
-            Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).\r
-            </summary>\r
-            <param name="bmp">The destination WriteableBitmap.</param>\r
-            <param name="destRect">The rectangle that defines the destination region.</param>\r
-            <param name="source">The source WriteableBitmap.</param>\r
-            <param name="sourceRect">The rectangle that will be copied from the source to the destination.</param>\r
-            <param name="color">If not Colors.White, will tint the source image. A partially transparent color and the image will be drawn partially transparent.</param>\r
-            <param name="BlendMode">The blending mode <see cref="T:System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode"/>.</param>\r
         </member>\r
         <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.ToByteArray(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32)">\r
             <summary>\r
         </member>\r
         <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FromByteArray(System.Windows.Media.Imaging.WriteableBitmap,System.Byte[],System.Int32,System.Int32)">\r
             <summary>\r
-            Copies color information from an ARGB byte array into the WriteableBitmap starting at a specific buffer index.\r
+            Copies color information from an ARGB byte array into this WriteableBitmap starting at a specific buffer index.\r
             </summary>\r
             <param name="bmp">The WriteableBitmap.</param>\r
             <param name="offset">The starting index in the buffer.</param>\r
             <param name="count">The number of bytes to copy from the buffer.</param>\r
             <param name="buffer">The color buffer as byte ARGB values.</param>\r
+            <returns>The WriteableBitmap that was passed as parameter.</returns>\r
         </member>\r
         <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FromByteArray(System.Windows.Media.Imaging.WriteableBitmap,System.Byte[],System.Int32)">\r
             <summary>\r
-            Copies color information from an ARGB byte array into the WriteableBitmap.\r
+            Copies color information from an ARGB byte array into this WriteableBitmap.\r
             </summary>\r
             <param name="bmp">The WriteableBitmap.</param>\r
             <param name="count">The number of bytes to copy from the buffer.</param>\r
             <param name="buffer">The color buffer as byte ARGB values.</param>\r
+            <returns>The WriteableBitmap that was passed as parameter.</returns>\r
         </member>\r
         <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FromByteArray(System.Windows.Media.Imaging.WriteableBitmap,System.Byte[])">\r
             <summary>\r
-            Copies all the color information from an ARGB byte array into the WriteableBitmap.\r
+            Copies all the color information from an ARGB byte array into this WriteableBitmap.\r
             </summary>\r
             <param name="bmp">The WriteableBitmap.</param>\r
             <param name="buffer">The color buffer as byte ARGB values.</param>\r
+            <returns>The WriteableBitmap that was passed as parameter.</returns>\r
         </member>\r
         <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.WriteTga(System.Windows.Media.Imaging.WriteableBitmap,System.IO.Stream)">\r
             <summary>\r
             <param name="bmp">The WriteableBitmap.</param>\r
             <param name="destination">The destination stream.</param>\r
         </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FromResource(System.Windows.Media.Imaging.WriteableBitmap,System.String)">\r
+            <summary>\r
+            Loads an image from the applications resource file and fills this WriteableBitmap with it.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="relativePath">Only the relative path to the resource file. The assembly name is retrieved automatically.</param>\r
+            <returns>The WriteableBitmap that was passed as parameter.</returns>\r
+        </member>\r
         <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.DrawLineBresenham(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Windows.Media.Color)">\r
             <summary>\r
             Draws a colored line by connecting two points using the Bresenham algorithm.\r
             <param name="bmp">The WriteableBitmap.</param>\r
             <param name="func">The function to apply. With parameters x, y, source color and a color as a result</param>\r
         </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.GetPixeli(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32)">\r
+            <summary>\r
+            Gets the color of the pixel at the x, y coordinate as integer.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="x">The x coordinate of the pixel.</param>\r
+            <param name="y">The y coordinate of the pixel.</param>\r
+            <returns>The color of the pixel at x, y.</returns>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.GetPixel(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32)">\r
+            <summary>\r
+            Gets the color of the pixel at the x, y coordinate as a Color struct.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="x">The x coordinate of the pixel.</param>\r
+            <param name="y">The y coordinate of the pixel.</param>\r
+            <returns>The color of the pixel at x, y as a Color struct.</returns>\r
+        </member>\r
         <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.SetPixeli(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Byte,System.Byte,System.Byte)">\r
             <summary>\r
             Sets the color of the pixel using a precalculated index (faster).\r
             <param name="y">The y coordinate (column).</param>\r
             <param name="color">The color.</param>\r
         </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.Blit(System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode)">\r
+            <summary>\r
+            Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).\r
+            </summary>\r
+            <param name="bmp">The destination WriteableBitmap.</param>\r
+            <param name="destRect">The rectangle that defines the destination region.</param>\r
+            <param name="source">The source WriteableBitmap.</param>\r
+            <param name="sourceRect">The rectangle that will be copied from the source to the destination.</param>\r
+            <param name="BlendMode">The blending mode <see cref="T:System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode"/>.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.Blit(System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect)">\r
+            <summary>\r
+            Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).\r
+            </summary>\r
+            <param name="bmp">The destination WriteableBitmap.</param>\r
+            <param name="destRect">The rectangle that defines the destination region.</param>\r
+            <param name="source">The source WriteableBitmap.</param>\r
+            <param name="sourceRect">The rectangle that will be copied from the source to the destination.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.Blit(System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Point,System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Color,System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode)">\r
+            <summary>\r
+            Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).\r
+            </summary>\r
+            <param name="bmp">The destination WriteableBitmap.</param>\r
+            <param name="destPosition">The destination position in the destination bitmap.</param>\r
+            <param name="source">The source WriteableBitmap.</param>\r
+            <param name="sourceRect">The rectangle that will be copied from the source to the destination.</param>\r
+            <param name="color">If not Colors.White, will tint the source image. A partially transparent color and the image will be drawn partially transparent.</param>\r
+            <param name="BlendMode">The blending mode <see cref="T:System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode"/>.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.Blit(System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect,System.Windows.Media.Color,System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode)">\r
+            <summary>\r
+            Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).\r
+            </summary>\r
+            <param name="bmp">The destination WriteableBitmap.</param>\r
+            <param name="destRect">The rectangle that defines the destination region.</param>\r
+            <param name="source">The source WriteableBitmap.</param>\r
+            <param name="sourceRect">The rectangle that will be copied from the source to the destination.</param>\r
+            <param name="color">If not Colors.White, will tint the source image. A partially transparent color and the image will be drawn partially transparent.</param>\r
+            <param name="BlendMode">The blending mode <see cref="T:System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode"/>.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillRectangle(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Windows.Media.Color)">\r
+            <summary>\r
+            Draws a filled rectangle.\r
+            x2 has to be greater than x1 and y2 has to be greater than y1.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="x1">The x-coordinate of the bounding rectangle's left side.</param>\r
+            <param name="y1">The y-coordinate of the bounding rectangle's top side.</param>\r
+            <param name="x2">The x-coordinate of the bounding rectangle's right side.</param>\r
+            <param name="y2">The y-coordinate of the bounding rectangle's bottom side.</param>\r
+            <param name="color">The color.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillRectangle(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)">\r
+            <summary>\r
+            Draws a filled rectangle.\r
+            x2 has to be greater than x1 and y2 has to be greater than y1.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="x1">The x-coordinate of the bounding rectangle's left side.</param>\r
+            <param name="y1">The y-coordinate of the bounding rectangle's top side.</param>\r
+            <param name="x2">The x-coordinate of the bounding rectangle's right side.</param>\r
+            <param name="y2">The y-coordinate of the bounding rectangle's bottom side.</param>\r
+            <param name="color">The color.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillEllipse(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Windows.Media.Color)">\r
+            <summary>\r
+            A Fast Bresenham Type Algorithm For Drawing filled ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf \r
+            x2 has to be greater than x1 and y2 has to be greater than y1.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="x1">The x-coordinate of the bounding rectangle's left side.</param>\r
+            <param name="y1">The y-coordinate of the bounding rectangle's top side.</param>\r
+            <param name="x2">The x-coordinate of the bounding rectangle's right side.</param>\r
+            <param name="y2">The y-coordinate of the bounding rectangle's bottom side.</param>\r
+            <param name="color">The color for the line.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillEllipse(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)">\r
+            <summary>\r
+            A Fast Bresenham Type Algorithm For Drawing filled ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf \r
+            x2 has to be greater than x1 and y2 has to be greater than y1.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="x1">The x-coordinate of the bounding rectangle's left side.</param>\r
+            <param name="y1">The y-coordinate of the bounding rectangle's top side.</param>\r
+            <param name="x2">The x-coordinate of the bounding rectangle's right side.</param>\r
+            <param name="y2">The y-coordinate of the bounding rectangle's bottom side.</param>\r
+            <param name="color">The color for the line.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillEllipseCentered(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Windows.Media.Color)">\r
+            <summary>\r
+            A Fast Bresenham Type Algorithm For Drawing filled ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf \r
+            Uses a different parameter representation than DrawEllipse().\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="xc">The x-coordinate of the ellipses center.</param>\r
+            <param name="yc">The y-coordinate of the ellipses center.</param>\r
+            <param name="xr">The radius of the ellipse in x-direction.</param>\r
+            <param name="yr">The radius of the ellipse in y-direction.</param>\r
+            <param name="color">The color for the line.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillEllipseCentered(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)">\r
+            <summary>\r
+            A Fast Bresenham Type Algorithm For Drawing filled ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf \r
+            Uses a different parameter representation than DrawEllipse().\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="xc">The x-coordinate of the ellipses center.</param>\r
+            <param name="yc">The y-coordinate of the ellipses center.</param>\r
+            <param name="xr">The radius of the ellipse in x-direction.</param>\r
+            <param name="yr">The radius of the ellipse in y-direction.</param>\r
+            <param name="color">The color for the line.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillPolygon(System.Windows.Media.Imaging.WriteableBitmap,System.Int32[],System.Windows.Media.Color)">\r
+            <summary>\r
+            Draws a filled polygon. Add the first point also at the end of the array if the line should be closed.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="points">The points of the polygon in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, ..., xn, yn).</param>\r
+            <param name="color">The color for the line.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillPolygon(System.Windows.Media.Imaging.WriteableBitmap,System.Int32[],System.Int32)">\r
+            <summary>\r
+            Draws a filled polygon. Add the first point also at the end of the array if the line should be closed.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="points">The points of the polygon in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, ..., xn, yn).</param>\r
+            <param name="color">The color for the line.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillQuad(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Windows.Media.Color)">\r
+            <summary>\r
+            Draws a filled quad.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="x1">The x-coordinate of the 1st point.</param>\r
+            <param name="y1">The y-coordinate of the 1st point.</param>\r
+            <param name="x2">The x-coordinate of the 2nd point.</param>\r
+            <param name="y2">The y-coordinate of the 2nd point.</param>\r
+            <param name="x3">The x-coordinate of the 3rd point.</param>\r
+            <param name="y3">The y-coordinate of the 3rd point.</param>\r
+            <param name="x4">The x-coordinate of the 4th point.</param>\r
+            <param name="y4">The y-coordinate of the 4th point.</param>\r
+            <param name="color">The color.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillQuad(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)">\r
+            <summary>\r
+            Draws a filled quad.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="x1">The x-coordinate of the 1st point.</param>\r
+            <param name="y1">The y-coordinate of the 1st point.</param>\r
+            <param name="x2">The x-coordinate of the 2nd point.</param>\r
+            <param name="y2">The y-coordinate of the 2nd point.</param>\r
+            <param name="x3">The x-coordinate of the 3rd point.</param>\r
+            <param name="y3">The y-coordinate of the 3rd point.</param>\r
+            <param name="x4">The x-coordinate of the 4th point.</param>\r
+            <param name="y4">The y-coordinate of the 4th point.</param>\r
+            <param name="color">The color.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillTriangle(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Windows.Media.Color)">\r
+            <summary>\r
+            Draws a filled triangle.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="x1">The x-coordinate of the 1st point.</param>\r
+            <param name="y1">The y-coordinate of the 1st point.</param>\r
+            <param name="x2">The x-coordinate of the 2nd point.</param>\r
+            <param name="y2">The y-coordinate of the 2nd point.</param>\r
+            <param name="x3">The x-coordinate of the 3rd point.</param>\r
+            <param name="y3">The y-coordinate of the 3rd point.</param>\r
+            <param name="color">The color.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillTriangle(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)">\r
+            <summary>\r
+            Draws a filled triangle.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="x1">The x-coordinate of the 1st point.</param>\r
+            <param name="y1">The y-coordinate of the 1st point.</param>\r
+            <param name="x2">The x-coordinate of the 2nd point.</param>\r
+            <param name="y2">The y-coordinate of the 2nd point.</param>\r
+            <param name="x3">The x-coordinate of the 3rd point.</param>\r
+            <param name="y3">The y-coordinate of the 3rd point.</param>\r
+            <param name="color">The color.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.ComputeBezierPoints(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32[],System.Int32,System.Int32)">\r
+            <summary>\r
+            Draws a filled, cubic Beziér spline defined by start, end and two control points.\r
+            </summary>\r
+            <param name="x1">The x-coordinate of the start point.</param>\r
+            <param name="y1">The y-coordinate of the start point.</param>\r
+            <param name="cx1">The x-coordinate of the 1st control point.</param>\r
+            <param name="cy1">The y-coordinate of the 1st control point.</param>\r
+            <param name="cx2">The x-coordinate of the 2nd control point.</param>\r
+            <param name="cy2">The y-coordinate of the 2nd control point.</param>\r
+            <param name="x2">The x-coordinate of the end point.</param>\r
+            <param name="y2">The y-coordinate of the end point.</param>\r
+            <param name="color">The color.</param>\r
+            <param name="pixels">The pixels array.</param>\r
+            <param name="w">The width of the bitmap.</param>\r
+            <param name="h">The height of the bitmap.</param> \r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillBeziers(System.Windows.Media.Imaging.WriteableBitmap,System.Int32[],System.Windows.Media.Color)">\r
+            <summary>\r
+            Draws a series of filled, cubic Beziér splines each defined by start, end and two control points. \r
+            The ending point of the previous curve is used as starting point for the next. \r
+            Therfore the inital curve needs four points and the subsequent 3 (2 control and 1 end point).\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="points">The points for the curve in x and y pairs, therefore the array is interpreted as (x1, y1, cx1, cy1, cx2, cy2, x2, y2, cx3, cx4 ..., xn, yn).</param>\r
+            <param name="color">The color for the spline.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillBeziers(System.Windows.Media.Imaging.WriteableBitmap,System.Int32[],System.Int32)">\r
+            <summary>\r
+            Draws a series of filled, cubic Beziér splines each defined by start, end and two control points. \r
+            The ending point of the previous curve is used as starting point for the next. \r
+            Therfore the inital curve needs four points and the subsequent 3 (2 control and 1 end point).\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="points">The points for the curve in x and y pairs, therefore the array is interpreted as (x1, y1, cx1, cy1, cx2, cy2, x2, y2, cx3, cx4 ..., xn, yn).</param>\r
+            <param name="color">The color for the spline.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.ComputeSegmentPoints(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Single,System.Int32,System.Int32[],System.Int32,System.Int32)">\r
+            <summary>\r
+            Computes the discrete segment points of a Cardinal spline (cubic) defined by four control points.\r
+            </summary>\r
+            <param name="x1">The x-coordinate of the 1st control point.</param>\r
+            <param name="y1">The y-coordinate of the 1st control point.</param>\r
+            <param name="x2">The x-coordinate of the 2nd control point.</param>\r
+            <param name="y2">The y-coordinate of the 2nd control point.</param>\r
+            <param name="x3">The x-coordinate of the 3rd control point.</param>\r
+            <param name="y3">The y-coordinate of the 3rd control point.</param>\r
+            <param name="x4">The x-coordinate of the 4th control point.</param>\r
+            <param name="y4">The y-coordinate of the 4th control point.</param>\r
+            <param name="tension">The tension of the curve defines the shape. Usually between 0 and 1. 0 would be a straight line.</param>\r
+            <param name="color">The color.</param>\r
+            <param name="pixels">The pixels array.</param>\r
+            <param name="w">The width of the bitmap.</param>\r
+            <param name="h">The height of the bitmap.</param> \r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillCurve(System.Windows.Media.Imaging.WriteableBitmap,System.Int32[],System.Single,System.Windows.Media.Color)">\r
+            <summary>\r
+            Draws a filled Cardinal spline (cubic) defined by a point collection. \r
+            The cardinal spline passes through each point in the collection.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="points">The points for the curve in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, x3, y3, x4, y4, x1, x2 ..., xn, yn).</param>\r
+            <param name="tension">The tension of the curve defines the shape. Usually between 0 and 1. 0 would be a straight line.</param>\r
+            <param name="color">The color for the spline.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillCurve(System.Windows.Media.Imaging.WriteableBitmap,System.Int32[],System.Single,System.Int32)">\r
+            <summary>\r
+            Draws a filled Cardinal spline (cubic) defined by a point collection. \r
+            The cardinal spline passes through each point in the collection.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="points">The points for the curve in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, x3, y3, x4, y4, x1, x2 ..., xn, yn).</param>\r
+            <param name="tension">The tension of the curve defines the shape. Usually between 0 and 1. 0 would be a straight line.</param>\r
+            <param name="color">The color for the spline.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillCurveClosed(System.Windows.Media.Imaging.WriteableBitmap,System.Int32[],System.Single,System.Windows.Media.Color)">\r
+            <summary>\r
+            Draws a filled, closed Cardinal spline (cubic) defined by a point collection. \r
+            The cardinal spline passes through each point in the collection.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="points">The points for the curve in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, x3, y3, x4, y4, x1, x2 ..., xn, yn).</param>\r
+            <param name="tension">The tension of the curve defines the shape. Usually between 0 and 1. 0 would be a straight line.</param>\r
+            <param name="color">The color for the spline.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.FillCurveClosed(System.Windows.Media.Imaging.WriteableBitmap,System.Int32[],System.Single,System.Int32)">\r
+            <summary>\r
+            Draws a filled, closed Cardinal spline (cubic) defined by a point collection. \r
+            The cardinal spline passes through each point in the collection.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="points">The points for the curve in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, x3, y3, x4, y4, x1, x2 ..., xn, yn).</param>\r
+            <param name="tension">The tension of the curve defines the shape. Usually between 0 and 1. 0 would be a straight line.</param>\r
+            <param name="color">The color for the spline.</param>\r
+        </member>\r
         <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.DrawBezier(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Windows.Media.Color)">\r
             <summary>\r
             Draws a cubic Beziér spline defined by start, end and two control points.\r
             <param name="points">The points for the curve in x and y pairs, therefore the array is interpreted as (x1, y1, cx1, cy1, cx2, cy2, x2, y2, cx3, cx4 ..., xn, yn).</param>\r
             <param name="color">The color for the spline.</param>\r
         </member>\r
-        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.DrawCurve(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Single,System.Int32)">\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.DrawCurveSegment(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Single,System.Int32,System.Int32[],System.Int32,System.Int32)">\r
             <summary>\r
-            Draws a Cardinal spline (cubic) defined by four control points.\r
+            Draws a segment of a Cardinal spline (cubic) defined by four control points.\r
             </summary>\r
-            <param name="bmp">The WriteableBitmap.</param>\r
             <param name="x1">The x-coordinate of the 1st control point.</param>\r
             <param name="y1">The y-coordinate of the 1st control point.</param>\r
             <param name="x2">The x-coordinate of the 2nd control point.</param>\r
             <param name="y4">The y-coordinate of the 4th control point.</param>\r
             <param name="tension">The tension of the curve defines the shape. Usually between 0 and 1. 0 would be a straight line.</param>\r
             <param name="color">The color.</param>\r
+            <param name="pixels">The pixels array.</param>\r
+            <param name="w">The width of the bitmap.</param>\r
+            <param name="h">The height of the bitmap.</param> \r
         </member>\r
         <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.DrawCurve(System.Windows.Media.Imaging.WriteableBitmap,System.Int32[],System.Single,System.Windows.Media.Color)">\r
             <summary>\r
             <param name="tension">The tension of the curve defines the shape. Usually between 0 and 1. 0 would be a straight line.</param>\r
             <param name="color">The color for the spline.</param>\r
         </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.DrawCurveClosed(System.Windows.Media.Imaging.WriteableBitmap,System.Int32[],System.Single,System.Windows.Media.Color)">\r
+            <summary>\r
+            Draws a closed Cardinal spline (cubic) defined by a point collection. \r
+            The cardinal spline passes through each point in the collection.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="points">The points for the curve in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, x3, y3, x4, y4, x1, x2 ..., xn, yn).</param>\r
+            <param name="tension">The tension of the curve defines the shape. Usually between 0 and 1. 0 would be a straight line.</param>\r
+            <param name="color">The color for the spline.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.DrawCurveClosed(System.Windows.Media.Imaging.WriteableBitmap,System.Int32[],System.Single,System.Int32)">\r
+            <summary>\r
+            Draws a closed Cardinal spline (cubic) defined by a point collection. \r
+            The cardinal spline passes through each point in the collection.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="points">The points for the curve in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, x3, y3, x4, y4, x1, x2 ..., xn, yn).</param>\r
+            <param name="tension">The tension of the curve defines the shape. Usually between 0 and 1. 0 would be a straight line.</param>\r
+            <param name="color">The color for the spline.</param>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.Crop(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Int32,System.Int32)">\r
+            <summary>\r
+            Creates a new cropped WriteableBitmap.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="x">The x coordinate of the rectangle that defines the crop region.</param>\r
+            <param name="y">The y coordinate of the rectangle that defines the crop region.</param>\r
+            <param name="width">The width of the rectangle that defines the crop region.</param>\r
+            <param name="height">The height of the rectangle that defines the crop region.</param>\r
+            <returns>A new WriteableBitmap that is a cropped version of the input.</returns>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.Crop(System.Windows.Media.Imaging.WriteableBitmap,System.Windows.Rect)">\r
+            <summary>\r
+            Creates a new cropped WriteableBitmap.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="region">The rectangle that defines the crop region.</param>\r
+            <returns>A new WriteableBitmap that is a cropped version of the input.</returns>\r
+        </member>\r
+        <member name="M:System.Windows.Media.Imaging.WriteableBitmapExtensions.Resize(System.Windows.Media.Imaging.WriteableBitmap,System.Int32,System.Int32,System.Windows.Media.Imaging.WriteableBitmapExtensions.Interpolation)">\r
+            <summary>\r
+            Creates a new resized WriteableBitmap.\r
+            </summary>\r
+            <param name="bmp">The WriteableBitmap.</param>\r
+            <param name="width">The new desired width.</param>\r
+            <param name="height">The new desired height.</param>\r
+            <param name="interpolation">The interpolation method that should be used.</param>\r
+            <returns>A new WriteableBitmap that is a resized version of the input.</returns>\r
+        </member>\r
         <member name="T:System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode">\r
             <summary>\r
             The blending mode.\r
             </summary>\r
         </member>\r
-        <member name="F:System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode.AlphaBlend">\r
+        <member name="F:System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode.Alpha">\r
             <summary>\r
             Alpha blendiing uses the alpha channel to combine the source and destination. \r
             </summary>\r
             No blending just copies the pixels from the source.\r
             </summary>\r
         </member>\r
+        <member name="T:System.Windows.Media.Imaging.WriteableBitmapExtensions.Interpolation">\r
+            <summary>\r
+            The interpolation method.\r
+            </summary>\r
+        </member>\r
+        <member name="F:System.Windows.Media.Imaging.WriteableBitmapExtensions.Interpolation.NearestNeighbor">\r
+            <summary>\r
+            The nearest neighbor algorithm simply selects the color of the nearest pixel.\r
+            </summary>\r
+        </member>\r
+        <member name="F:System.Windows.Media.Imaging.WriteableBitmapExtensions.Interpolation.Bilinear">\r
+            <summary>\r
+            Linear interpolation in 2D using the average of 3 neighboring pixels.\r
+            </summary>\r
+        </member>\r
     </members>\r
 </doc>\r
index 498272f..72956f0 100644 (file)
Binary files a/dev4/WriteableBitmapEx/WriteableBitmapEx.dll and b/dev4/WriteableBitmapEx/WriteableBitmapEx.dll differ
index 8ab76d3..cc55600 100644 (file)
Binary files a/dev4/WriteableBitmapEx/WriteableBitmapEx.pdb and b/dev4/WriteableBitmapEx/WriteableBitmapEx.pdb differ
index 85134a9..338423a 100644 (file)
@@ -102,6 +102,131 @@ namespace Psychlops
                {\r
                        return exp(- (x*x) / (2*sigma*sigma));\r
                }\r
+\r
+               public static double normalDistibution(double x, double mu, double sigma)\r
+               {\r
+                       return exp( -( (x-mu)*(x-mu) / (2*sigma*sigma) ) ) / sqrt(2*PI*sigma*sigma);\r
+               }\r
+\r
+               public static double cumulativeNormalDistibution(double x, double mu, double sigma)\r
+               {\r
+                       return .5 + .5*Internal.GammaFunction.erf( (x-mu)/(sigma*sqrt(2.0) ) );\r
+               }\r
+\r
        }\r
 \r
+       namespace Internal\r
+       {\r
+               public static class GammaFunction\r
+               {\r
+                       /************ loggamma(x) -- gamma.c より再掲 *************/\r
+\r
+                       static readonly double PI      = 3.14159265358979324;  /* $\pi$ */\r
+                       static readonly double LOG_2PI = 1.83787706640934548;  /* $\log 2\pi$ */\r
+                       static readonly double N       = 8;\r
+\r
+                       static readonly double B0  = 1            ;     /* 以下はBernoulli数 */\r
+                       static readonly double B1  = (-1.0 / 2.0);\r
+                       static readonly double B2  = ( 1.0 / 6.0);\r
+                       static readonly double B4  = (-1.0 / 30.0);\r
+                       static readonly double B6  = ( 1.0 / 42.0);\r
+                       static readonly double B8  = (-1.0 / 30.0);\r
+                       static readonly double B10 = ( 5.0 / 66.0);\r
+                       static readonly double B12 = (-691.0 / 2730.0);\r
+                       static readonly double B14 = ( 7.0 / 6.0);\r
+                       static readonly double B16 = (-3617.0 / 510.0);\r
+\r
+                       public static double loggamma(double x)  /* ガンマ関数の対数 */\r
+                       {\r
+                               double v, w;\r
+\r
+                               v = 1;\r
+                               while (x < N) {  v *= x;  x++;  }\r
+                               w = 1 / (x * x);\r
+                               return ((((((((B16 / (16 * 15))  * w + (B14 / (14 * 13))) * w\r
+                                                       + (B12 / (12 * 11))) * w + (B10 / (10 *  9))) * w\r
+                                                       + (B8  / ( 8 *  7))) * w + (B6  / ( 6 *  5))) * w\r
+                                                       + (B4  / ( 4 *  3))) * w + (B2  / ( 2 *  1))) / x\r
+                                                       + 0.5 * LOG_2PI - Math.log(v) - x + (x - 0.5) * Math.log(x);\r
+                       }\r
+\r
+                       public static double p_gamma(double a, double x, double loggamma_a)  /* 本文参照 */\r
+                       {\r
+                               int k;\r
+                               double result, term, previous;\r
+\r
+                               if (x >= 1 + a) return 1 - q_gamma(a, x, loggamma_a);\r
+                               if (x == 0)     return 0;\r
+                               result = term = Math.exp(a * Math.log(x) - x - loggamma_a) / a;\r
+                               for (k = 1; k < 1000; k++) {\r
+                                       term *= x / (a + k);\r
+                                       previous = result;  result += term;\r
+                                       if (result == previous) return result;\r
+                               }\r
+                               //throw new Exception("p_gamma(): the sequence is not convergent.");\r
+                               return result;\r
+                       }\r
+\r
+                       public static double q_gamma(double a, double x, double loggamma_a)  /* 本文参照 */\r
+                       {\r
+                               int k;\r
+                               double result, w, temp, previous;\r
+                               double la = 1, lb = 1 + x - a;  /* Laguerreの多項式 */\r
+\r
+                               if (x < 1 + a) return 1 - p_gamma(a, x, loggamma_a);\r
+                               w = Math.exp(a * Math.log(x) - x - loggamma_a);\r
+                               result = w / lb;\r
+                               for (k = 2; k < 1000; k++) {\r
+                                       temp = ((k - 1 - a) * (lb - la) + (k + x) * lb) / k;\r
+                                       la = lb;  lb = temp;\r
+                                       w *= (k - 1 - a) / k;\r
+                                       temp = w / (la * lb);\r
+                                       previous = result;  result += temp;\r
+                                       if (result == previous) return result;\r
+                               }\r
+                               //throw new Exception("q_gamma(): the sequence is not convergent.");\r
+                               return result;\r
+                       }\r
+\r
+                       public static double p_chisq(double chisq, int df)  /* カイ2乗分布の下側確率 */\r
+                       {\r
+                               return p_gamma(0.5 * df, 0.5 * chisq, loggamma(0.5 * df));\r
+                       }\r
+\r
+                       public static double q_chisq(double chisq, int df)  /* カイ2乗分布の上側確率 */\r
+                       {\r
+                               return q_gamma(0.5 * df, 0.5 * chisq, loggamma(0.5 * df));\r
+                       }\r
+\r
+                       static readonly double LOG_PI = 1.14472988584940017;  /* $\log_e \pi$ */\r
+\r
+                       public static double erf(double x)  /* Gaussの誤差関数 ${\rm erf}(x)$ */\r
+                       {\r
+                               if (x >= 0) return   p_gamma(0.5, x * x, LOG_PI / 2);\r
+                               else        return - p_gamma(0.5, x * x, LOG_PI / 2);\r
+                       }\r
+\r
+                       public static double erfc(double x)  /* $1 - {\rm erf}(x)$ */\r
+                       {\r
+                               if (x >= 0) return  q_gamma(0.5, x * x, LOG_PI / 2);\r
+                               else        return  1 + p_gamma(0.5, x * x, LOG_PI / 2);\r
+                       }\r
+\r
+                       public static double p_normal(double x)  /* 標準正規分布の下側確率 */\r
+                       {\r
+                               if (x >= 0) return\r
+                                       0.5 * (1 + p_gamma(0.5, 0.5 * x * x, LOG_PI / 2));\r
+                               else return\r
+                                       0.5 * q_gamma(0.5, 0.5 * x * x, LOG_PI / 2);\r
+                       }\r
+\r
+                       public static double q_normal(double x)  /* 標準正規分布の上側確率 */\r
+                       {\r
+                               if (x >= 0) return\r
+                                       0.5 * q_gamma(0.5, 0.5 * x * x, LOG_PI / 2);\r
+                               else return\r
+                                       0.5 * (1 + p_gamma(0.5, 0.5 * x * x, LOG_PI / 2));\r
+                       }\r
+               }\r
+       }\r
 }
\ No newline at end of file
index eca5c7a..0a149ec 100644 (file)
@@ -38,7 +38,8 @@ namespace Psychlops
                        }\r
                        public static double combination(int nn, int kk)\r
                        {\r
-                               //return (double)(Int64)(factorial(n) / (factorial(kk) * factorial(n - kk)));\r
+                               return (double)(Int64)(factorial(nn) / (factorial(kk) * factorial(nn - kk)));\r
+                               /*\r
                                BigInt n = new BigInt((Int64)nn, new PrecisionSpec());\r
                                BigInt k = new BigInt((Int64)kk, new PrecisionSpec());\r
                                BigInt n_k = n - k;\r
@@ -46,6 +47,7 @@ namespace Psychlops
                                k.Factorial();\r
                                n_k.Factorial();\r
                                return (double)(Int64)(n / (k * n_k) );\r
+                                * */\r
                        }\r
                        public static double likelihood(double pp, int yes, int no)\r
                        {\r
@@ -124,18 +126,19 @@ namespace Psychlops
                        public void waitLoop()\r
                        {\r
                                finished = false;\r
-                               for(int i=0; i<10; i++) {\r
+                               for (int i = 0; i < CONST.MAX_ARG; i++)\r
+                               {\r
                                        champ[i] = 0;\r
                                }\r
                                current = this;\r
                                started = false;\r
                        }\r
 \r
-                       public void loop1() { waitLoop(); th = new Thread(new ThreadStart(loop1_)); }\r
-                       public void loop2() { waitLoop(); th = new Thread(new ThreadStart(loop2_)); }\r
-                       public void loop3() { waitLoop(); th = new Thread(new ThreadStart(loop3_)); }\r
-                       public void loop4() { waitLoop(); th = new Thread(new ThreadStart(loop4_)); }\r
-                       public void loop5() { waitLoop(); th = new Thread(new ThreadStart(loop5_)); }\r
+                       public void loop1() { waitLoop(); th = new Thread(new ThreadStart(loop1_)); th.Start(); }\r
+                       public void loop2() { waitLoop(); th = new Thread(new ThreadStart(loop2_)); th.Start(); }\r
+                       public void loop3() { waitLoop(); th = new Thread(new ThreadStart(loop3_)); th.Start(); }\r
+                       public void loop4() { waitLoop(); th = new Thread(new ThreadStart(loop4_)); th.Start(); }\r
+                       public void loop5() { waitLoop(); th = new Thread(new ThreadStart(loop5_)); th.Start(); }\r
                        void loop1_()\r
                        {\r
                                started = true;\r
@@ -160,7 +163,7 @@ namespace Psychlops
                        void loop2_()\r
                        {\r
                                started = true;\r
-                               double p;\r
+                               double p = 0.0;\r
                                double like = 1.0;\r
                                champ_like = 0.0;\r
                                int L = data.length;\r
@@ -178,6 +181,7 @@ namespace Psychlops
                                                {\r
                                                        champ_like = like;\r
                                                        champ[0] = a;\r
+                                                       champ[1] = b;\r
                                                }\r
                                        }\r
                                }\r
@@ -206,6 +210,8 @@ namespace Psychlops
                                                        {\r
                                                                champ_like = like;\r
                                                                champ[0] = a;\r
+                                                               champ[1] = b;\r
+                                                               champ[1] = c;\r
                                                        }\r
                                                }\r
                                        }\r
@@ -226,8 +232,36 @@ namespace Psychlops
 \r
 \r
 \r
-               class BinomialLikelihood\r
+               public class BinomialLikelihood\r
                {\r
+                       public static void showWindow(Constants.Func1 f)\r
+                       {\r
+                               Main.canvas.api_canvas.Dispatcher.BeginInvoke(new Action<Constants.Func1>(showWindow_), f);\r
+                       }\r
+                       internal static void showWindow_(Constants.Func1 f)\r
+                       {\r
+                               System.Windows.Controls.ChildWindow page = new PsychlopsSilverlight4.Pages.BinomialSolver(f);\r
+                               page.Show();\r
+                       }\r
+                       public static void showWindow(Constants.Func2 f)\r
+                       {\r
+                               Main.canvas.api_canvas.Dispatcher.BeginInvoke(new Action<Constants.Func2>(showWindow_), f);\r
+                       }\r
+                       internal static void showWindow_(Constants.Func2 f)\r
+                       {\r
+                               System.Windows.Controls.ChildWindow page = new PsychlopsSilverlight4.Pages.BinomialSolver(f);\r
+                               page.Show();\r
+                       }\r
+                       public static void showWindow(Constants.Func3 f)\r
+                       {\r
+                               Main.canvas.api_canvas.Dispatcher.BeginInvoke(new Action<Constants.Func3>(showWindow_), f);\r
+                       }\r
+                       internal static void showWindow_(Constants.Func3 f)\r
+                       {\r
+                               System.Windows.Controls.ChildWindow page = new PsychlopsSilverlight4.Pages.BinomialSolver(f);\r
+                               page.Show();\r
+                       }\r
+\r
                        public int iteration;\r
 \r
                        public Interval[] itvl;\r
@@ -258,6 +292,7 @@ namespace Psychlops
                                func1 = d_func;\r
 \r
                                BinomialLikelihoodThread[] l = new BinomialLikelihoodThread[4];\r
+                               for (int i = 0; i < 4; i++) { l[i] = new BinomialLikelihoodThread(); }\r
 \r
                                for (int k = 0; k < iteration; k++)\r
                                {\r
@@ -276,6 +311,7 @@ namespace Psychlops
                                func2 = d_func;\r
 \r
                                BinomialLikelihoodThread[] l = new BinomialLikelihoodThread[4];\r
+                               for (int i = 0; i < 4; i++) { l[i] = new BinomialLikelihoodThread(); }\r
 \r
                                for (int k = 0; k < iteration; k++)\r
                                {\r
@@ -294,6 +330,7 @@ namespace Psychlops
                                func3 = d_func;\r
 \r
                                BinomialLikelihoodThread[] l = new BinomialLikelihoodThread[4];\r
+                               for (int i = 0; i < 4; i++) { l[i] = new BinomialLikelihoodThread(); }\r
 \r
                                for (int k = 0; k < iteration; k++)\r
                                {\r
@@ -340,12 +377,11 @@ namespace Psychlops
 \r
                        void end_base(BinomialLikelihoodThread[] l)\r
                        {\r
-                               for (int i = 0; i < 4; i++)\r
-                               {\r
-                                       l[i].th.Join();\r
-                               }\r
+                               //for (int i = 0; i < 4; i++) { l[i].th.Join(); }\r
+                               while (!l[0].finished || !l[1].finished || !l[2].finished || !l[3].finished) { Thread.Sleep(100);  } \r
 \r
                                for(int j=0; j<Constants.LIMIT; j++) { champ[j] = 0; }\r
+                               champ_like = 0.0;\r
                                for(int i=0; i<4; i++) {\r
                                        if(champ_like < l[i].champ_like) {\r
                                                champ_like = l[i].champ_like;\r
index b93f0d8..5e19dfb 100644 (file)
@@ -24,6 +24,8 @@ namespace PsychlopsSilverlight4test
                {\r
                        cnvs = new Canvas(500, 500);\r
 \r
+                       Psychlops.Solver.BinomialLikelihood.showWindow(Math.cumulativeNormalDistibution);\r
+\r
 \r
                        img = new Image("Resources/logo.png");\r
 \r
index 2d534ea..c6601b6 100644 (file)
@@ -70,6 +70,7 @@
     <Reference Include="system" />\r
     <Reference Include="System.Core" />\r
     <Reference Include="System.Net" />\r
+    <Reference Include="System.Windows.Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />\r
     <Reference Include="System.Xml" />\r
     <Reference Include="System.Windows.Browser" />\r
   </ItemGroup>\r