-
Notifications
You must be signed in to change notification settings - Fork 1
/
linear_samplers.jl
186 lines (154 loc) · 5.83 KB
/
linear_samplers.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
############################################################################################
## This file is part of RLinearAlgebra.jl
##
## Overview: abstractions and methods for sampling, sketching or selecting from linear
## systems of equations.
##
## Contents
## - Abstract Types
## - `sample` function documentation
## - Vector Row Sampler/Sketch/Selector
## - Vector Column Sampler/Sketch/Selector
## - Block Row Sampler/Sketch/Selector
## - Block Column Sampler/Sketch/Selector
## - Export Statements
##
############################################################################################
# Dependencies: Random, Distributions, LinearAlgebra
#############################################
# Abstract Types
#############################################
"""
LinSysSampler
Abstract supertype for sampling, sketching or deterministically selecting components
of a linear system.
# Aliases
- `LinSysSketch`
- `LinSysSelect`
"""
abstract type LinSysSampler end
LinSysSketch = LinSysSampler
LinSysSelect = LinSysSampler
"""
LinSysVecRowSampler <: LinSysSampler
Abstract supertype for sampling, sketching or deterministically selecting a row space
element from a linear system.
# Aliases
- `LinSysVecRowSketch`
- `LinSysVecRowSelect`
"""
abstract type LinSysVecRowSampler <: LinSysSampler end
LinSysVecRowSketch = LinSysVecRowSampler
LinSysVecRowSelect = LinSysVecRowSampler
"""
LinSysVecColSampler <: LinSysSampler
Abstract supertype for sampling, sketching or deterministically selecting a column space
element from a linear system.
# Aliases
- `LinSysVecColSketch`
- `LinSysVecColSelect`
"""
abstract type LinSysVecColSampler <: LinSysSampler end
LinSysVecColSketch = LinSysVecColSampler
LinSysVecColSelect = LinSysVecColSampler
"""
LinSysBlkRowSampler <: LinSysSampler
Abstract supertype for sampling, sketching or deterministically selecting a collection of
row space elements from a linear system.
# Aliases
- `LinSysBlkRowSketch`
- `LinSysBlkRowSelect`
"""
abstract type LinSysBlkRowSampler <: LinSysSampler end
LinSysBlkRowSketch = LinSysBlkRowSampler
LinSysBlkRowSelect = LinSysBlkRowSampler
"""
LinSysBlkColSampler <: LinSysSampler
Abstract supertype for sampling, sketching or deterministically selecting a collection of
column space elements from a linear system.
# Aliases
- `LinSysBlkColSketch`
- `LinSysBlkColSelect`
"""
abstract type LinSysBlkColSampler <: LinSysSampler end
LinSysBlkColSketch = LinSysBlkColSampler
LinSysBlkColSelect = LinSysBlkColSampler
#############################################
# `sample` Function Documentation
#############################################
"""
sample(type::T where T<:LinSysSampler,
A::AbstractArray,
b::AbstractVector,
x::AbstractVector,
iter::Int64)
A common interface for specifying different strategies for sampling, selecting or sketching
a linear system specified by `A` and `b`. The `type` argument is used to select the an
appropriately defined strategy. The argument `x` is the current iterate value for the
solution. The arguent `iter` is the iteration counter.
The value(s) returned by sample depend on the subtype of `LinSysSampler` being used.
Specifically,
- For `T<:LinSysVecRowSampler`, a vector in the row space of `A` and constant are returned
- For `T<:LinSysVecColSampler`, a vector of `length(x)`, the matrix `A`,
and a scalar-valued residual are returned.
"""
function sample(
type::Nothing,
A::AbstractArray,
b::AbstractVector,
x::AbstractVector,
iter::Int64
)
return nothing
end
#############################################
# Vector Row Sampler/Sketch/Selector
#############################################
# Non-adaptive Cyclic Methods
include("linear_samplers/vec_row_deterministic_cyclic.jl")
include("linear_samplers/vec_row_one_rand_cyclic.jl")
include("linear_samplers/vec_row_hop_rand_cyclic.jl")
include("linear_samplers/vec_row_rand_cyclic.jl")
# Non-adaptive Sampling (with replacement)
include("linear_samplers/vec_row_unid_replace.jl")
include("linear_samplers/vec_row_prop_to_norm_replace.jl")
# Non-adaptive Sketching
include("linear_samplers/vec_row_uniform.jl")
include("linear_samplers/vec_row_gaussian.jl")
include("linear_samplers/vec_row_uniform_sparse.jl")
include("linear_samplers/vec_row_gaussian_sparse.jl")
#include("linear_samplers/vec_row_uniform_sym_sparse.jl")
#include("linear_samplers/vec_row_uniform_sym.jl")
# Adaptive Deterministic Selection
include("linear_samplers/vec_row_max_residual.jl")
include("linear_samplers/vec_row_max_distance.jl")
# Adaptive Cyclic Methods
include("linear_samplers/vec_row_cyclic_residual.jl")
include("linear_samplers/vec_row_cyclic_distance.jl")
#############################################
# Vector Column Sampler/Sketch/Selector
#############################################
# Non-adaptive Cyclic Methods
include("linear_samplers/vec_col_deterministic_cyclic.jl")
include("linear_samplers/vec_col_one_rand_cyclic.jl")
# Non-adaptive Sampling (with replacement)
#Leventhal-Lewis (non-symmetric)
#############################################
# Block Row Sampler/Sketch/Selector
#############################################
#############################################
# Block Column Sampler/Sketch/Selector
#############################################
#############################################
# Compositional Sampler/Sketch/Selector
#############################################
# Wishlist
#############################################
# Export Statements
#############################################
# See RLinearAlgebra.jl
#export LinSysSampler, LinSysSketch, LinSysSelect
#export LinSysVecRowSampler, LinSysVecRowSketch, LinSysVecRowSelect
#export LinSysVecColSampler, LinSysVecColSketch, LinSysVecColSelect
#export LinSysBlkRowSampler, LinSysBlkRowSketch, LinSysBlkRowSelect
#export LinSysBlkColSampler, LinSysBlkColSketch, LinSysBlkColSelect