Java Doc for MPN.java in  » Scripting » Kawa » gnu » math » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » Kawa » gnu.math 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   gnu.math.MPN

MPN
class MPN (Code)
This contains various low-level routines for unsigned bigints. The interfaces match the mpn interfaces in gmp, so it should be easy to replace them with fast native functions that are trivial wrappers around the mpn_ functions in gmp (at least on platforms that use 32-bit "limbs").




Method Summary
public static  intadd_1(int[] dest, int[] x, int size, int y)
     Add x[0:size-1] and y, and write the size least significant words of the result to dest. Return carry, either 0 or 1. All values are unsigned. This is basically the same as gmp's mpn_add_1.
public static  intadd_n(int dest, int[] x, int[] y, int len)
     Add x[0:len-1] and y[0:len-1] and write the len least significant words of the result to dest[0:len-1].
public static  intchars_per_word(int radix)
     Number of digits in the conversion base that always fits in a word.
public static  intcmp(int[] x, int[] y, int size)
     Compare x[0:size-1] with y[0:size-1] , treating them as unsigned integers.
public static  intcmp(int[] x, int xlen, int[] y, int ylen)
     Compare x[0:xlen-1] with y[0:ylen-1] , treating them as unsigned integers.
public static  intcount_leading_zeros(int i)
     Count the number of leading zero bits in an int.
