public class CSRVec extends Vec
| Modifier and Type | Field and Description |
|---|---|
int[] |
indices |
(package private) int |
lastGetIdx |
(package private) int |
lastSetIdx |
int |
length |
(package private) static int |
MIN_SIZE |
int |
nz |
double[] |
values |
| Constructor and Description |
|---|
CSRVec(int length) |
CSRVec(int length,
int capacity) |
| Modifier and Type | Method and Description |
|---|---|
static void |
add(CSRVec csra,
double ascale,
CSRVec csrb,
int i0,
int i1,
CSRVec res) |
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
|
CSRVec |
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) |
void |
ensureCapacity(int mincapacity) |
void |
filterZeros()
Remove any zeros that have snuck in.
|
void |
filterZeros(double eps)
Remove any values < eps that have snuck in.
|
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 |
getRef(int idx) |
(package private) void |
grow() |
(package private) void |
grow(int mincapacity) |
(package private) void |
insert(int i,
int idx,
double v) |
double |
normF()
sum of squared elements.
|
void |
plusEquals(int idx,
double v)
Add the value v to each element.
|
void |
resize(int newlength)
Resize the vector, truncating or adding zeros as appropriate.
|
void |
set(int idx,
double v)
Set the element at index idx to v.
|
void |
setRef(int idx,
double v) |
int |
size()
How long is the vector?
|
(package private) void |
sort() |
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.
|
plusEqualspublic int length
public int[] indices
public double[] values
public int nz
int lastGetIdx
int lastSetIdx
static final int MIN_SIZE
public final double[] getDoubles()
VecgetDoubles in class Vecpublic final void filterZeros()
public final void filterZeros(double eps)
final void insert(int i,
int idx,
double v)
public final void resize(int newlength)
Vecfinal void sort()
public final void ensureCapacity(int mincapacity)
final void grow()
final void grow(int mincapacity)
public final CSRVec copy(int i0, int i1)
Vecpublic final Vec copyPart(int i0, int i1)
Vecpublic final int size()
Vecpublic final int getNz()
Vecpublic final double get(int idx)
Vecpublic final double getRef(int idx)
public final void set(int idx,
double v)
Vecpublic final void setRef(int idx,
double v)
public 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 static final void add(CSRVec csra, double ascale, CSRVec csrb, int i0, int i1, CSRVec res)
public final void addTo(Vec _r, double scale)
Vecpublic final void addTo(Vec _r, double scale, int i0, int i1)
public final void plusEquals(int idx,
double v)
VecplusEquals in class Vecpublic final void clear()
Vecpublic final double normF()
Vecpublic final Vec copyPermuteColumns(Permutation p)
VeccopyPermuteColumns in class Vec