mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-12-22 12:23:31 +01:00
Accelerated FCI
This commit is contained in:
parent
4de337619f
commit
43ee562711
2
CI/CI.ml
2
CI/CI.ml
@ -490,7 +490,7 @@ let make ?(n_states=1) ?(algo=`Direct) det_space =
|
||||
in
|
||||
let matrix_prod psi =
|
||||
let result =
|
||||
Matrix.parallel_mm ~transa:`T psi m_H
|
||||
Matrix.parallel_mm ~transa:`T ~transb:`T psi m_H
|
||||
|> Matrix.transpose
|
||||
in
|
||||
Parallel.broadcast (lazy result)
|
||||
|
@ -201,7 +201,8 @@ let rec mm ?(transa=`N) ?(transb=`N) ?(threshold=epsilon) a b =
|
||||
| `N, `T -> dim2, dim2
|
||||
in
|
||||
if f a <> f' b then
|
||||
invalid_arg "Inconsistent dimensions";
|
||||
Printf.sprintf "%d %d : Inconsistent dimensions" (f a) (f' b)
|
||||
|> invalid_arg;
|
||||
|
||||
(* Dense x sparse *)
|
||||
let mmsp transa transb a b =
|
||||
@ -560,16 +561,21 @@ let parallel_mm ?(transa=`N) ?(transb=`N) ?(threshold=epsilon) a b =
|
||||
| `N -> dim2 a
|
||||
| `T -> dim1 a
|
||||
in
|
||||
let n = n / (Parallel.size * 4) in
|
||||
let n = n / (Parallel.size * 7) in
|
||||
let b =
|
||||
match transb with
|
||||
| `T -> transpose b
|
||||
| `N -> b
|
||||
in
|
||||
split_cols n b
|
||||
|> Stream.of_list
|
||||
|> Farm.run ~ordered:true ~f:(fun b ->
|
||||
match a, b with
|
||||
| Computed _, Computed _ ->
|
||||
mm ~transa ~transb ~threshold a b
|
||||
mm ~transa ~threshold a b
|
||||
|> sparse_of_computed ~threshold
|
||||
| _ ->
|
||||
mm ~transa ~transb ~threshold a b
|
||||
mm ~transa ~threshold a b
|
||||
)
|
||||
|> Util.stream_to_list
|
||||
|> join_cols
|
||||
|
Loading…
Reference in New Issue
Block a user