本文整理汇总了Java中cern.colt.list.IntArrayList.get方法的典型用法代码示例。如果您正苦于以下问题:Java IntArrayList.get方法的具体用法?Java IntArrayList.get怎么用?Java IntArrayList.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cern.colt.list.IntArrayList
的用法示例。
在下文中一共展示了IntArrayList.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SparseMultSparseTranspose
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
static public List<DoubleMatrix1D> SparseMultSparseTranspose(List<DoubleMatrix1D> A,
List<DoubleMatrix1D> B) {
int m = A.size();
int n = A.get(0).size();
int p = B.size();
List<DoubleMatrix1D> C = null;
if (C==null) {
C = new ArrayList<DoubleMatrix1D>();
for (int i = 0; i < m; ++i) {
C.add(new ColtSparseVector(p));
}
}
if (B.get(0).size() != n)
throw new IllegalArgumentException("Matrix2D inner dimensions must agree.");
for (int i = 0; i < m; ++i) {
IntArrayList indexList = new IntArrayList();
DoubleArrayList valueList = new DoubleArrayList();
A.get(i).getNonZeros(indexList, valueList);
for (int j = 0; j < p; ++j) {
if (B.get(j).size() != A.get(i).size())
throw new IllegalArgumentException("Matrix2D inner dimensions must agree.");
double sum = 0.0;
for (int k = 0; k < indexList.size(); ++k) {
int index = indexList.get(k);
double value1 = valueList.get(k);
double value2 = B.get(j).getQuick(index);
if (value1 != 0 || value2 != 0) {
sum += value1 * value2;
}
}
C.get(i).setQuick(j, sum);
}
}
return C;
}
示例2: getSparseTranspose
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
static public List<DoubleMatrix1D> getSparseTranspose(List<DoubleMatrix1D> A) {
List<DoubleMatrix1D> AT = new ArrayList<DoubleMatrix1D>();
for (int i = 0; i < A.get(0).size(); ++i) {
AT.add(new ColtSparseVector(A.size()));
}
for (int i = 0; i < A.size(); ++i) {
IntArrayList indexList = new IntArrayList();
DoubleArrayList valueList = new DoubleArrayList();
A.get(i).getNonZeros(indexList, valueList);
for (int k = 0; k < indexList.size(); ++k) {
int index = indexList.get(k);
double value = valueList.get(k);
AT.get(index).set(i, value);
}
}
return AT;
}
示例3: genInputPlaces
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
private ArrayList genInputPlaces(int ith)
{
ArrayList tuples = new ArrayList();
//get all predecessors
IntArrayList ialPred = getPred(ith, false);
//enumerate all the relevant causual dependencies
for (int i = 0; i < ialPred.size(); i++)
{
int pred = ialPred.get(i);
IntArrayList ialSucc = getSucc(pred, false);
for (int j = 0; j < ialSucc.size(); j++)
{
int succ = ialSucc.get(j);
IntArrayList A = new IntArrayList();
A.add(pred);
IntArrayList B = new IntArrayList();
B.add(succ);
ExpandTree(tuples, A, B, 0, 0);
}
}
return tuple2Place(ith, tuples, 1);
}
示例4: genOutputPlaces
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
private ArrayList genOutputPlaces(int ith)
{
ArrayList tuples = new ArrayList();
//get all successors
IntArrayList ialSucc = getSucc(ith, false);
//enumerate all the relevant causual dependencies
for (int i = 0; i < ialSucc.size(); i++)
{
int succ = ialSucc.get(i);
IntArrayList ialPred = getPred(succ, false);
for (int j = 0; j < ialPred.size(); j++)
{
int pred = ialPred.get(j);
IntArrayList A = new IntArrayList();
A.add(pred);
IntArrayList B = new IntArrayList();
B.add(succ);
ExpandTree(tuples, A, B, 0, 0);
}
}
return tuple2Place(ith, tuples, 0);
}
示例5: addNoise
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
public static void addNoise(DoubleMatrix2D s) {
IntArrayList is = new IntArrayList();
IntArrayList ks = new IntArrayList();
DoubleArrayList vs = new DoubleArrayList();
s.getNonZeros(is, ks, vs);
for (int j=0; j<is.size(); j++) {
int i = is.get(j);
int k = ks.get(j);
double v = vs.get(j);
v = v + (EPSILON * v + REALMIN100) * Math.random();
s.setQuick(i, k, v);
}
}
示例6: observedEpsilonAtPhi
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
* This method was created in VisualAge.
* @return double[]
* @param values cern.it.hepodbms.primitivearray.DoubleArrayList
* @param phis double[]
*/
public static double observedEpsilonAtPhi(double phi, ExactDoubleQuantileFinder exactFinder, DoubleQuantileFinder approxFinder) {
int N = (int) exactFinder.size();
int exactRank = (int) Utils.epsilonCeiling(phi * N) - 1;
//System.out.println("exactRank="+exactRank);
exactFinder.quantileElements(new DoubleArrayList(new double[] {phi})).get(0); // just to ensure exactFinder is sorted
double approxElement = approxFinder.quantileElements(new DoubleArrayList(new double[] {phi})).get(0);
//System.out.println("approxElem="+approxElement);
IntArrayList approxRanks = binaryMultiSearch(exactFinder.buffer, approxElement);
int from = approxRanks.get(0);
int to = approxRanks.get(1);
int distance;
if (from<=exactRank && exactRank<=to) distance = 0;
else {
if (from>exactRank) distance=Math.abs(from-exactRank);
else distance=Math.abs(exactRank-to);
}
double epsilon = (double)distance / (double)N;
return epsilon;
}
示例7: toString
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
* Returns a string representation of the receiver, containing
* the String representation of each key-value pair, sorted ascending by key.
*/
public String toString() {
IntArrayList theKeys = keys();
String tmp = theKeys.toString() + "\n";
theKeys.sort();
StringBuffer buf = new StringBuffer(tmp);
//StringBuffer buf = new StringBuffer();
buf.append("[");
int maxIndex = theKeys.size() - 1;
for (int i = 0; i <= maxIndex; i++) {
int key = theKeys.get(i);
buf.append(String.valueOf(key));
buf.append("->");
buf.append(String.valueOf(get(key)));
if (i < maxIndex) buf.append(", ");
}
buf.append("]");
return buf.toString();
}
示例8: toStringByValue
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
* Returns a string representation of the receiver, containing
* the String representation of each key-value pair, sorted ascending by value.
*/
public String toStringByValue() {
IntArrayList theKeys = new IntArrayList();
keysSortedByValue(theKeys);
StringBuffer buf = new StringBuffer();
buf.append("[");
int maxIndex = theKeys.size() - 1;
for (int i = 0; i <= maxIndex; i++) {
int key = theKeys.get(i);
buf.append(String.valueOf(key));
buf.append("->");
buf.append(String.valueOf(get(key)));
if (i < maxIndex) buf.append(", ");
}
buf.append("]");
return buf.toString();
}
示例9: toString
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
* Returns a string representation of the receiver, containing
* the String representation of each key-value pair, sorted ascending by key.
*/
public String toString() {
IntArrayList theKeys = keys();
theKeys.sort();
StringBuffer buf = new StringBuffer();
buf.append("[");
int maxIndex = theKeys.size() - 1;
for (int i = 0; i <= maxIndex; i++) {
int key = theKeys.get(i);
buf.append(String.valueOf(key));
buf.append("->");
buf.append(String.valueOf(get(key)));
if (i < maxIndex) buf.append(", ");
}
buf.append("]");
return buf.toString();
}
示例10: toStringByValue
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
* Returns a string representation of the receiver, containing
* the String representation of each key-value pair, sorted ascending by value, according to natural ordering.
*/
public String toStringByValue() {
IntArrayList theKeys = new IntArrayList();
keysSortedByValue(theKeys);
StringBuffer buf = new StringBuffer();
buf.append("[");
int maxIndex = theKeys.size() - 1;
for (int i = 0; i <= maxIndex; i++) {
int key = theKeys.get(i);
buf.append(String.valueOf(key));
buf.append("->");
buf.append(String.valueOf(get(key)));
if (i < maxIndex) buf.append(", ");
}
buf.append("]");
return buf.toString();
}
示例11: toString
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
* Returns a string representation of the receiver, containing
* the String representation of each key-value pair, sorted ascending by key.
*/
public String toString() {
IntArrayList theKeys = keys();
//theKeys.sort();
StringBuffer buf = new StringBuffer();
buf.append("[");
int maxIndex = theKeys.size() - 1;
for (int i = 0; i <= maxIndex; i++) {
int key = theKeys.get(i);
buf.append(String.valueOf(key));
buf.append("->");
buf.append(String.valueOf(get(key)));
if (i < maxIndex) buf.append(", ");
}
buf.append("]");
return buf.toString();
}
示例12: restore
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
public List<DoubleMatrix1D> restore()
{
if (doc2graphidx == null)
return ans;
if (ans.size() == 0)
return ans;
Map<Integer, Integer> graphidx2doc = new HashMap<Integer, Integer>();
for (Entry<Integer, Integer> entry: doc2graphidx.entrySet())
{
graphidx2doc.put(entry.getValue(), entry.getKey());
}
List<DoubleMatrix1D> mat = new ArrayList<DoubleMatrix1D>();
for(int i = 0; i < doc_num; i++)
mat.add(new ColtSparseVector(doc_num));
for (int i = 0; i < ans.size(); i++)
{
DoubleMatrix1D shrinked_vec = ans.get(i), vec = mat.get(graphidx2doc.get(i));
IntArrayList indexList = new IntArrayList();
DoubleArrayList valueList = new DoubleArrayList();
shrinked_vec.getNonZeros(indexList, valueList);
for (int k = 0; k < indexList.size(); k++)
{
int idx = indexList.get(k);
double value = valueList.get(k);
vec.setQuick(graphidx2doc.get(idx), value);
}
}
return mat;
}
示例13: SparseMultSparse
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
static public List<DoubleMatrix1D> SparseMultSparse(List<DoubleMatrix1D> A,
List<DoubleMatrix1D> B) {
int m = A.size();
int n = A.get(0).size();
int p = B.get(0).size();
List<DoubleMatrix1D> C = null;
if (C==null) {
C = new ArrayList<DoubleMatrix1D>();
for (int i = 0; i < m; ++i) {
C.add(new ColtSparseVector(p));
}
}
if (B.size() != n)
throw new IllegalArgumentException("Matrix2D inner dimensions must agree.");
for (int i = 0; i < m; ++i) {
IntArrayList indexList = new IntArrayList();
DoubleArrayList valueList = new DoubleArrayList();
A.get(i).getNonZeros(indexList, valueList);
for (int j = 0; j < p; ++j) {
if (B.size() != A.get(i).size())
throw new IllegalArgumentException("Matrix2D inner dimensions must agree.");
double sum = 0.0;
for (int k = 0; k < indexList.size(); ++k) {
int index = indexList.get(k);
double value1 = valueList.get(k);
double value2 = B.get(index).getQuick(j);
if (value1 != 0 || value2 != 0) {
sum += value1 * value2;
}
}
C.get(i).setQuick(j, sum);
}
}
return C;
}
示例14: isCombinable
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
private boolean isCombinable(ArrayList alFalseDep, DoubleSet[] sarIPred, DoubleSet[] sarSucc, DoubleSet[] sarISucc, DoubleSet[] sarPred)
{
//I's Pred'pred vs Succ'succ
for (int j = 0; j < sarIPred.length; j++)
{
IntArrayList sarIPredPred = sarIPred[j].getA();
for (int k = 0; k < sarIPredPred.size(); k++)
{
for(int n=0; n<sarSucc.length; n++)
{
IntArrayList sarSuccSucc = sarSucc[n].getB();
for (int m = 0; m < sarSuccSucc.size(); m++)
{
PredSucc ps = new PredSucc(sarIPredPred.get(k), sarSuccSucc.get(m));
if (!alFalseDep.contains(ps))
return false;
}
}
}
}
//I's Pred'succ vs Succ'pred
for (int j = 0; j < sarIPred.length; j++)
for(int k=0; k<sarSucc.length; k++)
if (existPara(sarIPred[j].getB(), sarSucc[k].getA()))
return false;
//I's Succ vs Succ
for (int j = 0; j < sarISucc.length; j++)
for(int k=0; k<sarPred.length; k++)
if (! (existPara(sarISucc[j].getA(), sarPred[k].getA()) ||
existPara(sarISucc[j].getB(), sarPred[k].getB())))
return false;
return true;
}
示例15: addToA
import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
public void addToA(IntArrayList alTask)
{
for (int i = 0; i < alTask.size(); i++)
{
int t = alTask.get(i);
if (!alA.contains(t))
{
alA.add(t);
}
}
}