@@ -81,6 +81,7 @@ void PEVSL_FORT(pevsl_setamv)(uintptr_t *pevslf90, void *func, void *data) {
81
81
pEVSL_SetAMatvec (pevsl , (MVFunc ) func , data );
82
82
}
83
83
84
+
84
85
/** @brief Fortran interface for pEVSL_SetBMatvec
85
86
* @param[in] pevslf90 pevsl pointer
86
87
* @param[in] func function pointer
@@ -103,6 +104,46 @@ void PEVSL_FORT(pevsl_setbsol)(uintptr_t *pevslf90, void *func, void *data) {
103
104
pEVSL_SetBSol (pevsl , (SVFunc ) func , data );
104
105
}
105
106
107
+
108
+ /**JS 01/20/19 for complex Hermitian Av
109
+ * @brief Fortran interface for pEVSL_SetAMatvec
110
+ * @param[in] pevslf90 pevsl pointer
111
+ * @param[in] func function pointer
112
+ * @param[in] data associated data
113
+ */
114
+ void PEVSL_FORT (pevsl_setzamv )(uintptr_t * pevslf90 , void * func , void * data ) {
115
+
116
+ /* cast pointer */
117
+ pevsl_Data * pevsl = (pevsl_Data * ) (* pevslf90 );
118
+
119
+ pEVSL_SetZAMatvec (pevsl , (ZMVFunc ) func , data );
120
+ }
121
+
122
+ /** @brief Fortran interface for pEVSL_SetBMatvec
123
+ * @param[in] pevslf90 pevsl pointer
124
+ * @param[in] func function pointer
125
+ * @param[in] data associated data
126
+ */
127
+ void PEVSL_FORT (pevsl_setzbmv )(uintptr_t * pevslf90 , void * func , void * data ) {
128
+
129
+ /* cast pointer */
130
+ pevsl_Data * pevsl = (pevsl_Data * ) (* pevslf90 );
131
+
132
+ pEVSL_SetZBMatvec (pevsl , (ZMVFunc ) func , data );
133
+ }
134
+
135
+ /** @brief Fortran interface for SetBsol */
136
+ void PEVSL_FORT (pevsl_setzbsol )(uintptr_t * pevslf90 , void * func , void * data ) {
137
+
138
+ /* cast pointer */
139
+ pevsl_Data * pevsl = (pevsl_Data * ) (* pevslf90 );
140
+
141
+ pEVSL_SetZBSol (pevsl , (ZSVFunc ) func , data );
142
+ }
143
+
144
+
145
+
146
+
106
147
/** @brief Fortran interface for SetStdEig */
107
148
void PEVSL_FORT (pevsl_set_stdeig )(uintptr_t * pevslf90 ) {
108
149
@@ -182,6 +223,8 @@ void PEVSL_FORT(pevsl_bsv)(uintptr_t *pevslf90, double *b, double *x) {
182
223
}
183
224
184
225
226
+
227
+
185
228
/** @brief Fortran interface for evsl_lanbounds
186
229
* @param[in] pevslf90 pEVSL pointer
187
230
* @param[in] mlan Krylov dimension
@@ -207,10 +250,46 @@ void PEVSL_FORT(pevsl_lanbounds)(uintptr_t *pevslf90, int *mlan, int *nsteps, do
207
250
pEVSL_ParvecRand (& vinit );
208
251
/*------------------- Lanczos Bounds */
209
252
pEVSL_LanTrbounds (pevsl , * mlan , * nsteps , 1e-8 , & vinit , 1 , lmin , lmax , NULL );
253
+ //pEVSL_LanTrbounds(pevsl, *mlan, *nsteps, 1e-8, &vinit, 1, lmin, lmax, stdout);
210
254
211
255
pEVSL_ParvecFree (& vinit );
212
256
}
213
257
258
+
259
+ /** JS 01/20/19
260
+ * @brief Fortran interface for evsl_lanbounds
261
+ * @param[in] pevslf90 pEVSL pointer
262
+ * @param[in] mlan Krylov dimension
263
+ * @param[in] nsteps number of steps
264
+ * @param[in] tol stopping tol
265
+ * @param[out] lmin lower bound
266
+ * @param[out] lmax upper bound
267
+ * */
268
+ void PEVSL_FORT (pevsl_zlanbounds )(uintptr_t * pevslf90 , int * mlan , int * nsteps , double * tol ,
269
+ double * lmin , double * lmax ) {
270
+ int N , n , nfirst ;
271
+ pevsl_Parvec vrinit , viinit ;
272
+
273
+ /* cast pointer */
274
+ pevsl_Data * pevsl = (pevsl_Data * ) (* pevslf90 );
275
+
276
+ N = pevsl -> N ;
277
+ n = pevsl -> n ;
278
+ nfirst = pevsl -> nfirst ;
279
+
280
+ /*------------------- Create parallel vector: random initial guess */
281
+ pEVSL_ParvecCreate (N , n , nfirst , pevsl -> comm , & vrinit );
282
+ pEVSL_ParvecRand_split (& vrinit );
283
+ pEVSL_ParvecCreate (N , n , nfirst , pevsl -> comm , & viinit );
284
+ pEVSL_ParvecRand_split (& viinit );
285
+ /*------------------- Lanczos Bounds */
286
+ pEVSL_ZLanTrbounds (pevsl , * mlan , * nsteps , 1e-8 , & vrinit , & viinit , 1 , lmin , lmax , stdout );
287
+
288
+ pEVSL_ParvecFree (& vrinit );
289
+ pEVSL_ParvecFree (& viinit );
290
+ }
291
+
292
+
214
293
/** @brief Fortran interface for find_pol
215
294
* @param[in] xintv Interval of interest
216
295
* @param[in] thresh_int Interior threshold
@@ -291,6 +370,96 @@ void PEVSL_FORT(pevsl_cheblannr)(uintptr_t *pevslf90, double *xintv, int *max_it
291
370
pevsl -> evec_computed = Y ;
292
371
}
293
372
373
+
374
+ /** added by JS 020619
375
+ * @brief Fortran interface for ChebLanNr
376
+ * the results will be saved in the internal variables
377
+ */
378
+ void PEVSL_FORT (pevsl_zcheblannr )(uintptr_t * pevslf90 , double * xintv , int * max_its , double * tol ,
379
+ uintptr_t * polf90 ) {
380
+
381
+ int N , n , nfirst , nev2 , ierr ;
382
+ double * lam , * res ;
383
+ pevsl_Parvecs * Yr , * Yi ;
384
+ FILE * fstats = stdout ;
385
+ pevsl_Parvec vrinit , viinit ;
386
+
387
+ /* cast pointer */
388
+ pevsl_Data * pevsl = (pevsl_Data * ) (* pevslf90 );
389
+
390
+ N = pevsl -> N ;
391
+ n = pevsl -> n ;
392
+ nfirst = pevsl -> nfirst ;
393
+ /*-------------------- zero out stats */
394
+ pEVSL_StatsReset (pevsl );
395
+ /*------------------- Create parallel vector: random initial guess */
396
+ pEVSL_ParvecCreate (N , n , nfirst , pevsl -> comm , & vrinit );
397
+ pEVSL_ParvecCreate (N , n , nfirst , pevsl -> comm , & viinit );
398
+ pEVSL_ParvecRand (& vrinit );
399
+ pEVSL_ParvecRand (& viinit );
400
+ /* cast pointer of pol*/
401
+ pevsl_Polparams * pol = (pevsl_Polparams * ) (* polf90 );
402
+ /* call ChebLanNr */
403
+ ierr = pEVSL_ZChebLanNr (pevsl , xintv , * max_its , * tol , & vrinit , & viinit , pol , & nev2 , & lam , & Yr , & Yi , & res , fstats );
404
+
405
+ if (ierr ) {
406
+ printf ("ZChebLanNr error %d\n" , ierr );
407
+ }
408
+
409
+ pEVSL_ParvecFree (& vrinit );
410
+ pEVSL_ParvecFree (& viinit );
411
+ /*--------------------- print stats */
412
+ pEVSL_StatsPrint (pevsl , fstats );
413
+
414
+ if (res ) {
415
+ PEVSL_FREE (res );
416
+ }
417
+ /* save pointers to the global variables */
418
+ pevsl -> nev_computed = nev2 ;
419
+ pevsl -> eval_computed = lam ;
420
+ pevsl -> evec_computed = Yr ;
421
+ pevsl -> evec_imag_computed = Yi ;
422
+
423
+ }
424
+
425
+
426
+ /** JS 051919 for Lanczos vectors
427
+ * @brief Fortran interface for ChebLanNr
428
+ * the results will be saved in the internal variables
429
+ */
430
+ void PEVSL_FORT (pevsl_lanvectors )(uintptr_t * pevslf90 , double * xintv , int * max_its , double * tol ,
431
+ uintptr_t * polf90 ) {
432
+ int N , n , nfirst , nev2 , ierr ;
433
+ pevsl_Parvecs * Y ;
434
+ FILE * fstats = stdout ;
435
+ pevsl_Parvec vinit ;
436
+
437
+ /* cast pointer */
438
+ pevsl_Data * pevsl = (pevsl_Data * ) (* pevslf90 );
439
+
440
+ N = pevsl -> N ;
441
+ n = pevsl -> n ;
442
+ nfirst = pevsl -> nfirst ;
443
+ /*-------------------- zero out stats */
444
+ pEVSL_StatsReset (pevsl );
445
+ /*------------------- Create parallel vector: random initial guess */
446
+ pEVSL_ParvecCreate (N , n , nfirst , pevsl -> comm , & vinit );
447
+ pEVSL_ParvecRand (& vinit );
448
+ /* cast pointer of pol*/
449
+ pevsl_Polparams * pol = (pevsl_Polparams * ) (* polf90 );
450
+ /* lanvectors.c */
451
+ ierr = pEVSL_Lanvectors (pevsl , xintv , * max_its , * tol , & vinit , pol , & nev2 , & Y , fstats );
452
+
453
+ if (ierr ) {
454
+ printf ("lanvectors error %d\n" , ierr );
455
+ }
456
+ /* save pointers to the global variables */
457
+ pevsl -> nev_computed = nev2 ;
458
+ pevsl -> evec_computed = Y ;
459
+ //printf("lanvectors done %d\n", ierr);
460
+ }
461
+
462
+
294
463
/** @brief Get the number of last computed eigenvalues
295
464
*/
296
465
void PEVSL_FORT (pevsl_get_nev )(uintptr_t * pevslf90 , int * nev ) {
@@ -330,6 +499,70 @@ void PEVSL_FORT(pevsl_copy_result)(uintptr_t *pevslf90, double *val, double *vec
330
499
PEVSL_FREE (pevsl -> evec_computed );
331
500
}
332
501
502
+
503
+ /** @brief copy the computed eigenvalues and vectors
504
+ * @warning after this call the internal saved results will be freed
505
+ * @param[in, out] pevslf90 Data to be cast to pevsl_Data
506
+ * @param[in] ld leading dimension of vec [ld >= pevsl.n]
507
+ * @param[out] vec Lanczos vectors output
508
+ */
509
+ void PEVSL_FORT (pevsl_copy_vectors )(uintptr_t * pevslf90 , double * vec , int * ld ) {
510
+ int i ;
511
+ /* cast pointer */
512
+ pevsl_Data * pevsl = (pevsl_Data * ) (* pevslf90 );
513
+
514
+
515
+ /* copy eigenvectors */
516
+ for (i = 0 ; i < pevsl -> nev_computed ; i ++ ) {
517
+ double * dest = vec + i * (* ld );
518
+ double * src = pevsl -> evec_computed -> data + i * pevsl -> evec_computed -> ld ;
519
+ memcpy (dest , src , pevsl -> n * sizeof (double ));
520
+ }
521
+
522
+ /* reset pointers */
523
+ pevsl -> nev_computed = 0 ;
524
+ pEVSL_ParvecsFree (pevsl -> evec_computed );
525
+ PEVSL_FREE (pevsl -> evec_computed );
526
+ }
527
+
528
+
529
+
530
+ /* added JS 020619 for complex Hermitian
531
+ * @brief copy the computed eigenvalues and vectors
532
+ * @warning after this call the internal saved results will be freed
533
+ * @param[in, out] pevslf90 Data to be cast to pevsl_Data
534
+ * @param[in] ld leading dimension of vec [ld >= pevsl.n]
535
+ * @param[out] val Eigenvalue output
536
+ * @param[out] vecr, veci Eigenvector output
537
+ */
538
+ void PEVSL_FORT (pevsl_copy_zresult )(uintptr_t * pevslf90 , double * val , double * vecr , double * veci , int * ld ) {
539
+
540
+ int i ;
541
+ /* cast pointer */
542
+ pevsl_Data * pevsl = (pevsl_Data * ) (* pevslf90 );
543
+ /* copy eigenvalues */
544
+ memcpy (val , pevsl -> eval_computed , pevsl -> nev_computed * sizeof (double ));
545
+
546
+ /* copy eigenvectors */
547
+ for (i = 0 ; i < pevsl -> nev_computed ; i ++ ) {
548
+ double * destr = vecr + i * (* ld );
549
+ double * srcr = pevsl -> evec_computed -> data + i * pevsl -> evec_computed -> ld ;
550
+ memcpy (destr , srcr , pevsl -> n * sizeof (double ));
551
+ double * desti = veci + i * (* ld );
552
+ double * srci = pevsl -> evec_imag_computed -> data + i * pevsl -> evec_imag_computed -> ld ;
553
+ memcpy (desti , srci , pevsl -> n * sizeof (double ));
554
+ }
555
+
556
+ /* reset pointers */
557
+ pevsl -> nev_computed = 0 ;
558
+ PEVSL_FREE (pevsl -> eval_computed );
559
+ pEVSL_ParvecsFree (pevsl -> evec_computed );
560
+ PEVSL_FREE (pevsl -> evec_computed );
561
+
562
+ pEVSL_ParvecsFree (pevsl -> evec_imag_computed );
563
+ PEVSL_FREE (pevsl -> evec_imag_computed );
564
+ }
565
+
333
566
void PEVSL_FORT (pevsl_setup_chebiter )(double * lmin , double * lmax , int * deg ,
334
567
uintptr_t * parcsrf90 , uintptr_t * chebf90 ) {
335
568
/* cast pointer of the matrix */
0 commit comments