当前位置:首页 » 操作系统 » java的算法库

java的算法库

发布时间: 2022-04-02 11:28:59

java算法

java中有个math类。里面就有许许多多的算法。下载一个jkd api慢慢看把,多的你眼花缭乱

软件包 java.math
提供用于执行任意精度整数算法 (BigInteger) 和任意精度小数算法 (BigDecimal) 的类。

Ⅱ JAVA有哪些适合进行数值计算,数据分析/机器学习的库

直接搜关键词:numerical computations in java

1、https //en wikipedia org/wiki/Java_programming_language

Apache Commons, is an open-source for creating reusable Java components. It has numerical packages for linear algebra and non-linear optimization.
ND4J is an open-source library that supports n-dimensional (ND) arrays, similar to NumPy. It runs on distributed GPUs or CPUs cross-platform. It supports thedeep learning library Deeplearning4j.
Colt provides a set of Open Source Libraries for High Performance Scientific and Technical Computing.
Efficient Java Matrix Library (EJML) is an open-source linear algebra library for manipulating dense matrices.
JAMA, a numerical linear algebra toolkit for the Java programming language. No active development has taken place since 2005, but it still one of the more popular linear algebra packages in Java.
Jblas: Linear Algebra for Java, a linear algebra library which is an easy to use wrapper around BLAS and LAPACK.
Parallel Colt is an open source library for scientific computing. A parallel extension of Colt.
DataMelt, an open-source Java libraries for numerical calculations, data I/O and visualization of scientific results. Used together with Jython.
JMSL Numerical Libraries, is a comprehensive set of mathematical, statistical, data mining, financial and 2D/3D charting classes.
Matrix Toolkit Java is a linear algebra library based on BLAS and LAPACK.
OjAlgo is an open source Java library for mathematics, linear algebra and optimisation.
exp4j is a small Java library for evaluation of mathematical expressions.
la4j is a tiny Java library and it provides linear algebra primitives and algorithms.
Universal Java Matrix Package UJM is a Java library which provides implementations for sparse and dense matrices, as well as linear algebra calculations such as matrix decomposition, inverse, multiply, mean, correlation, standard deviation, etc.
Java Matrix Library A thoughtfully designed Java library for dealing with Matrices ( Matrix Theory ). Simple, Intuitive and Flexible. The library revolves around a Matrix interface. Operations are thoughtfully distributed. Not guilty of exposing all-in-one Matrix class.
JDistLib Java Statistical Distribution Library is a Java package that provides routines for various statistical distributions. A manual translation of distributions provided by R statistical package.
SuanShu by Numerical Method Inc. is a large collection of numerical algorithms including linear algebra, (advanced) optimization, interpolation, Markov model, principal component analysis, time series analysis, hypothesis testing, regressions, statistics, ordinary and partial differential equation solvers.

2、Java Numerics: Main

Apfloat is a arbitrary precision floating-point arithmetic package.
ArciMath BigDecimal is an extension of java.math.BigDecimal based on IBM's Java Specification Request.
Colt is a free Java toolkit containing data structures and utilities intended for high performance computing.
Commons-Math The Jakarta Mathematics Library is is a library of lightweight, self-contained mathematics and statistics components addressing the most common problems not available in the Java programming language.
Drej, an open-source Java library for linear and non-linear least-squares regression and regularized least-squares classification.
A translation of the ELEFUNT Elementary Functions Testing Package has been ported to Java. The collection also contains extensions to java.lang.Math and new classes for numeric output formatting.
IBM's AlphaWorks contains several tools of interest, including
library of correctly rounded elementary functions intended for use with Java.
Ninja, a set of classes for numerically intensive Java, including complex, multidimensional arrays, and the BLAS. (RETIRED)
Java Numerical Toolkit (JNT)
Special functions including Bessel functions, Chebyshev series.
Zero root finder
Random Number generators for uniform and normal sequences of floating point numbers and long integers.
Java Ultimate Math Package, a framework for arbitrary precision computations.
The Java3D effort proced a matrix package for use in graphics.
JMSL, a collection of mathematical, statistical and charting classes, written in 100% Java, marketed by Visual Numeric, Inc. Includes linear algebra, zero finding, splines, ordinary differential equations, linear programming, nonlinear optimization, FFTs, special functions, regression, ANOVA, ARMA, Kalman filters.
JLargeArrays, a pure Java library of one-dimensional numeric arrays that can store up to 2^63 elements.
JSci, a set of Java packages for linear algebra, statistics, wavelets. Includes chart/graph components and a partial MathML DOM implementation.
jScience contains packages for numerical linear algebra, for computing with units (e.g., kg., sec.), and other utility operations.
Jspline+ is a spline approximation library for Java developed at the Institute of Computational Mathematics and Mathematical Geophysics (RAS) in Novosibirsk. It contains classes for univariate and multivariate spline approximation on scattered meshes, as well as core matrix and linear system solution classes.
JTransforms, The first open source, multithreaded FFT library in pure Java.
Koalog Constraint Solver is a commercial Java library for solving combinatorial optimization problems using Constraint Programming or Local Search.
Least Squares Software markets the jCrunch[tm] class libraries for numerical computing.
mpjava is a Java implementation of David Bailey's Fortran-based multiprecision package. The package performs multi precision floating point arithmetic with arbitrary precision level. It takes advantage of Java's inheritance facility to provide smooth transition from primitive arithmetic types.
netlib has a small collection of Java numerical classes.
A Numerical Library in Java for Scientists and Engineers, a book published by CRC Press, contains a CD-ROM with translation into Java of the library NUMAL (NUMerical proceres in Algol 60).

