public class DenseVec extends Vec
| Modifier and Type | Field and Description |
|---|---|
(package private) double[] |
v |
| Constructor and Description |
|---|
DenseVec(double[] v) |
DenseVec(int length) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTo(Vec r,
double scale)
Add this vector (scaled) to another vector.
|
void |
addTo(Vec r,
double scale,
int i0,
int i1) |
void |
clear()
Set all elements to zero.
|
Vec |
copy()
Make a copy of the vector
|
Vec |
copy(int i0,
int i1)
create a new, smaller vector beginning at element i0, going
through i1 (inclusive).
|
double[] |
copyArray() |
Vec |
copyPart(int i0,
int i1)
create a same-sized vector containing only the spec'd elements.
|
Vec |
copyPermuteColumns(Permutation p)
reorder the columns of this matrix so that they are:
X' = [ X(perm[0]) X(perm[1]) X(perm[2])... ]
|
double |
dotProduct(Vec r)
Compute the dot product with vector r
|
double |
dotProduct(Vec r,
int i0,
int i1) |
double |
get(int idx)
Get the element at index idx
|
double[] |
getDoubles()
Return an array corresponding to the vector's elements.
|
int |
getNz()
How many non-zero entries are there?
|
double |
normF()
sum of squared elements.
|
void |
resize(int newlength)
Resize the vector, truncating or adding zeros as appropriate.
|
void |
set(int idx,
double value)
Set the element at index idx to v.
|
int |
size()
How long is the vector?
|
void |
timesEquals(double scale)
Multiply all elements in the vector by v
|
void |
timesEquals(double scale,
int i0,
int i1)
Multiply the elements between indices [i0,i1] (inclusive) by
v
|
void |
transposeAsColumn(Matrix A,
int col)
Insert this vector as column 'col' in matrix A.
|
void |
transposeAsColumn(Matrix A,
int col,
int i0,
int i1)
Transpose only the elements at indices [i0,i1] inclusive.
|
plusEquals, plusEqualspublic final Vec copy(int i0, int i1)
Vecpublic final Vec copyPart(int i0, int i1)
Vecpublic final void resize(int newlength)
Vecpublic final double[] getDoubles()
VecgetDoubles in class Vecpublic final int size()
Vecpublic final int getNz()
Vecpublic final double get(int idx)
Vecpublic final void set(int idx,
double value)
Vecpublic final double dotProduct(Vec r)
VecdotProduct in class Vecpublic final double dotProduct(Vec r, int i0, int i1)
dotProduct in class Vecpublic final void timesEquals(double scale)
VectimesEquals in class Vecpublic final void timesEquals(double scale,
int i0,
int i1)
VectimesEquals in class Vecpublic final void transposeAsColumn(Matrix A, int col)
VectransposeAsColumn in class Vecpublic final void transposeAsColumn(Matrix A, int col, int i0, int i1)
VectransposeAsColumn in class Vecpublic final void addTo(Vec r, double scale)
Vecpublic final void clear()
Vecpublic final double normF()
Vecpublic final Vec copyPermuteColumns(Permutation p)
VeccopyPermuteColumns in class Vec