1- module AffineHR
2- using .. CUDA
3- using .. DocStringExtensions
4- using SparseArrays
5-
6- import .. COBREXA
7- import .. TeaRNG
8- import Random
91
102function random_mix_matrix (npts, mix_points)
113 mtx = sparse (
@@ -48,19 +40,21 @@ present.
4840If you are generating a sample of the optimal model solution, it is expected
4941that the optimum bound is already present in `m`.
5042
51- Returns a matrix of the same size as `start `.
43+ Returns blocks of the same size as `sample_c `.
5244"""
53- function sample (
54- m:: COBREXA.MetabolicModel ,
55- start:: AbstractMatrix ;
56- iters:: Int ,
57- bound_stoichiometry:: Bool = false ,
58- check_stoichiometry:: Bool = true ,
59- direction_noise_max:: Union{Nothing,Float32} = nothing ,
60- epsilon:: Float32 = 1.0f-5 ,
61- seed = Random. rand (UInt32),
45+ function sample_chain_affine_hr_cuda (
46+ sample_c:: COBREXA.M ;
47+ variable_lower_bounds:: COBREXA.V ,
48+ variable_upper_bounds:: COBREXA.V ,
49+ constraints:: COBREXA.SM ,
50+ lower_bounds:: COBREXA.V ,
51+ upper_bounds:: COBREXA.V ,
52+ epsilon:: Float32 = COBREXA. configuration. sampler_tolerance,
53+ collect_iterations:: Vector{Int} ,
54+ generator:: StableRNG ,
6255 mix_points = 3 ,
63- mix_mtx = random_mix_matrix (size (start, 2 ), mix_points),
56+ mix_mtx = random_mix_matrix (size (sample_c, 2 ), mix_points),
57+ direction_noise_max:: Union{Nothing,Float32} = nothing ,
6458)
6559 # allocate base helper variables
6660 npts = size (start, 2 )
@@ -163,7 +157,7 @@ function sample(
163157 lmax .= min .(lmax, minimum (ifelse .(isfinite .(clmaxs), clmaxs, Inf32 ), dims = 1 ))
164158 end
165159
166- # generate random lambdas and compute new points
160+ # generate random lambdas and compute new points
167161 @cuda threads = 256 blocks = 32 TeaRNG. device_fill_rand! (
168162 lws,
169163 seed + UInt32 (iter * 2 + 1 ),
@@ -183,5 +177,3 @@ function sample(
183177
184178 collect (pts)
185179end
186-
187- end # module AffineHR
0 commit comments