Ⅲ java算法

貌似是查找连续数和的问题吧
首先把和为N的所有可能连续数找出来,判断数字个数是否大于L

Ⅳ JAVA算法

上边的算法不对,如果是那样最后结果就是1
。应该是用链表来做,每个链表项有两个内容一个是指向下一个链表项的指针,另一个记录最开始的id number
如 public class array{
int id;
array next;
}
在public static void main里面初始化链表
然后判断id % 3==0 出圈的就从链表中删除,如此循环最后剩的那个还在链表中的id号就是答案。

Ⅳ 求个JAVA的算法给思想也行

http://hi..com/peiwenlin/blog/item/6e983b465c40e40e6b63e5de.html
也是在网上找的,其实没看懂,呵呵。
个人觉得应该先算出每个工作的每小时效益
工作 利益 时间 利益/小时
Compact 10,000 20 500
Sedan 20,000 30 666.6666667
Wagon 30,000 35 857.1428571
Offroad Motorcycle 12,000 15 800
Road Motorcyle 10,000 12 833.3333333
一定是先尽量干单位利益最多的,剩下的时间干次多的,以此类推。
按照上面的算法,最后的结论是5个wagon和2个road motorcycle,共199小时,获利$170,000

Ⅵ java类有直接调用pollard_rho算法的库方法么

暂时没有封装好的第三方库支持pollard_rho算法,只能自己编程实现。

Ⅶ JAVA 实现算法

package huda.laogao.ON_20121216;
import java.util.*;
public class GetEquation {
ArrayList<Integer> params = null;// 进行加减的数,长度设为n
int result = 0;// 结果
public GetEquation(ArrayList<Integer> params, int result) {
this.params = params;
this.result = result;
}
public void run() {
int size = params.size();
if (size == 1) {
if (params.get(0) == result)
System.out.println(result + "=" + result);
else
System.out.println("Invalid");
return;
}
int[][] matrix = getMatrix(size - 1);
int m = matrix.length;// 行数
int count = 0;// 记录符合结果的组合数
for (int i = 0; i < m; i++) {
int now = params.get(0);// 进行加减的结果,初始为第一个值
// 从第二个数开始进行加或减,加的话就相当于该数乘上1,然后加到结果上,
// 减的就相当于该数乘上-1,然后加到结果上
for (int j = 1; j < size; j++) {
now += matrix[i][j - 1] * params.get(j);
}
// System.out.println(now);
// 判断结果
if (now == result) {
count++;// 组合数加1
System.out.print(params.get(0));
for (int j = 1; j < size; j++) {
if (matrix[i][j - 1] == 1)
System.out.print("+" + params.get(j));
else
System.out.print("-" + params.get(j));
}// for j
System.out.println("=" + result);
}// if
}// for i
if (count == 0)
System.out.println("Invalid");
}
public int[][] getMatrix(int n) {
int m = (int) Math.pow(2, n);
int matrix[][] = new int[m][n];
for (int i = 0; i < n; i++) {
int num = (int) Math.pow(2, i + 1);
// 总共分 2^(i+1)块,如i=0,即该矩阵的第一列,可分为2块,上一块取1,下一块取-1
int size = (int) Math.pow(2, n - i - 1);
// 每块的大小为2^(n-i-1),如n=3,i=0,每块的大小为4,即前4个为1,后4个为-1
int flag = 1;// 先为+
for (int j = 0; j < num; j++) {
for (int k = 0; k < size; k++) {
matrix[k + j * size][i] = flag;
}
flag *= -1;
}
}
return matrix;
}

public void print(int[][] matrix) {
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
System.out.print(matrix[i][j] + "\t");
}
System.out.println();
}
}

