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, plusEquals
public final Vec copy(int i0, int i1)
Vec
public final Vec copyPart(int i0, int i1)
Vec
public final void resize(int newlength)
Vec
public final double[] getDoubles()
Vec
getDoubles
in class Vec
public final int size()
Vec
public final int getNz()
Vec
public final double get(int idx)
Vec
public final void set(int idx, double value)
Vec
public final double dotProduct(Vec r)
Vec
dotProduct
in class Vec
public final double dotProduct(Vec r, int i0, int i1)
dotProduct
in class Vec
public final void timesEquals(double scale)
Vec
timesEquals
in class Vec
public final void timesEquals(double scale, int i0, int i1)
Vec
timesEquals
in class Vec
public final void transposeAsColumn(Matrix A, int col)
Vec
transposeAsColumn
in class Vec
public final void transposeAsColumn(Matrix A, int col, int i0, int i1)
Vec
transposeAsColumn
in class Vec
public final void addTo(Vec r, double scale)
Vec
public final void clear()
Vec
public final double normF()
Vec
public final Vec copyPermuteColumns(Permutation p)
Vec
copyPermuteColumns
in class Vec