Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Francesco Brarda
stan-math-petsc
Commits
40418f97
Commit
40418f97
authored
6 years ago
by
rok-cesnovar
Browse files
Options
Download
Email Patches
Plain Diff
fixes based on Steve's comments
parent
31cb96a4
stan-petsc
bugfix/issue-1250-lgamma
bugfix/issue-1270-add-check-for-meta-includes
code-cleanup/chain-final
code-cleanup/issue-937-flatten
develop
feature/1258-ad-test-core
feature/concept-chainable-allocator
feature/eigen-aligned-malloc
feature/faster-ad-tls-v4
feature/faster-ad-tls-v4-windows
feature/faster-ad-tls-v6
feature/intel-tbb-lib
feature/issue-1115-newton_solver
feature/issue-1257-diff_algebra_solver
feature/issue-755-laplace
feature/issue-937-flatten-meta-again
feature/issue-937-flatten-meta-the-third
feature/issue-937-flatten-meta-third
feature/issue-989-rev-mat-eig
feature/lambertw
feature/python-test-math-dependencies
feature/sparse-cholesky
internal/no-assert
issue-static-init-order
master
parallel-ad-tape-3
release/v2.19.0
release/v2.19.1
release/v2.20.0
stancon/syclik
syclik/forward-mode
v2.20.0
v2.19.1
v2.19.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
stan/math/rev/mat/fun/cholesky_decompose.hpp
+10
-15
stan/math/rev/mat/fun/cholesky_decompose.hpp
with
10 additions
and
15 deletions
+10
-15
stan/math/rev/mat/fun/cholesky_decompose.hpp
View file @
40418f97
...
...
@@ -323,16 +323,14 @@ class cholesky_opencl : public vari {
*/
virtual
void
chain
()
{
int
packed_size
=
M_
*
(
M_
+
1
)
/
2
;
std
::
vector
<
double
>
L_adj_cpu
(
packed_size
);
std
::
vector
<
double
>
L_val_cpu
(
packed_size
);
std
::
vector
<
double
>
L_adj_cpu
;
L_adj_cpu
.
reserve
(
packed_size
);
std
::
vector
<
double
>
L_val_cpu
;
L_val_cpu
.
reserve
(
packed_size
);
size_t
pos
=
0
;
for
(
size_type
j
=
0
;
j
<
M_
;
++
j
)
{
for
(
size_type
i
=
j
;
i
<
M_
;
++
i
)
{
L_adj_cpu
[
pos
]
=
vari_ref_L_
[
pos
]
->
adj_
;
L_val_cpu
[
pos
]
=
vari_ref_L_
[
pos
]
->
val_
;
++
pos
;
}
for
(
size_type
j
=
0
;
j
<
packed_size
;
++
j
)
{
L_adj_cpu
[
j
]
=
vari_ref_L_
[
j
]
->
adj_
;
L_val_cpu
[
j
]
=
vari_ref_L_
[
j
]
->
val_
;
}
matrix_cl
L
(
M_
,
M_
);
matrix_cl
L_adj
(
M_
,
M_
);
...
...
@@ -389,12 +387,9 @@ class cholesky_opencl : public vari {
L_adj
.
sub_block
(
C_adj
,
0
,
0
,
k
,
j
,
m_k_ind
,
k_j_ind
);
}
packed_copy
<
TriangularViewCL
::
Lower
>
(
L_adj_cpu
,
L_adj
);
pos
=
0
;
for
(
size_type
j
=
0
;
j
<
M_
;
++
j
)
for
(
size_type
i
=
j
;
i
<
M_
;
++
i
)
{
vari_ref_A_
[
pos
]
->
adj_
+=
L_adj_cpu
[
pos
];
pos
++
;
}
for
(
size_type
j
=
0
;
j
<
packed_size
;
++
j
)
{
vari_ref_A_
[
j
]
->
adj_
+=
L_adj_cpu
[
j
];
}
}
};
#endif
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help