forked from cp2k/dbcsr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbcsr_api.F
1428 lines (1176 loc) · 65.9 KB
/
dbcsr_api.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!--------------------------------------------------------------------------------------------------!
! Copyright (C) by the DBCSR developers group - All rights reserved !
! This file is part of the DBCSR library. !
! !
! For information on the license, see the LICENSE file. !
! For further information please visit https://dbcsr.cp2k.org !
! SPDX-License-Identifier: GPL-2.0+ !
!--------------------------------------------------------------------------------------------------!
MODULE dbcsr_api
!! This is the start of a dbcsr_api, all publicly needed functions
!! are exported here. The others remain private to the library.
!! Currently, this is the CP2K used set.
!! Ultimately, a reduced subset and well defined api will remain,
!! possibly grouped in to standard and expert api.
!! Currently, this is work in progress.
USE dbcsr_array_types, ONLY: array_data, &
array_exists, &
array_size
USE dbcsr_block_access, ONLY: dbcsr_get_block_p_prv => dbcsr_get_block_p, &
dbcsr_put_block_prv => dbcsr_put_block, &
dbcsr_reserve_all_blocks_prv => dbcsr_reserve_all_blocks, &
dbcsr_reserve_block2d_prv => dbcsr_reserve_block2d, &
dbcsr_reserve_blocks_prv => dbcsr_reserve_blocks, &
dbcsr_reserve_diag_blocks_prv => dbcsr_reserve_diag_blocks
USE dbcsr_config, ONLY: dbcsr_get_default_config, &
dbcsr_print_config, &
dbcsr_set_config
USE dbcsr_csr_conversions, ONLY: &
convert_csr_to_dbcsr_prv => convert_csr_to_dbcsr, &
convert_dbcsr_to_csr_prv => convert_dbcsr_to_csr, &
csr_create_from_dbcsr_prv => csr_create_from_dbcsr, csr_create_new, &
csr_create_template, dbcsr_csr_dbcsr_blkrow_dist => csr_dbcsr_blkrow_dist, &
dbcsr_csr_destroy => csr_destroy, dbcsr_csr_eqrow_ceil_dist => csr_eqrow_ceil_dist, &
dbcsr_csr_eqrow_floor_dist => csr_eqrow_floor_dist, dbcsr_csr_p_type => csr_p_type, &
dbcsr_csr_print_sparsity => csr_print_sparsity, dbcsr_csr_type => csr_type, &
dbcsr_csr_write => csr_write, &
dbcsr_to_csr_filter_prv => dbcsr_to_csr_filter
USE dbcsr_data_methods, ONLY: dbcsr_get_data_p_prv => dbcsr_get_data_p, &
dbcsr_scalar, &
dbcsr_scalar_fill_all, &
dbcsr_scalar_get_type, &
dbcsr_scalar_get_value, &
dbcsr_scalar_set_type, &
dbcsr_scalar_zero
USE dbcsr_dist_methods, ONLY: dbcsr_distribution_get_num_images => dbcsr_distribution_get_num_images_1d, &
dbcsr_distribution_hold_prv => dbcsr_distribution_hold, &
dbcsr_distribution_new_prv => dbcsr_distribution_new, &
dbcsr_distribution_release_prv => dbcsr_distribution_release, &
dbcsr_distribution_get_prv => dbcsr_distribution_get
USE dbcsr_dist_operations, ONLY: dbcsr_get_stored_coordinates_prv => dbcsr_get_stored_coordinates
USE dbcsr_io, ONLY: dbcsr_binary_read_prv => dbcsr_binary_read, &
dbcsr_binary_write_prv => dbcsr_binary_write, &
dbcsr_print_block_sum_prv => dbcsr_print_block_sum, &
dbcsr_print_prv => dbcsr_print
USE dbcsr_iterator_operations, ONLY: dbcsr_iterator_blocks_left_prv => dbcsr_iterator_blocks_left, &
dbcsr_iterator_next_block_prv => dbcsr_iterator_next_block, &
dbcsr_iterator_start_prv => dbcsr_iterator_start, &
dbcsr_iterator_stop_prv => dbcsr_iterator_stop
USE dbcsr_lib, ONLY: dbcsr_clear_mempools, &
dbcsr_finalize_lib, &
dbcsr_init_lib, dbcsr_print_statistics_prv => dbcsr_print_statistics
USE dbcsr_methods, ONLY: &
dbcsr_get_data_size_prv => dbcsr_get_data_size, &
dbcsr_get_data_type_prv => dbcsr_get_data_type, &
dbcsr_get_matrix_type_prv => dbcsr_get_matrix_type, &
dbcsr_get_num_blocks_prv => dbcsr_get_num_blocks, &
dbcsr_has_symmetry_prv => dbcsr_has_symmetry, &
dbcsr_nblkcols_total_prv => dbcsr_nblkcols_total, &
dbcsr_nblkrows_total_prv => dbcsr_nblkrows_total, &
dbcsr_nfullcols_total_prv => dbcsr_nfullcols_total, &
dbcsr_nfullrows_total_prv => dbcsr_nfullrows_total, &
dbcsr_release_prv => dbcsr_release, &
dbcsr_setname_prv => dbcsr_setname, &
dbcsr_valid_index_prv => dbcsr_valid_index, dbcsr_wm_use_mutable
USE dbcsr_mp_methods, ONLY: dbcsr_mp_grid_setup_prv => dbcsr_mp_grid_setup, &
dbcsr_mp_group, &
dbcsr_mp_new_prv => dbcsr_mp_new, &
dbcsr_mp_release
USE dbcsr_multiply_api, ONLY: dbcsr_multiply_prv => dbcsr_multiply
USE dbcsr_operations, ONLY: &
dbcsr_add_on_diag_prv => dbcsr_add_on_diag, &
dbcsr_add_prv => dbcsr_add, &
dbcsr_copy_into_existing_prv => dbcsr_copy_into_existing, &
dbcsr_copy_prv => dbcsr_copy, &
dbcsr_filter_prv => dbcsr_filter, &
dbcsr_frobenius_norm_prv => dbcsr_frobenius_norm, &
dbcsr_function_of_elements_prv => dbcsr_function_of_elements, &
dbcsr_gershgorin_norm_prv => dbcsr_gershgorin_norm, &
dbcsr_get_block_diag_prv => dbcsr_get_block_diag, &
dbcsr_get_diag_prv => dbcsr_get_diag, &
dbcsr_get_info_prv => dbcsr_get_info, &
dbcsr_get_occupation_prv => dbcsr_get_occupation, &
dbcsr_hadamard_product_prv => dbcsr_hadamard_product, &
dbcsr_init_random_prv => dbcsr_init_random, &
dbcsr_maxabs_prv => dbcsr_maxabs, &
dbcsr_norm_scalar_prv => dbcsr_norm_scalar, &
dbcsr_norm_r8_vec_prv => dbcsr_norm_r8_vec, &
dbcsr_scale_by_vector_prv => dbcsr_scale_by_vector, &
dbcsr_scale_prv => dbcsr_scale, &
dbcsr_set_diag_prv => dbcsr_set_diag, &
dbcsr_set_prv => dbcsr_set, &
dbcsr_sum_replicated_prv => dbcsr_sum_replicated, &
dbcsr_trace_prv => dbcsr_trace, &
dbcsr_dot_prv => dbcsr_dot, &
dbcsr_triu_prv => dbcsr_triu, &
dbcsr_clear_prv => dbcsr_clear, &
dbcsr_add_block_node_prv => dbcsr_add_block_node, &
dbcsr_conform_scalar_prv => dbcsr_conform_scalar
USE dbcsr_test_methods, ONLY: dbcsr_reset_randmat_seed
USE dbcsr_tests, ONLY: dbcsr_run_tests, &
dbcsr_test_binary_io, &
dbcsr_test_mm
USE dbcsr_string_utilities, ONLY: uppercase
USE dbcsr_transformations, ONLY: dbcsr_complete_redistribute_prv => dbcsr_complete_redistribute, &
dbcsr_desymmetrize_deep_prv => dbcsr_desymmetrize_deep, &
dbcsr_distribute_prv => dbcsr_distribute, &
dbcsr_new_transposed_prv => dbcsr_new_transposed, &
dbcsr_replicate_all_prv => dbcsr_replicate_all, &
dbcsr_transposed_prv => dbcsr_transposed
USE dbcsr_types, ONLY: &
dbcsr_dist_prv_obj => dbcsr_distribution_obj, dbcsr_func_artanh, dbcsr_func_dtanh, &
dbcsr_func_inverse, dbcsr_func_tanh, dbcsr_iterator_prv => dbcsr_iterator, dbcsr_mp_obj, &
dbcsr_no_transpose, dbcsr_norm_column, dbcsr_norm_frobenius, dbcsr_norm_maxabsnorm, &
dbcsr_prv_type => dbcsr_type, dbcsr_scalar_type, dbcsr_transpose, &
dbcsr_type_antisymmetric, dbcsr_type_complex_4, dbcsr_type_complex_8, &
dbcsr_type_complex_default, dbcsr_type_no_symmetry, dbcsr_type_real_4, dbcsr_type_real_8, &
dbcsr_type_real_default, dbcsr_type_symmetric
USE dbcsr_dist_util, ONLY: dbcsr_convert_offsets_to_sizes => convert_offsets_to_sizes, &
dbcsr_convert_sizes_to_offsets => convert_sizes_to_offsets, &
dbcsr_checksum_prv => dbcsr_checksum, &
dbcsr_verify_matrix_prv => dbcsr_verify_matrix
USE dbcsr_work_operations, ONLY: add_work_coordinate_prv => add_work_coordinate, &
dbcsr_create_prv => dbcsr_create, &
dbcsr_finalize_prv => dbcsr_finalize, &
dbcsr_work_create_prv => dbcsr_work_create
USE dbcsr_kinds, ONLY: default_string_length, &
dp, &
int_8, &
real_4, &
real_8
USE dbcsr_mpiwrap, ONLY: mp_cart_rank, &
mp_environ
!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads
#include "base/dbcsr_base_uses.f90"
IMPLICIT NONE
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'dbcsr_api'
! constants
PUBLIC :: dbcsr_type_no_symmetry
PUBLIC :: dbcsr_type_symmetric
PUBLIC :: dbcsr_type_antisymmetric
PUBLIC :: dbcsr_transpose
PUBLIC :: dbcsr_no_transpose
PUBLIC :: dbcsr_type_complex_8
PUBLIC :: dbcsr_type_real_4
PUBLIC :: dbcsr_type_real_8
PUBLIC :: dbcsr_type_complex_4
PUBLIC :: dbcsr_type_complex_default
PUBLIC :: dbcsr_type_real_default
! types
PUBLIC :: dbcsr_type
PUBLIC :: dbcsr_p_type
PUBLIC :: dbcsr_distribution_type
PUBLIC :: dbcsr_iterator_type
PUBLIC :: dbcsr_scalar_type
! lib init/finalize
PUBLIC :: dbcsr_clear_mempools
PUBLIC :: dbcsr_init_lib
PUBLIC :: dbcsr_finalize_lib
PUBLIC :: dbcsr_set_config
PUBLIC :: dbcsr_get_default_config
PUBLIC :: dbcsr_print_config
PUBLIC :: dbcsr_reset_randmat_seed
PUBLIC :: dbcsr_mp_grid_setup
PUBLIC :: dbcsr_print_statistics
! create / release
PUBLIC :: dbcsr_distribution_hold
PUBLIC :: dbcsr_distribution_release
PUBLIC :: dbcsr_distribution_new
PUBLIC :: dbcsr_create
PUBLIC :: dbcsr_init_p
PUBLIC :: dbcsr_release
PUBLIC :: dbcsr_release_p
PUBLIC :: dbcsr_deallocate_matrix
! primitive matrix operations
PUBLIC :: dbcsr_set
PUBLIC :: dbcsr_add
PUBLIC :: dbcsr_scale
PUBLIC :: dbcsr_scale_by_vector
PUBLIC :: dbcsr_transposed
PUBLIC :: dbcsr_multiply
PUBLIC :: dbcsr_copy
PUBLIC :: dbcsr_copy_into_existing
PUBLIC :: dbcsr_desymmetrize
PUBLIC :: dbcsr_add_on_diag
PUBLIC :: dbcsr_get_block_diag
PUBLIC :: dbcsr_set_diag
PUBLIC :: dbcsr_get_diag
PUBLIC :: dbcsr_filter
PUBLIC :: dbcsr_trace
PUBLIC :: dbcsr_dot
PUBLIC :: dbcsr_complete_redistribute
PUBLIC :: dbcsr_get_block_p
PUBLIC :: dbcsr_clear
! block reservation
PUBLIC :: dbcsr_reserve_diag_blocks
PUBLIC :: dbcsr_reserve_block2d
PUBLIC :: dbcsr_reserve_blocks
PUBLIC :: dbcsr_reserve_all_blocks
! iterator
PUBLIC :: dbcsr_iterator_start
PUBLIC :: dbcsr_iterator_stop
PUBLIC :: dbcsr_iterator_blocks_left
PUBLIC :: dbcsr_iterator_next_block
! getters / setters
PUBLIC :: dbcsr_get_info
PUBLIC :: dbcsr_distribution_get
PUBLIC :: dbcsr_setname
PUBLIC :: dbcsr_get_matrix_type
PUBLIC :: dbcsr_get_occupation
PUBLIC :: dbcsr_nblkrows_total
PUBLIC :: dbcsr_nblkcols_total
PUBLIC :: dbcsr_get_num_blocks
PUBLIC :: dbcsr_get_data_size
PUBLIC :: dbcsr_has_symmetry
PUBLIC :: dbcsr_nfullrows_total
PUBLIC :: dbcsr_nfullcols_total
PUBLIC :: dbcsr_get_stored_coordinates
PUBLIC :: dbcsr_valid_index
PUBLIC :: dbcsr_get_data_type
! work operations
PUBLIC :: dbcsr_add_block_node
PUBLIC :: dbcsr_put_block
PUBLIC :: dbcsr_work_create
PUBLIC :: dbcsr_verify_matrix
PUBLIC :: dbcsr_add_work_coordinate
PUBLIC :: dbcsr_get_wms_data_p
PUBLIC :: dbcsr_get_data_p
PUBLIC :: dbcsr_set_work_size
PUBLIC :: dbcsr_finalize
! replication
PUBLIC :: dbcsr_replicate_all
PUBLIC :: dbcsr_sum_replicated
PUBLIC :: dbcsr_distribute
! misc
PUBLIC :: dbcsr_distribution_get_num_images
PUBLIC :: dbcsr_convert_offsets_to_sizes
PUBLIC :: dbcsr_convert_sizes_to_offsets
PUBLIC :: dbcsr_run_tests
PUBLIC :: dbcsr_test_mm
PUBLIC :: dbcsr_scalar
! high level matrix functions
PUBLIC :: dbcsr_norm_frobenius
PUBLIC :: dbcsr_norm_maxabsnorm
PUBLIC :: dbcsr_norm_column
PUBLIC :: dbcsr_hadamard_product
PUBLIC :: dbcsr_func_artanh
PUBLIC :: dbcsr_func_dtanh
PUBLIC :: dbcsr_func_inverse
PUBLIC :: dbcsr_func_tanh
PUBLIC :: dbcsr_print
PUBLIC :: dbcsr_print_block_sum
PUBLIC :: dbcsr_checksum
PUBLIC :: dbcsr_maxabs
PUBLIC :: dbcsr_norm
PUBLIC :: dbcsr_gershgorin_norm
PUBLIC :: dbcsr_frobenius_norm
PUBLIC :: dbcsr_init_random
PUBLIC :: dbcsr_function_of_elements
PUBLIC :: dbcsr_triu
! csr conversion
PUBLIC :: dbcsr_csr_type
PUBLIC :: dbcsr_csr_p_type
PUBLIC :: dbcsr_convert_csr_to_dbcsr
PUBLIC :: dbcsr_convert_dbcsr_to_csr
PUBLIC :: dbcsr_csr_create_from_dbcsr
PUBLIC :: dbcsr_csr_destroy
PUBLIC :: dbcsr_csr_create
PUBLIC :: dbcsr_csr_eqrow_floor_dist
PUBLIC :: dbcsr_csr_eqrow_ceil_dist
PUBLIC :: dbcsr_csr_dbcsr_blkrow_dist
PUBLIC :: dbcsr_csr_print_sparsity
PUBLIC :: dbcsr_to_csr_filter
PUBLIC :: dbcsr_csr_write
! binary io
PUBLIC :: dbcsr_binary_write
PUBLIC :: dbcsr_binary_read
PUBLIC :: dbcsr_test_binary_io
! -----------------------------------------------------------------------------------------------
TYPE dbcsr_p_type
TYPE(dbcsr_type), POINTER :: matrix => Null()
END TYPE dbcsr_p_type
! the components of this type must remain private to encapsulate better the internals
! of the dbcsr library.
TYPE dbcsr_type
TYPE(dbcsr_prv_type), PRIVATE :: prv
END TYPE dbcsr_type
TYPE dbcsr_distribution_type
TYPE(dbcsr_dist_prv_obj), PRIVATE :: prv
END TYPE dbcsr_distribution_type
TYPE dbcsr_iterator_type
TYPE(dbcsr_iterator_prv), PRIVATE :: prv
END TYPE dbcsr_iterator_type
INTERFACE dbcsr_create
MODULE PROCEDURE dbcsr_create_new, dbcsr_create_template
END INTERFACE
INTERFACE dbcsr_trace
MODULE PROCEDURE dbcsr_trace_d, dbcsr_trace_s
MODULE PROCEDURE dbcsr_trace_z, dbcsr_trace_c
END INTERFACE
INTERFACE dbcsr_dot
MODULE PROCEDURE dbcsr_dot_d, dbcsr_dot_s
MODULE PROCEDURE dbcsr_dot_z, dbcsr_dot_c
END INTERFACE
INTERFACE dbcsr_set
MODULE PROCEDURE dbcsr_set_d, dbcsr_set_s, dbcsr_set_c, dbcsr_set_z
END INTERFACE
INTERFACE dbcsr_add
MODULE PROCEDURE dbcsr_add_d, dbcsr_add_s, dbcsr_add_c, dbcsr_add_z
END INTERFACE
INTERFACE dbcsr_add_on_diag
MODULE PROCEDURE dbcsr_add_on_diag_d, dbcsr_add_on_diag_s
MODULE PROCEDURE dbcsr_add_on_diag_c, dbcsr_add_on_diag_z
END INTERFACE
INTERFACE dbcsr_get_diag
MODULE PROCEDURE dbcsr_get_diag_d, dbcsr_get_diag_s
MODULE PROCEDURE dbcsr_get_diag_c, dbcsr_get_diag_z
END INTERFACE
INTERFACE dbcsr_set_diag
MODULE PROCEDURE dbcsr_set_diag_d, dbcsr_set_diag_s
MODULE PROCEDURE dbcsr_set_diag_c, dbcsr_set_diag_z
END INTERFACE
INTERFACE dbcsr_scale
MODULE PROCEDURE dbcsr_scale_d, dbcsr_scale_s, dbcsr_scale_c, dbcsr_scale_z
END INTERFACE
INTERFACE dbcsr_scale_by_vector
MODULE PROCEDURE dbcsr_scale_by_vector_d, dbcsr_scale_by_vector_s
MODULE PROCEDURE dbcsr_scale_by_vector_c, dbcsr_scale_by_vector_z
END INTERFACE
INTERFACE dbcsr_multiply
MODULE PROCEDURE dbcsr_multiply_d, dbcsr_multiply_s, dbcsr_multiply_c, dbcsr_multiply_z
END INTERFACE
INTERFACE dbcsr_get_block_p
MODULE PROCEDURE dbcsr_get_block_p_d, dbcsr_get_block_p_s
MODULE PROCEDURE dbcsr_get_block_p_z, dbcsr_get_block_p_c
MODULE PROCEDURE dbcsr_get_2d_block_p_d, dbcsr_get_2d_block_p_s
MODULE PROCEDURE dbcsr_get_2d_block_p_z, dbcsr_get_2d_block_p_c
MODULE PROCEDURE dbcsr_get_block_notrans_p_d, dbcsr_get_block_notrans_p_s
MODULE PROCEDURE dbcsr_get_block_notrans_p_z, dbcsr_get_block_notrans_p_c
MODULE PROCEDURE dbcsr_get_2d_block_notrans_p_d, dbcsr_get_2d_block_notrans_p_s
MODULE PROCEDURE dbcsr_get_2d_block_notrans_p_z, dbcsr_get_2d_block_notrans_p_c
END INTERFACE
INTERFACE dbcsr_put_block
MODULE PROCEDURE dbcsr_put_block_d, dbcsr_put_block_s, dbcsr_put_block_z, dbcsr_put_block_c
MODULE PROCEDURE dbcsr_put_block2d_d, dbcsr_put_block2d_s, dbcsr_put_block2d_z, dbcsr_put_block2d_c
END INTERFACE
INTERFACE dbcsr_iterator_next_block
MODULE PROCEDURE dbcsr_iterator_next_block_index
MODULE PROCEDURE dbcsr_iterator_next_2d_block_d, dbcsr_iterator_next_2d_block_s
MODULE PROCEDURE dbcsr_iterator_next_2d_block_c, dbcsr_iterator_next_2d_block_z
MODULE PROCEDURE dbcsr_iterator_next_1d_block_d, dbcsr_iterator_next_1d_block_s
MODULE PROCEDURE dbcsr_iterator_next_1d_block_c, dbcsr_iterator_next_1d_block_z
MODULE PROCEDURE dbcsr_iterator_next_2d_block_notrans_d, dbcsr_iterator_next_2d_block_notrans_s
MODULE PROCEDURE dbcsr_iterator_next_2d_block_notrans_c, dbcsr_iterator_next_2d_block_notrans_z
MODULE PROCEDURE dbcsr_iterator_next_1d_block_notrans_d, dbcsr_iterator_next_1d_block_notrans_s
MODULE PROCEDURE dbcsr_iterator_next_1d_block_notrans_c, dbcsr_iterator_next_1d_block_notrans_z
END INTERFACE
INTERFACE dbcsr_reserve_block2d
MODULE PROCEDURE dbcsr_reserve_block2d_d, dbcsr_reserve_block2d_s
MODULE PROCEDURE dbcsr_reserve_block2d_c, dbcsr_reserve_block2d_z
END INTERFACE
INTERFACE dbcsr_csr_create
MODULE PROCEDURE csr_create_new, csr_create_template
END INTERFACE
INTERFACE dbcsr_get_wms_data_p
MODULE PROCEDURE dbcsr_get_wms_data_s, dbcsr_get_wms_data_c
MODULE PROCEDURE dbcsr_get_wms_data_d, dbcsr_get_wms_data_z
END INTERFACE
INTERFACE dbcsr_get_data_p
MODULE PROCEDURE dbcsr_get_data_s, dbcsr_get_data_c, dbcsr_get_data_d, dbcsr_get_data_z
END INTERFACE
INTERFACE dbcsr_norm
MODULE PROCEDURE dbcsr_norm_scalar
MODULE PROCEDURE dbcsr_norm_r8_vec
END INTERFACE dbcsr_norm
PRIVATE
CONTAINS
SUBROUTINE dbcsr_mp_grid_setup(dist)
TYPE(dbcsr_distribution_type), INTENT(INOUT) :: dist
CALL dbcsr_mp_grid_setup_prv(dist%prv%d%mp_env)
END SUBROUTINE dbcsr_mp_grid_setup
SUBROUTINE dbcsr_setname(matrix, newname)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
CHARACTER(len=*), INTENT(IN) :: newname
CALL dbcsr_setname_prv(matrix%prv, newname)
END SUBROUTINE dbcsr_setname
FUNCTION dbcsr_gershgorin_norm(matrix) RESULT(norm)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
REAL(KIND=real_8) :: norm
norm = dbcsr_gershgorin_norm_prv(matrix%prv)
END FUNCTION dbcsr_gershgorin_norm
FUNCTION dbcsr_frobenius_norm(matrix, local) RESULT(norm)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
LOGICAL, INTENT(in), OPTIONAL :: local
REAL(KIND=real_8) :: norm
norm = dbcsr_frobenius_norm_prv(matrix%prv, local)
END FUNCTION dbcsr_frobenius_norm
FUNCTION dbcsr_maxabs(matrix) RESULT(norm)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
REAL(KIND=real_8) :: norm
norm = dbcsr_maxabs_prv(matrix%prv)
END FUNCTION dbcsr_maxabs
SUBROUTINE dbcsr_complete_redistribute(matrix, redist, keep_sparsity, summation)
TYPE(dbcsr_type), INTENT(IN) :: matrix
TYPE(dbcsr_type), INTENT(INOUT) :: redist
LOGICAL, INTENT(IN), OPTIONAL :: keep_sparsity, summation
CALL dbcsr_complete_redistribute_prv(matrix%prv, redist%prv, keep_sparsity, summation)
END SUBROUTINE dbcsr_complete_redistribute
SUBROUTINE dbcsr_reserve_blocks(matrix, rows, cols, blk_pointers)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
INTEGER, DIMENSION(:), INTENT(IN) :: rows, cols
INTEGER, DIMENSION(:), INTENT(IN), OPTIONAL :: blk_pointers
CALL dbcsr_reserve_blocks_prv(matrix%prv, rows, cols, blk_pointers)
END SUBROUTINE dbcsr_reserve_blocks
SUBROUTINE dbcsr_reserve_all_blocks(matrix)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
CALL dbcsr_reserve_all_blocks_prv(matrix%prv)
END SUBROUTINE dbcsr_reserve_all_blocks
SUBROUTINE dbcsr_reserve_diag_blocks(matrix)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
CALL dbcsr_reserve_diag_blocks_prv(matrix%prv)
END SUBROUTINE dbcsr_reserve_diag_blocks
SUBROUTINE dbcsr_add_work_coordinate(matrix, index_matrix, row, col, blk, index)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
INTEGER, INTENT(IN) :: index_matrix, row, col
INTEGER, INTENT(IN), OPTIONAL :: blk
INTEGER, INTENT(OUT), OPTIONAL :: index
CALL add_work_coordinate_prv(matrix%prv%wms(index_matrix), row, col, blk, index)
END SUBROUTINE dbcsr_add_work_coordinate
SUBROUTINE dbcsr_set_work_size(matrix, index_matrix, newvalue)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
INTEGER, INTENT(IN) :: index_matrix, newvalue
matrix%prv%wms(index_matrix)%datasize = newvalue
END SUBROUTINE dbcsr_set_work_size
SUBROUTINE dbcsr_init_random(matrix, keep_sparsity)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
LOGICAL, OPTIONAL :: keep_sparsity
CALL dbcsr_init_random_prv(matrix%prv, keep_sparsity=keep_sparsity)
END SUBROUTINE dbcsr_init_random
PURE FUNCTION dbcsr_get_data_type(matrix) RESULT(data_type)
TYPE(dbcsr_type), INTENT(IN) :: matrix
INTEGER :: data_type
data_type = dbcsr_get_data_type_prv(matrix%prv)
END FUNCTION dbcsr_get_data_type
PURE FUNCTION dbcsr_valid_index(matrix) RESULT(valid_index)
TYPE(dbcsr_type), INTENT(IN) :: matrix
LOGICAL :: valid_index
valid_index = dbcsr_valid_index_prv(matrix%prv)
END FUNCTION dbcsr_valid_index
SUBROUTINE dbcsr_get_stored_coordinates(matrix, row, column, processor)
TYPE(dbcsr_type), INTENT(IN) :: matrix
INTEGER, INTENT(IN) :: row, column
INTEGER, INTENT(OUT), OPTIONAL :: processor
CALL dbcsr_get_stored_coordinates_prv(matrix%prv, row, column, processor)
END SUBROUTINE dbcsr_get_stored_coordinates
PURE FUNCTION dbcsr_get_num_blocks(matrix) RESULT(num_blocks)
TYPE(dbcsr_type), INTENT(IN) :: matrix
INTEGER :: num_blocks
num_blocks = dbcsr_get_num_blocks_prv(matrix%prv)
END FUNCTION dbcsr_get_num_blocks
FUNCTION dbcsr_get_data_size(matrix) RESULT(data_size)
TYPE(dbcsr_type), INTENT(IN) :: matrix
INTEGER :: data_size
data_size = dbcsr_get_data_size_prv(matrix%prv)
END FUNCTION dbcsr_get_data_size
PURE FUNCTION dbcsr_get_matrix_type(matrix) RESULT(matrix_type)
TYPE(dbcsr_type), INTENT(IN) :: matrix
CHARACTER :: matrix_type
matrix_type = dbcsr_get_matrix_type_prv(matrix%prv)
END FUNCTION dbcsr_get_matrix_type
FUNCTION dbcsr_get_occupation(matrix) RESULT(occupation)
TYPE(dbcsr_type), INTENT(IN) :: matrix
REAL(KIND=real_8) :: occupation
occupation = dbcsr_get_occupation_prv(matrix%prv)
END FUNCTION dbcsr_get_occupation
FUNCTION dbcsr_nblkrows_total(matrix) RESULT(nblkrows_total)
TYPE(dbcsr_type), INTENT(IN) :: matrix
INTEGER :: nblkrows_total
nblkrows_total = dbcsr_nblkrows_total_prv(matrix%prv)
END FUNCTION dbcsr_nblkrows_total
FUNCTION dbcsr_nblkcols_total(matrix) RESULT(nblkcols_total)
TYPE(dbcsr_type), INTENT(IN) :: matrix
INTEGER :: nblkcols_total
nblkcols_total = dbcsr_nblkcols_total_prv(matrix%prv)
END FUNCTION dbcsr_nblkcols_total
FUNCTION dbcsr_nfullrows_total(matrix) RESULT(nfullrows_total)
TYPE(dbcsr_type), INTENT(IN) :: matrix
INTEGER :: nfullrows_total
nfullrows_total = dbcsr_nfullrows_total_prv(matrix%prv)
END FUNCTION dbcsr_nfullrows_total
FUNCTION dbcsr_nfullcols_total(matrix) RESULT(nfullcols_total)
TYPE(dbcsr_type), INTENT(IN) :: matrix
INTEGER :: nfullcols_total
nfullcols_total = dbcsr_nfullcols_total_prv(matrix%prv)
END FUNCTION dbcsr_nfullcols_total
PURE FUNCTION dbcsr_iterator_blocks_left(iterator) RESULT(blocks_left)
TYPE(dbcsr_iterator_type), INTENT(IN) :: iterator
LOGICAL :: blocks_left
blocks_left = dbcsr_iterator_blocks_left_prv(iterator%prv)
END FUNCTION dbcsr_iterator_blocks_left
SUBROUTINE dbcsr_iterator_stop(iterator)
TYPE(dbcsr_iterator_type), INTENT(INOUT) :: iterator
CALL dbcsr_iterator_stop_prv(iterator%prv)
END SUBROUTINE dbcsr_iterator_stop
SUBROUTINE dbcsr_iterator_start(iterator, matrix, shared, dynamic, &
dynamic_byrows, contiguous_pointers, read_only)
TYPE(dbcsr_iterator_type), INTENT(OUT) :: iterator
TYPE(dbcsr_type), INTENT(IN) :: matrix
LOGICAL, INTENT(IN), OPTIONAL :: shared, dynamic, dynamic_byrows, &
contiguous_pointers, read_only
CALL dbcsr_iterator_start_prv(iterator%prv, matrix%prv, shared, dynamic, &
dynamic_byrows, contiguous_pointers, read_only)
END SUBROUTINE dbcsr_iterator_start
SUBROUTINE dbcsr_iterator_next_block_index(iterator, row, column, blk, blk_p)
!! Gets the index information of the next block, no data.
TYPE(dbcsr_iterator_type), INTENT(INOUT) :: iterator
!! the iterator
INTEGER, INTENT(OUT) :: row, column, blk
!! row of the data block
!! column of the data block
!! block number
INTEGER, INTENT(OUT), OPTIONAL :: blk_p
!! index into block data array
CALL dbcsr_iterator_next_block_prv(iterator%prv, row=row, column=column, blk=blk, blk_p=blk_p)
END SUBROUTINE dbcsr_iterator_next_block_index
SUBROUTINE dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, &
nfullrows_total, nfullcols_total, &
nblkrows_local, nblkcols_local, &
nfullrows_local, nfullcols_local, &
my_prow, my_pcol, &
local_rows, local_cols, proc_row_dist, proc_col_dist, &
row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, &
distribution, name, matrix_type, data_type, &
group)
TYPE(dbcsr_type), INTENT(IN) :: matrix
INTEGER, INTENT(OUT), OPTIONAL :: nblkrows_total, nblkcols_total, nfullrows_total, &
nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, &
my_prow, my_pcol
INTEGER, DIMENSION(:), OPTIONAL, POINTER :: local_rows, local_cols, proc_row_dist, &
proc_col_dist, &
row_blk_size, col_blk_size, &
row_blk_offset, col_blk_offset
TYPE(dbcsr_distribution_type), INTENT(OUT), &
OPTIONAL :: distribution
CHARACTER(len=*), INTENT(OUT), OPTIONAL :: name
CHARACTER, INTENT(OUT), OPTIONAL :: matrix_type
INTEGER, INTENT(OUT), OPTIONAL :: data_type, group
TYPE(dbcsr_dist_prv_obj) :: dist
CALL dbcsr_get_info_prv(matrix=matrix%prv, &
nblkrows_total=nblkrows_total, &
nblkcols_total=nblkcols_total, &
nfullrows_total=nfullrows_total, &
nfullcols_total=nfullcols_total, &
nblkrows_local=nblkrows_local, &
nblkcols_local=nblkcols_local, &
nfullrows_local=nfullrows_local, &
nfullcols_local=nfullcols_local, &
my_prow=my_prow, &
my_pcol=my_pcol, &
local_rows=local_rows, &
local_cols=local_cols, &
proc_row_dist=proc_row_dist, &
proc_col_dist=proc_col_dist, &
row_blk_size=row_blk_size, &
col_blk_size=col_blk_size, &
row_blk_offset=row_blk_offset, &
col_blk_offset=col_blk_offset, &
distribution=dist, &
name=name, &
matrix_type=matrix_type, &
data_type=data_type, &
group=group)
IF (PRESENT(distribution)) THEN
distribution%prv = dist
ENDIF
END SUBROUTINE dbcsr_get_info
SUBROUTINE dbcsr_distribution_get(dist, row_dist, col_dist, &
nrows, ncols, has_threads, &
group, mynode, numnodes, nprows, npcols, myprow, mypcol, pgrid, &
subgroups_defined, prow_group, pcol_group)
TYPE(dbcsr_distribution_type), INTENT(IN) :: dist
INTEGER, DIMENSION(:), OPTIONAL, POINTER :: row_dist, col_dist
INTEGER, INTENT(OUT), OPTIONAL :: nrows, ncols
LOGICAL, INTENT(OUT), OPTIONAL :: has_threads
INTEGER, INTENT(OUT), OPTIONAL :: group, mynode, numnodes, nprows, npcols, &
myprow, mypcol
INTEGER, DIMENSION(:, :), OPTIONAL, POINTER :: pgrid
LOGICAL, INTENT(OUT), OPTIONAL :: subgroups_defined
INTEGER, INTENT(OUT), OPTIONAL :: prow_group, pcol_group
call dbcsr_distribution_get_prv(dist%prv, row_dist, col_dist, &
nrows, ncols, has_threads, &
group, mynode, numnodes, nprows, npcols, myprow, mypcol, pgrid, &
subgroups_defined, prow_group, pcol_group)
END SUBROUTINE dbcsr_distribution_get
SUBROUTINE dbcsr_distribution_hold(dist)
TYPE(dbcsr_distribution_type) :: dist
CALL dbcsr_distribution_hold_prv(dist%prv)
END SUBROUTINE dbcsr_distribution_hold
SUBROUTINE dbcsr_distribution_release(dist)
TYPE(dbcsr_distribution_type) :: dist
CALL dbcsr_distribution_release_prv(dist%prv)
END SUBROUTINE dbcsr_distribution_release
SUBROUTINE dbcsr_norm_scalar(matrix, which_norm, norm_scalar)
TYPE(dbcsr_type), INTENT(INOUT), TARGET :: matrix
INTEGER, INTENT(IN) :: which_norm
REAL(dp), INTENT(OUT) :: norm_scalar
CALL dbcsr_norm_scalar_prv(matrix%prv, which_norm, norm_scalar)
END SUBROUTINE dbcsr_norm_scalar
SUBROUTINE dbcsr_norm_r8_vec(matrix, which_norm, norm_vector)
TYPE(dbcsr_type), INTENT(INOUT), TARGET :: matrix
INTEGER, INTENT(IN) :: which_norm
REAL(dp), DIMENSION(:), INTENT(OUT) :: norm_vector
CALL dbcsr_norm_r8_vec_prv(matrix%prv, which_norm, norm_vector)
END SUBROUTINE dbcsr_norm_r8_vec
SUBROUTINE dbcsr_replicate_all(matrix)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
CALL dbcsr_replicate_all_prv(matrix%prv)
END SUBROUTINE dbcsr_replicate_all
SUBROUTINE dbcsr_distribute(matrix, fast)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
LOGICAL, INTENT(in), OPTIONAL :: fast
CALL dbcsr_distribute_prv(matrix%prv, fast)
END SUBROUTINE dbcsr_distribute
SUBROUTINE dbcsr_release_p(matrix)
TYPE(dbcsr_type), POINTER :: matrix
IF (ASSOCIATED(matrix)) THEN
CALL dbcsr_release(matrix)
DEALLOCATE (matrix)
ENDIF
END SUBROUTINE dbcsr_release_p
SUBROUTINE dbcsr_release(matrix)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
CALL dbcsr_release_prv(matrix%prv)
END SUBROUTINE dbcsr_release
SUBROUTINE dbcsr_init_p(matrix)
TYPE(dbcsr_type), POINTER :: matrix
IF (ASSOCIATED(matrix)) THEN
CALL dbcsr_release(matrix)
DEALLOCATE (matrix)
ENDIF
ALLOCATE (matrix)
END SUBROUTINE dbcsr_init_p
SUBROUTINE dbcsr_print(matrix, nodata, matlab_format, variable_name, unit_nr)
TYPE(dbcsr_type), INTENT(IN) :: matrix
LOGICAL, INTENT(IN), OPTIONAL :: nodata, matlab_format
CHARACTER(*), INTENT(in), OPTIONAL :: variable_name
INTEGER, OPTIONAL :: unit_nr
CALL dbcsr_print_prv(matrix%prv, nodata, matlab_format, variable_name, unit_nr)
END SUBROUTINE dbcsr_print
SUBROUTINE dbcsr_print_block_sum(matrix, unit_nr)
!! Prints the sum of the elements in each block
TYPE(dbcsr_type), INTENT(IN) :: matrix
INTEGER, OPTIONAL :: unit_nr
CALL dbcsr_print_block_sum_prv(matrix%prv, unit_nr)
END SUBROUTINE dbcsr_print_block_sum
FUNCTION dbcsr_checksum(matrix, local, pos) RESULT(checksum)
TYPE(dbcsr_type), INTENT(IN) :: matrix
LOGICAL, INTENT(IN), OPTIONAL :: local, pos
REAL(KIND=dp) :: checksum
checksum = dbcsr_checksum_prv(matrix%prv, local=local, pos=pos)
END FUNCTION dbcsr_checksum
SUBROUTINE dbcsr_sum_replicated(matrix)
TYPE(dbcsr_type), INTENT(inout) :: matrix
CALL dbcsr_sum_replicated_prv(matrix%prv)
END SUBROUTINE dbcsr_sum_replicated
SUBROUTINE dbcsr_triu(matrix)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
CALL dbcsr_triu_prv(matrix%prv)
END SUBROUTINE dbcsr_triu
SUBROUTINE dbcsr_verify_matrix(matrix, verbosity, local)
TYPE(dbcsr_type), INTENT(IN) :: matrix
INTEGER, INTENT(IN), OPTIONAL :: verbosity
LOGICAL, INTENT(IN), OPTIONAL :: local
CALL dbcsr_verify_matrix_prv(matrix%prv, verbosity, local)
END SUBROUTINE dbcsr_verify_matrix
SUBROUTINE dbcsr_distribution_new(dist, template, group, pgrid, row_dist, col_dist, &
reuse_arrays)
!! Creates new distribution from blockr distributions
TYPE(dbcsr_distribution_type), INTENT(OUT) :: dist
!! distribution
TYPE(dbcsr_distribution_type), INTENT(IN), &
OPTIONAL :: template
INTEGER, INTENT(IN), OPTIONAL :: group
INTEGER, DIMENSION(:, :), OPTIONAL, POINTER :: pgrid
INTEGER, DIMENSION(:), INTENT(INOUT), POINTER :: row_dist, col_dist
LOGICAL, INTENT(IN), OPTIONAL :: reuse_arrays
INTEGER, DIMENSION(:), POINTER, CONTIGUOUS :: cont_row_dist, cont_col_dist
! Make the arrays contiguous, avoid change in the API
ALLOCATE (cont_row_dist(SIZE(row_dist)), cont_col_dist(SIZE(col_dist)))
cont_row_dist(:) = row_dist(:)
cont_col_dist(:) = col_dist(:)
IF (PRESENT(reuse_arrays)) THEN
IF (reuse_arrays) THEN
DEALLOCATE (row_dist, col_dist)
NULLIFY (row_dist, col_dist)
ENDIF
ENDIF
IF (PRESENT(template)) THEN
call dbcsr_distribution_new_prv(dist%prv, template%prv, group, pgrid, cont_row_dist, cont_col_dist, &
reuse_arrays=.TRUE.)
ELSE
call dbcsr_distribution_new_prv(dist%prv, group=group, pgrid=pgrid, row_dist=cont_row_dist, col_dist=cont_col_dist, &
reuse_arrays=.TRUE.)
ENDIF
END SUBROUTINE dbcsr_distribution_new
SUBROUTINE dbcsr_print_statistics(print_timers, callgraph_filename)
!! Print statistics
LOGICAL, INTENT(IN), OPTIONAL :: print_timers
CHARACTER(len=*), INTENT(IN), OPTIONAL :: callgraph_filename
CALL dbcsr_print_statistics_prv(print_timers, callgraph_filename)
END SUBROUTINE dbcsr_print_statistics
SUBROUTINE dbcsr_finalize(matrix, reshuffle)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
LOGICAL, INTENT(IN), OPTIONAL :: reshuffle
CALL dbcsr_finalize_prv(matrix%prv, reshuffle)
END SUBROUTINE dbcsr_finalize
SUBROUTINE dbcsr_work_create(matrix, nblks_guess, sizedata_guess, n, work_mutable)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
INTEGER, INTENT(IN), OPTIONAL :: nblks_guess, sizedata_guess, n
LOGICAL, INTENT(in), OPTIONAL :: work_mutable
CALL dbcsr_work_create_prv(matrix%prv, nblks_guess, sizedata_guess, n, work_mutable)
END SUBROUTINE dbcsr_work_create
SUBROUTINE dbcsr_create_new(matrix, name, dist, matrix_type, &
row_blk_size, col_blk_size, nze, data_type, reuse, &
reuse_arrays, mutable_work, replication_type)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
CHARACTER(len=*), INTENT(IN) :: name
TYPE(dbcsr_distribution_type), INTENT(IN) :: dist
CHARACTER, INTENT(IN) :: matrix_type
INTEGER, DIMENSION(:), INTENT(INOUT), POINTER :: row_blk_size, col_blk_size
INTEGER, INTENT(IN), OPTIONAL :: nze, data_type
LOGICAL, INTENT(IN), OPTIONAL :: reuse, reuse_arrays, mutable_work
CHARACTER, INTENT(IN), OPTIONAL :: replication_type
INTEGER, DIMENSION(:), POINTER, CONTIGUOUS :: cont_row_blk_size, cont_col_blk_size
! Make the array contiguous, avoid to change API
ALLOCATE (cont_row_blk_size(SIZE(row_blk_size)), cont_col_blk_size(SIZE(col_blk_size)))
cont_row_blk_size(:) = row_blk_size(:)
cont_col_blk_size(:) = col_blk_size(:)
IF (PRESENT(reuse_arrays)) THEN
IF (reuse_arrays) THEN
DEALLOCATE (row_blk_size, col_blk_size)
NULLIFY (row_blk_size, col_blk_size)
ENDIF
ENDIF
CALL dbcsr_create_prv(matrix%prv, name, dist%prv, &
matrix_type, &
cont_row_blk_size, cont_col_blk_size, nze=nze, &
data_type=data_type, reuse=reuse, &
reuse_arrays=.TRUE., &
mutable_work=mutable_work, replication_type=replication_type)
END SUBROUTINE dbcsr_create_new
SUBROUTINE dbcsr_create_template(matrix, name, template, &
dist, matrix_type, &
row_blk_size, col_blk_size, nze, data_type, &
reuse_arrays, mutable_work, replication_type)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
CHARACTER(len=*), INTENT(IN), OPTIONAL :: name
TYPE(dbcsr_type), INTENT(IN) :: template
TYPE(dbcsr_distribution_type), INTENT(IN), &
OPTIONAL :: dist
CHARACTER, INTENT(IN), OPTIONAL :: matrix_type
INTEGER, DIMENSION(:), INTENT(INOUT), OPTIONAL, &
POINTER :: row_blk_size, col_blk_size
INTEGER, INTENT(IN), OPTIONAL :: nze, data_type
LOGICAL, INTENT(IN), OPTIONAL :: reuse_arrays, mutable_work
CHARACTER, INTENT(IN), OPTIONAL :: replication_type
INTEGER, DIMENSION(:), POINTER, CONTIGUOUS :: cont_row_blk_size, cont_col_blk_size
IF (PRESENT(row_blk_size) .NEQV. PRESENT(col_blk_size)) THEN
DBCSR_ABORT("Both row_blk_size and col_blk_size must be provided!")
ENDIF
! Make the array contiguous, avoid to change API
IF (PRESENT(row_blk_size)) THEN
! Avoid to change API
ALLOCATE (cont_row_blk_size(SIZE(row_blk_size)), cont_col_blk_size(SIZE(col_blk_size)))
cont_row_blk_size(:) = row_blk_size(:)
cont_col_blk_size(:) = col_blk_size(:)
IF (PRESENT(reuse_arrays)) THEN
IF (reuse_arrays) THEN
DEALLOCATE (row_blk_size, col_blk_size)
NULLIFY (row_blk_size, col_blk_size)
ENDIF
ENDIF
ENDIF
IF (PRESENT(dist)) THEN
IF (PRESENT(row_blk_size)) THEN
CALL dbcsr_create_prv(matrix%prv, template%prv, name, &
dist%prv, matrix_type, &
row_blk_size=cont_row_blk_size, col_blk_size=cont_col_blk_size, &
nze=nze, data_type=data_type, &
reuse_arrays=.TRUE., mutable_work=mutable_work, &
replication_type=replication_type)
ELSE
CALL dbcsr_create_prv(matrix%prv, template%prv, name, &
dist%prv, matrix_type, &
nze=nze, data_type=data_type, &
reuse_arrays=reuse_arrays, mutable_work=mutable_work, &
replication_type=replication_type)
ENDIF
ELSE
IF (PRESENT(row_blk_size)) THEN
CALL dbcsr_create_prv(matrix%prv, template%prv, name, &
matrix_type=matrix_type, &
row_blk_size=cont_row_blk_size, col_blk_size=cont_col_blk_size, &
nze=nze, data_type=data_type, &
reuse_arrays=.TRUE., mutable_work=mutable_work, &
replication_type=replication_type)
ELSE
CALL dbcsr_create_prv(matrix%prv, template%prv, name, &
matrix_type=matrix_type, &
nze=nze, data_type=data_type, &
reuse_arrays=reuse_arrays, mutable_work=mutable_work, &
replication_type=replication_type)
ENDIF
ENDIF
END SUBROUTINE dbcsr_create_template
SUBROUTINE dbcsr_filter(matrix, eps, method, use_absolute, filter_diag)
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
REAL(dp), INTENT(IN) :: eps
INTEGER, INTENT(IN), OPTIONAL :: method
LOGICAL, INTENT(in), OPTIONAL :: use_absolute, filter_diag
CALL dbcsr_filter_prv(matrix%prv, dbcsr_conform_scalar_prv(eps, matrix%prv), &
method, use_absolute, filter_diag)
END SUBROUTINE dbcsr_filter
SUBROUTINE dbcsr_get_block_diag(matrix, diag)
TYPE(dbcsr_type), INTENT(IN) :: matrix
TYPE(dbcsr_type), INTENT(INOUT) :: diag
CALL dbcsr_get_block_diag_prv(matrix%prv, diag%prv)
END SUBROUTINE dbcsr_get_block_diag