Create parameters for computing an SVD.
opt=bbsvdopt(bb) | |
opt=bbsvdopt(bb,opt) | |
opt=bbsvdopt(bb,l) | |
opt=bbsvdopt(bb,l,opt) | |
opt=bbsvdopt(bb,l,trip) | |
opt=bbsvdopt(bb,l,trip,opt) |
bbsvdopt
creates a set of parameters that can be passed
to
bbsvds
and
bbsvdf
.
It tries to determine a good default strategy that suits the computation
on hand.
bbsvdopt
fill in default values for the parameters that
are not set explicitly in opt
, but does not not change any
fields found in the input-structure. The argument trip
may
also be given as a field in opt
.
Although it is unnecessary to use bbsvdopt
explicitly, it
is provided as a separate function for the cases where it is necessary to
tune the computation. This most common situation is that a computation
takes up more memory than is available.
In this case, it is much easier to construct a set of options by
building on the defaults rather than starting from scratch. It can also
be used to investigate exactly how
bbsvds
and
bbsvdf
plan to cope with the given
problem.
bb |
Black-box operator or matrix |
opt |
Structure with options for the SVD |
l |
Number of singular values or triplets to compute |
trip |
true if singular triplets are requiredfalse if only singular values are needed. |
The output is a structure suitable to be passed to bbsvds
, bbsvdf
,
and bbsvdmem
.
This will only discuss the most important parameters to understand. The full list of parameters are given in the reference documentation.
Parameter: | trip [true | false ]
|
---|---|
Determine whether singular triplets should be computed. |
It is important to set trip
correctly.
If singular vectors are wanted, and trip
is false
, then the
singular vectors may not be mutually orthogonal. Conversely, if trip
is
true
and the singular vectors are not required, then the computation may
use a massive amount of resources (time and memory) without any benefits.
bbsvds
returns empty singular matrices if
trip=false
. This protect a user from getting inaccurate results
inadvertently. Note that the actual algorithm can be overruled, irrespective of
trip
.
Caveat: if singular vectors are computed, and
trip
is set correctly
--
to be precise if
dsides=2
--
then the singular triplets are numerically mutually orthogonal. However, due to rounding
errors, triplets with very small singular values may be less orthogonal to each other
than what can be achieved for most of the triplets.
See the reference documentation
for an elaboration of this.
Parameter: | disp [-1 | 0 | 1 | 2 ]
|
---|---|
Verbosity level. |
By default, disp=1
, the routines regularly shows how far they are in
the computation. Instead, disp=-1
should quench almost any output,
while disp=0
only shows the most important information.
In the other end, disp=2
shows more details more often. It is intended
for parameter tuning and debugging.
Parameter: | mem [scalar]
|
---|---|
Available memory, in megabytes. Default: unlimited. |
Normally, BBTools expects that a sufficient amount of memory is present to complete a computation reasonably efficiently. For large-scale problems, it may be necessary to use a strategy that use a reduced amount of memory.
mem
is only suggestive, and is the last priority that will be honored.
Use bbsvdmem
to estimate the actual requirement.
Parameter: | atol [scalar]
|
---|---|
Absolute tolerance of convergence. |
atol
specifies the absolute accuracy of the singular
values before a triplets is deemed to converge. That is, if the computation returns
a singular value, σ, then it satisfies
|σ-σ0|≤atol
, where
σ0 is an exact singular value.
(This only holds if rounding errors are negligible.)
It is rarely necessary to set this parameter manually, provided bb
is correctly implemented. Although it is possible to gain some speed by relaxing
the tolerance, the speedup is rarely significant if more than a few singular values
are requested. (BBTools must find the vectors to the attainable accuracy in order to
extract the remaining triplets).
However, one may decrease atol
to a level that is lower than the
guaranteed level of accuracy (the default). Although nothing is guaranteed, it is
often possible to get surprisingly accurate results. This, however, comes at a
somewhat high cost.
The following code creates a 25000×50000 black-box operator and determine a set of parameters for extracting either 200 singular values or full triplets:
bb=bbkron(randn(100),randn(250,500)); | |
opt1=bbsvdopt(bb,200,false); | |
opt2=bbsvdopt(bb,200,true) |