Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F87437608
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
Sat, Oct 12, 16:48
Size
1 KB
Mime Type
text/x-c
Expires
Mon, Oct 14, 16:48 (2 d)
Engine
blob
Format
Raw Data
Handle
21598036
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