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.
|
plusEquals
public int length
public int[] indices
public double[] values
public int nz
int lastGetIdx
int lastSetIdx
static final int MIN_SIZE
public final double[] getDoubles()
Vec
getDoubles
in class Vec
public final void filterZeros()
public final void filterZeros(double eps)
final void insert(int i, int idx, double v)
public final void resize(int newlength)
Vec
final void sort()
public final void ensureCapacity(int mincapacity)
final void grow()
final void grow(int mincapacity)
public final CSRVec copy(int i0, int i1)
Vec
public final Vec copyPart(int i0, int i1)
Vec
public final int size()
Vec
public final int getNz()
Vec
public final double get(int idx)
Vec
public final double getRef(int idx)
public final void set(int idx, double v)
Vec
public final void setRef(int idx, double v)
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 static final void add(CSRVec csra, double ascale, CSRVec csrb, int i0, int i1, CSRVec res)
public final void addTo(Vec _r, double scale)
Vec
public final void addTo(Vec _r, double scale, int i0, int i1)
public final void plusEquals(int idx, double v)
Vec
plusEquals
in class Vec
public final void clear()
Vec
public final double normF()
Vec
public final Vec copyPermuteColumns(Permutation p)
Vec
copyPermuteColumns
in class Vec