|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSciLib.Math.complexVector
public class complexVector
This class contains some methods to handle a vector of complex numbers.
| Field Summary | |
|---|---|
complex[] |
v
|
| Constructor Summary | |
|---|---|
complexVector()
Allocates a new complexVector containing no data. |
|
complexVector(complex[] x)
Make a complexVector from an array of complex numbers. |
|
complexVector(complexVector x)
Make a complexVector from another complex vector x. |
|
complexVector(int n)
Allocates a new complexVector of length n. |
|
complexVector(vector x)
Make a complexVector from a real vector x. |
|
| Method Summary | |
|---|---|
vector |
abs()
Make a real vector that contains the absolute values of all elements in the vector. |
void |
add(complex x)
add a complex number to the vector. |
void |
add(double x,
double y)
add a complex number (x, y) to the vector. |
vector |
angle()
Make a real vector that contains angles in radian of all elements in the vector. |
void |
conj()
Change the vector to its conjugates. |
complex |
elementAt(int index)
return a complex number at index "index". |
vector |
imaginary()
Make a real vector with the imaginary parts of all elements in the vector. |
void |
load(java.lang.String fileName)
Load data from a file to a complex vector. |
vector |
magnitude()
Make a real vector that contains the absolute values of all elements in the vector. |
void |
print()
Print all elements of the complex vector using System.out. |
void |
print(int n)
print all elements of the complex vector with n decimal digits using System.out. |
void |
read(java.lang.String fileName)
Read data from a file to a complex vector. |
vector |
real()
Make a real vector with the real parts of all elements in the vector. |
void |
resize(int n)
Change the size of the vector to n. |
static complexVector |
roundUp(complexVector x,
int n)
RoundUp a complex vector x to another vector whose elements have n decimal digits |
void |
roundUp(int n)
Round up this complex vector with n decimal format. |
void |
scale(double s)
Scale the vector with a factor s. |
void |
setElementAt(complex x,
int index)
Change the value of the complex number at index "index" to x. |
int |
size()
return the length of the vector. |
java.lang.String |
toString()
create a String that contains the elements of the vector with n decimal digits format. |
java.lang.String |
toString(int n)
create a String that contains the elements of the vector with n decimal digits format. |
void |
trimToSize()
Remove all the unused elements of the vector. |
void |
write(java.lang.String fileName)
Write all elements of the vector to a file. |
void |
write(java.lang.String fileName,
int n)
Write all elements of the vector to a file with the n deimal digits format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public complex[] v
| Constructor Detail |
|---|
public complexVector()
public complexVector(int n)
n - An integerpublic complexVector(vector x)
x - A vectorpublic complexVector(complexVector x)
x - A complexVectorpublic complexVector(complex[] x)
x - A complexVector| Method Detail |
|---|
public complex elementAt(int index)
throws java.lang.ArrayIndexOutOfBoundsException
index - An integer
java.lang.ArrayIndexOutOfBoundsException
public void setElementAt(complex x,
int index)
throws java.lang.ArrayIndexOutOfBoundsException
index - An integerx - A comlex number
java.lang.ArrayIndexOutOfBoundsExceptionpublic void add(complex x)
x - A comlex number
public void add(double x,
double y)
x - The real part of the comlex numbery - The imaginary part of the comlex numberpublic final int size()
public final vector angle()
public final vector real()
public final vector imaginary()
public final vector abs()
public final vector magnitude()
public void conj()
public void scale(double s)
s - A double valuepublic void roundUp(int n)
n - The number of decimal digits
public static complexVector roundUp(complexVector x,
int n)
x - A complex vectorn - The number of decimal digits
public void resize(int n)
n - The new length of the vectorpublic void trimToSize()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(int n)
n - The number of decimal digits
public void write(java.lang.String fileName)
fileName - A String
public void write(java.lang.String fileName,
int n)
fileName - A Stringn - The number of decimal digitspublic void read(java.lang.String fileName)
fileName - a Stringpublic void load(java.lang.String fileName)
fileName - a Stringpublic void print()
public void print(int n)
n - The number of decimal digits
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||