Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121821587
ReadModelComputer.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jul 14, 04:11
Size
1 KB
Mime Type
text/x-c
Expires
Wed, Jul 16, 04:11 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27396535
Attached To
R8820 scATAC-seq
ReadModelComputer.cpp
View Options
#include <utility>
// std::move()
#include <ReadModelComputer.hpp>
#include <Matrix2D.hpp>
#include <Matrix4D.hpp>
#include <ReadLayer.hpp>
#include <ThreadPool.hpp>
#include <iostream>
ReadModelComputer
::
ReadModelComputer
(
Matrix2D
<
int
>&&
data
,
const
Matrix4D
<
double
>&
post_prob
,
size_t
n_threads
)
:
ModelComputer
(),
threads
(
nullptr
)
{
// parameters
size_t
n_class
=
post_prob
.
get_dim
()[
1
]
;
size_t
n_shift
=
post_prob
.
get_dim
()[
2
]
;
size_t
n_flip
=
post_prob
.
get_dim
()[
3
]
;
bool
flip
=
n_flip
==
2
;
// the threads
if
(
n_threads
)
{
this
->
threads
=
new
ThreadPool
(
n_threads
)
;
}
// the data and the model
this
->
data_layer
=
new
ReadLayer
(
std
::
move
(
data
),
n_class
,
n_shift
,
flip
)
;
this
->
data_layer
->
update_model
(
post_prob
,
this
->
threads
)
;
}
ReadModelComputer
::~
ReadModelComputer
()
{
// threads
if
(
this
->
threads
!=
nullptr
)
{
this
->
threads
->
join
()
;
delete
this
->
threads
;
this
->
threads
=
nullptr
;
}
// data and model
if
(
this
->
data_layer
!=
nullptr
)
{
delete
this
->
data_layer
;
this
->
data_layer
=
nullptr
;
}
}
Event Timeline
Log In to Comment