public static  voiddivide(int[] zds, int nx, int[] y, int ny)
     Divide zds[0:nx] by y[0:ny-1]. The remainder ends up in zds[0:ny-1]. The quotient ends up in zds[ny:nx]. Assumes: nx>ny. (int)y[ny-1] < 0 (i.e.
public static  intdivmod_1(int[] quotient, int[] dividend, int len, int divisor)
     Divide divident[0:len-1] by (unsigned int)divisor.
static  intfindLowestBit(int word)
     Return least i such that word&(1<
static  intfindLowestBit(int[] words)
     Return least i such that words & (1<
public static  intgcd(int[] x, int[] y, int len)
     Calculate Greatest Common Divisior of x[0:len-1] and y[0:len-1]. Assumes both arguments are non-zero. Leaves result in x, and returns len of result. Also destroys y (actually sets it to a copy of the result).
public static  intintLength(int i)
    
public static  intintLength(int[] words, int len)
     Calcaulte the Common Lisp "integer-length" function.
public static  intlshift(int[] dest, int d_offset, int[] x, int len, int count)
    
public static  voidmul(int[] dest, int[] x, int xlen, int[] y, int ylen)
     Multiply x[0:xlen-1] and y[0:ylen-1], and write the result to dest[0:xlen+ylen-1]. The destination has to have space for xlen+ylen words, even if the result might be one limb smaller. This function requires that xlen >= ylen. The destination must be distinct from either input operands. All operands are unsigned. This function is basically the same gmp's mpn_mul.
public static  intmul_1(int[] dest, int[] x, int len, int y)
     Multiply x[0:len-1] by y, and write the len least significant words of the product to dest[0:len-1]. Return the most significant word of the product. All values are treated as if they were unsigned (i.e.
public static  intrshift(int[] dest, int[] x, int x_start, int len, int count)
    
public static  voidrshift0(int[] dest, int[] x, int x_start, int len, int count)
    
public static  longrshift_long(int[] x, int len, int count)
     Return the long-truncated value of right shifting.
public static  intset_str(int dest, byte[] str, int str_len, int base)
    
public static  intsub_n(int[] dest, int[] X, int[] Y, int size)
     Subtract Y[0:size-1] from X[0:size-1], and write the size least significant words of the result to dest[0:size-1].
public static  intsubmul_1(int[] dest, int offset, int[] x, int len, int y)
    
public static  longudiv_qrnnd(long N, int D)
    



Method Detail
add_1
public static int add_1(int[] dest, int[] x, int size, int y)(Code)
Add x[0:size-1] and y, and write the size least significant words of the result to dest. Return carry, either 0 or 1. All values are unsigned. This is basically the same as gmp's mpn_add_1.



add_n
public static int add_n(int dest, int[] x, int[] y, int len)(Code)
Add x[0:len-1] and y[0:len-1] and write the len least significant words of the result to dest[0:len-1]. All words are treated as unsigned. the carry, either 0 or 1This function is basically the same as gmp's mpn_add_n.



chars_per_word
public static int chars_per_word(int radix)(Code)
Number of digits in the conversion base that always fits in a word. For example, for base 10 this is 9, since 10**9 is the largest number that fits into a words (assuming 32-bit words). This is the same as gmp's __mp_bases[radix].chars_per_limb.
Parameters:
  radix - the base number of digits



cmp
public static int cmp(int[] x, int[] y, int size)(Code)
Compare x[0:size-1] with y[0:size-1] , treating them as unsigned integers. -1, 0, or 1 depending on if xy .This is basically the same as gmp's mpn_cmp function.



cmp
public static int cmp(int[] x, int xlen, int[] y, int ylen)(Code)
Compare x[0:xlen-1] with y[0:ylen-1] , treating them as unsigned integers. -1, 0, or 1 depending onwhether xy .



count_leading_zeros
public static int count_leading_zeros(int i)(Code)
Count the number of leading zero bits in an int.



divide
public static void divide(int[] zds, int nx, int[] y, int ny)(Code)
Divide zds[0:nx] by y[0:ny-1]. The remainder ends up in zds[0:ny-1]. The quotient ends up in zds[ny:nx]. Assumes: nx>ny. (int)y[ny-1] < 0 (i.e. most significant bit set)



divmod_1
public static int divmod_1(int[] quotient, int[] dividend, int len, int divisor)(Code)
Divide divident[0:len-1] by (unsigned int)divisor. Write result into quotient[0:len-1]. Return the one-word (unsigned) remainder. OK for quotient==dividend.



findLowestBit
static int findLowestBit(int word)(Code)
Return least i such that word&(1<



findLowestBit
static int findLowestBit(int[] words)(Code)
Return least i such that words & (1<



gcd
public static int gcd(int[] x, int[] y, int len)(Code)
Calculate Greatest Common Divisior of x[0:len-1] and y[0:len-1]. Assumes both arguments are non-zero. Leaves result in x, and returns len of result. Also destroys y (actually sets it to a copy of the result).



intLength
public static int intLength(int i)(Code)



intLength
public static int intLength(int[] words, int len)(Code)
Calcaulte the Common Lisp "integer-length" function. Assumes input is canonicalized: len==IntNum.wordsNeeded(words,len)



lshift
public static int lshift(int[] dest, int d_offset, int[] x, int len, int count)(Code)



mul
public static void mul(int[] dest, int[] x, int xlen, int[] y, int ylen)(Code)
Multiply x[0:xlen-1] and y[0:ylen-1], and write the result to dest[0:xlen+ylen-1]. The destination has to have space for xlen+ylen words, even if the result might be one limb smaller. This function requires that xlen >= ylen. The destination must be distinct from either input operands. All operands are unsigned. This function is basically the same gmp's mpn_mul.



mul_1
public static int mul_1(int[] dest, int[] x, int len, int y)(Code)
Multiply x[0:len-1] by y, and write the len least significant words of the product to dest[0:len-1]. Return the most significant word of the product. All values are treated as if they were unsigned (i.e. masked with 0xffffffffL). OK if dest==x (not sure if this is guaranteed for mpn_mul_1). This function is basically the same as gmp's mpn_mul_1.



rshift
public static int rshift(int[] dest, int[] x, int x_start, int len, int count)(Code)



rshift0
public static void rshift0(int[] dest, int[] x, int x_start, int len, int count)(Code)



rshift_long
public static long rshift_long(int[] x, int len, int count)(Code)
Return the long-truncated value of right shifting.
Parameters:
  x - a two's-complement "bignum"
Parameters:
  len - the number of significant words in x
Parameters:
  count - the shift count (long)(x[0..len-1] >> count).



set_str
public static int set_str(int dest, byte[] str, int str_len, int base)(Code)



sub_n
public static int sub_n(int[] dest, int[] X, int[] Y, int size)(Code)
Subtract Y[0:size-1] from X[0:size-1], and write the size least significant words of the result to dest[0:size-1]. Return borrow, either 0 or 1. This is basically the same as gmp's mpn_sub_n function.



submul_1
public static int submul_1(int[] dest, int offset, int[] x, int len, int y)(Code)



udiv_qrnnd
public static long udiv_qrnnd(long N, int D)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.