Package com.titan.math
Class Vector
java.lang.Object
com.titan.math.Vector
-
Constructor Summary
ConstructorsConstructorDescriptionVector
(double[] values) constructs a vector and calculates its length using the appropriate formula -
Method Summary
Modifier and TypeMethodDescriptionadds two vectors togetherstatic Vector
clone()
clones a vectordouble
dotProduct
(Vector c) static double
dotProduct
(Vector v, Vector c) boolean
double
returns the length of a vectorint
getSize()
returns the dimension of a vectordouble
getValue
(int i) double[]
multiplyByScalar
(double c) multiplies a given vector by a scalarsubtracts a vector from anotherstatic Vector
toString()
-
Constructor Details
-
Vector
public Vector(double[] values) constructs a vector and calculates its length using the appropriate formula- Parameters:
values
-
-
-
Method Details
-
getLength
public double getLength()returns the length of a vector- Returns:
-
getSize
public int getSize()returns the dimension of a vector- Returns:
-
getValues
public double[] getValues()- Returns:
- values a vector holds
-
getValue
public double getValue(int i) - Parameters:
i
- index of value- Returns:
- specific value a vector holds
-
add
-
subtract
-
multiplyByScalar
multiplies a given vector by a scalar- Parameters:
c
- scalar to multuplly by- Returns:
- new Vector after multiplication
-
add
-
subtract
-
dotProduct
-
dotProduct
-
toString
-
clone
-
equals
-