|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSciLib.Math.integerVector
public class integerVector
This class defines a dynamic vector of type intger.
| Constructor Summary | |
|---|---|
integerVector()
Allocates an empty vector. |
|
integerVector(int n)
Allocates a vector of size n with initiařized values 0. |
|
integerVector(int[] vec)
Allocates a vector from the array vec. |
|
integerVector(integerVector x)
Make a copy of the vector x. |
|
| Method Summary | |
|---|---|
void |
add(int x)
Add an element of value x to the vector. |
void |
append(integerVector x)
Append an integerVector x to this vector |
int |
argmax()
Compute the index of the maximum element in the vector. |
int |
argmin()
Compute the index of the minimum element in the vector. |
void |
concat(integerVector x)
Append a vector x to this vector |
static integerVector |
copy(integerVector x)
Make a copy of the vector x. |
static int |
dot(integerVector i1,
integerVector i2)
compute the dot product of two sparse binary vector a sparse vectors. |
static int |
dot(integerVector i1,
integerVector x,
integerVector i2,
integerVector y)
compute the dot product of two sparse binary vector a sparse vectors. |
int |
elementAt(int i)
return the value of vector at index i. |
static integerVector |
generate(int from,
int to)
create an integerVector that has elements from an integer "from" to an integer "to". |
static integerVector |
generateIndex(integerVector v)
create integerVector that stores the indexes of the nonzero elements of a sparse vector . |
static integerVector |
generateIndex(integerVector v,
integerVector val)
create integerVector that stores the indexes of the nonzero elements of a sparse integerVector and stores them in val. |
static integerVector |
generateIndex(integerVector v,
vector val)
create integerVector that stores the indexes of the nonzero elements of a sparse vector and stores them in val. |
static integerVector |
generateIndex(vector v)
create integerVector that stores the indexes of the nonzero elements of a sparse vector . |
static integerVector |
generateIndex(vector v,
vector val)
create integerVector that stores the indexes of the nonzero elements of a sparse vector and stores them in val. |
int[] |
getData()
Make an intger array that contains all data of the vector. |
int |
max()
return the maximum value of the vector. |
int |
min()
return the minimum value of the vector. |
void |
minus(integerVector x)
minus this vector with the vector x and store the result in this vector. |
static integerVector |
minus(integerVector x,
integerVector y)
minus two vector x, y. |
static integerVector |
ones(int n)
Make a vector of length n whose elements have value 1. |
void |
print()
Print all elements of the vector using System.out. |
void |
read(java.lang.String fileName)
Read data from a file to an integer vector. |
void |
resize(int n)
Change the size of the vector to n. |
void |
setElementAt(int x,
int i)
change the value of element at index i with the integer x. |
int |
size()
Return the length of the vector. |
double |
squareDistance(integerVector x)
compute the square distance between this point vector to a vector x |
static double |
squareDistance(integerVector x,
integerVector y)
compute the square distance between to point vector |
int |
squareNorm()
return the square of the norm of the vector. |
static int |
squareNorm(integerVector index,
integerVector val)
return the square of the norm of the vector. |
integerVector |
subvector(int from)
make a vector whose elements are equal to elements of this vector with the indexes from an integer "from" to the end of this vector. |
integerVector |
subvector(int from,
int to)
Make a vector whose elements are equal to elements of this vector with the indexes from an integer "from" to an intger "to". |
java.lang.String |
toString()
create a String that contains the elements of the vector. |
void |
translate(int s)
plus all elements of the vector with an integer factor s. |
void |
trimToSize()
Remove all the unused elements of the vector. |
void |
write(java.lang.String fileName)
write an integerVector to a file |
static integerVector |
zeros(int n)
Make a vector of length n whose elements have value 0. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public integerVector()
public integerVector(int n)
n - The length of the vectorpublic integerVector(int[] vec)
vec - An array of type doublepublic integerVector(integerVector x)
x - An integerVector| Method Detail |
|---|
public static integerVector copy(integerVector x)
x - An integerVectorpublic void add(int x)
x - An integer valuepublic void append(integerVector x)
x - A vectorpublic final int argmax()
public final int argmin()
public void concat(integerVector x)
x - A vector
public int elementAt(int i)
throws java.lang.ArrayIndexOutOfBoundsException
i - An integer
java.lang.ArrayIndexOutOfBoundsException
public static integerVector generate(int from,
int to)
from - An integerto - An integer
public static integerVector generateIndex(vector v)
v - A vector
public static integerVector generateIndex(integerVector v)
v - An integerVector
public static integerVector generateIndex(integerVector v,
vector val)
v - An integerVectorval - A vector
public static integerVector generateIndex(integerVector v,
integerVector val)
v - An integerVectorval - A integerVector
public static integerVector generateIndex(vector v,
vector val)
v - An vectorval - A vector
public static int dot(integerVector i1,
integerVector x,
integerVector i2,
integerVector y)
i1 - stores indexes of nozero elements of x, An integerVectorx - an array of integers, An integerVectori2 - stores indexes of nozero elements of y, An integerVectory - an ayyar of integers, An integerVector
public static int dot(integerVector i1,
integerVector i2)
i1 - stores indexes of nozero elements of x, An integerVectori2 - stores indexes of nozero elements of y, An integerVector
public int[] getData()
public final int max()
public final int min()
public void minus(integerVector x)
throws SizeException
x - A integerVector
SizeException
public static integerVector minus(integerVector x,
integerVector y)
throws SizeException
x - A integerVectory - A integerVector
SizeExceptionpublic static integerVector ones(int n)
public void print()
public void resize(int n)
n - The new length of the vector
public void setElementAt(int x,
int i)
throws java.lang.ArrayIndexOutOfBoundsException
x - An integer valuei - An index integer
java.lang.ArrayIndexOutOfBoundsExceptionpublic final int size()
public final int squareNorm()
public static int squareNorm(integerVector index,
integerVector val)
public double squareDistance(integerVector x)
x - A integerVector
public static double squareDistance(integerVector x,
integerVector y)
x - A integerVectory - A integerVector
public integerVector subvector(int from,
int to)
from - start indexto - end index
public integerVector subvector(int from)
from - start index
public java.lang.String toString()
toString in class java.lang.Objectpublic void translate(int s)
s - A double valuepublic void trimToSize()
public static integerVector zeros(int n)
n - An integerpublic void write(java.lang.String fileName)
fileName - A Stringpublic void read(java.lang.String fileName)
fileName - a String
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||