public static void main(String args[]) {
ArrayList<Integer> params = new ArrayList<Integer>();
params.add(1);
params.add(2);
params.add(3);
params.add(4);
int result = 10;
GetEquation ge = new GetEquation(params, result);
ge.run();
}
}

运行结果为:1+2+3+4=10
注:难点为获取加减矩阵,可辅助print()函数帮助理解
望采纳

Ⅷ java十大算法

算法一:快速排序算法
快速排序是由东尼·霍尔所发展的一种排序算法。在平均状况下,排序 n 个项目要Ο(n log n)次比较。在最坏状况下则需要Ο(n2)次比较,但这种状况并不常见。事实上,快速排序通常明显比其他Ο(n log n) 算法更快,因为它的内部循环(inner loop)可以在大部分的架构上很有效率地被实现出来。

快速排序使用分治法(Divide and conquer)策略来把一个串行(list)分为两个子串行(sub-lists)。

算法步骤:

1 从数列中挑出一个元素,称为 "基准"(pivot),

2 重新排序数列,所有元素比基准值小的摆放在基准前面,所有元素比基准值大的摆在基准的后面(相同的数可以到任一边)。在这个分区退出之后,该基准就处于数列的中间位置。这个称为分区(partition)操作。

3 递归地(recursive)把小于基准值元素的子数列和大于基准值元素的子数列排序。

递归的最底部情形,是数列的大小是零或一,也就是永远都已经被排序好了。虽然一直递归下去,但是这个算法总会退出,因为在每次的迭代(iteration)中,它至少会把一个元素摆到它最后的位置去。

算法二:堆排序算法
堆排序(Heapsort)是指利用堆这种数据结构所设计的一种排序算法。堆积是一个近似完全二叉树的结构,并同时满足堆积的性质:即子结点的键值或索引总是小于(或者大于)它的父节点。

堆排序的平均时间复杂度为Ο(nlogn) 。

算法步骤:

创建一个堆H[0..n-1]

把堆首(最大值)和堆尾互换

3. 把堆的尺寸缩小1,并调用shift_down(0),目的是把新的数组顶端数据调整到相应位置

4. 重复步骤2,直到堆的尺寸为1

算法三:归并排序
归并排序(Merge sort,台湾译作:合并排序)是建立在归并操作上的一种有效的排序算法。该算法是采用分治法(Divide and Conquer)的一个非常典型的应用。

算法步骤:

1. 申请空间,使其大小为两个已经排序序列之和,该空间用来存放合并后的序列

2. 设定两个指针,最初位置分别为两个已经排序序列的起始位置

3. 比较两个指针所指向的元素,选择相对小的元素放入到合并空间,并移动指针到下一位置

4. 重复步骤3直到某一指针达到序列尾

5. 将另一序列剩下的所有元素

Ⅸ java中的算法,一共有多少种,哪几种,怎么分类。

就好比问,汉语中常用写作方法有多少种,怎么分类。

算法按用途分,体现设计目的、有什么特点
算法按实现方式分,有递归、迭代、平行、序列、过程、确定、不确定等等
算法按设计范型分,有分治、动态、贪心、线性、图论、简化等等

作为图灵完备的语言,理论上”Java语言“可以实现所有算法。
“Java的标准库'中用了一些常用数据结构和相关算法.

像apache common这样的java库中又提供了一些通用的算法

Ⅹ Java算法

public class wen {
public static void main(String []args)
{
int i ,j;
int sum=0;
for (i=1;i<=3;i++){
for(j=1;j<=3;j++)
{
sum+=j;
}

}
System.out.println(sum);

}

}
这样才对,一楼的不对。可以运行一下实验一下

热点内容
捏泡胶解压 发布:2024-11-15 10:55:07 浏览:802
linux文件最后一行 发布:2024-11-15 10:44:11 浏览:612
怎么根据序列号查配置 发布:2024-11-15 10:31:52 浏览:348
mysql查看数据库位置 发布:2024-11-15 10:25:16 浏览:439
需要学Python 发布:2024-11-15 10:23:41 浏览:836
如何制作安卓平板软件 发布:2024-11-15 10:23:39 浏览:215
手机忘记密码被锁预示着什么 发布:2024-11-15 10:22:15 浏览:193
android图片管理 发布:2024-11-15 10:13:02 浏览:9
算法微调 发布:2024-11-15 10:07:44 浏览:542
python列表查询 发布:2024-11-15 10:06:08 浏览:133