102 MODULE PROCEDURE edpsp 103 MODULE PROCEDURE edpdp 120 MODULE PROCEDURE i0dp 121 MODULE PROCEDURE i0sp 126 MODULE PROCEDURE i1dp 127 MODULE PROCEDURE i1sp 138 MODULE PROCEDURE k0dp 139 MODULE PROCEDURE k0sp 144 MODULE PROCEDURE k1dp 145 MODULE PROCEDURE k1sp 150 MODULE PROCEDURE kdpdp 151 MODULE PROCEDURE kdpsp 272 INTEGER(INTG),
INTENT(IN) :: a(:)
273 INTEGER(INTG),
INTENT(IN) :: b(:)
274 INTEGER(INTG),
INTENT(OUT) :: c(:)
275 INTEGER(INTG),
INTENT(OUT) :: err
279 enters(
"CrossProductIntg",err,error,*999)
281 IF(
SIZE(a,1)==
SIZE(b,1))
THEN 282 IF(
SIZE(c,1)==3)
THEN 283 SELECT CASE(
SIZE(a,1))
285 c(1)=a(2)*b(3)-a(3)*b(2)
286 c(2)=a(3)*b(1)-a(1)*b(3)
287 c(3)=a(1)*b(2)-a(2)*b(1)
289 CALL flagerror(
"Invalid vector size.",err,error,*999)
292 CALL flagerror(
"The vector c is not the correct size.",err,error,*999)
295 CALL flagerror(
"The vectors a and b are not the same size.",err,error,*999)
298 exits(
"CrossProductIntg")
300 999 errorsexits(
"CrossProductIntg",err,error)
313 REAL(SP),
INTENT(IN) :: a(:)
314 REAL(SP),
INTENT(IN) :: b(:)
315 REAL(SP),
INTENT(OUT) :: c(:)
316 INTEGER(INTG),
INTENT(OUT) :: err
320 enters(
"CrossProductSP",err,error,*999)
322 IF(
SIZE(a,1)==
SIZE(b,1))
THEN 323 IF(
SIZE(c,1)==3)
THEN 324 SELECT CASE(
SIZE(a,1))
326 c(1)=a(2)*b(3)-a(3)*b(2)
327 c(2)=a(3)*b(1)-a(1)*b(3)
328 c(3)=a(1)*b(2)-a(2)*b(1)
330 CALL flagerror(
"Invalid vector size.",err,error,*999)
333 CALL flagerror(
"The vector c is not the correct size.",err,error,*999)
336 CALL flagerror(
"The vectors a and b are not the same size.",err,error,*999)
339 exits(
"CrossProductSP")
341 999 errorsexits(
"CrossProductSP",err,error)
354 REAL(DP),
INTENT(IN) :: a(:)
355 REAL(DP),
INTENT(IN) :: b(:)
356 REAL(DP),
INTENT(OUT) :: c(:)
357 INTEGER(INTG),
INTENT(OUT) :: err
361 enters(
"CrossProductDP",err,error,*999)
363 IF(
SIZE(a,1)==
SIZE(b,1))
THEN 364 IF(
SIZE(c,1)==3)
THEN 365 SELECT CASE(
SIZE(a,1))
367 c(1)=a(2)*b(3)-a(3)*b(2)
368 c(2)=a(3)*b(1)-a(1)*b(3)
369 c(3)=a(1)*b(2)-a(2)*b(1)
371 CALL flagerror(
"Invalid vector size.",err,error,*999)
374 CALL flagerror(
"The vector C is not the correct size.",err,error,*999)
377 CALL flagerror(
"The vectors A and B are not the same size.",err,error,*999)
380 exits(
"CrossProductDP")
382 999 errorsexits(
"CrossProductDP",err,error)
396 INTEGER(INTG),
INTENT(IN) :: n
397 INTEGER(INTG),
INTENT(IN) :: a(:)
398 INTEGER(INTG),
INTENT(IN) :: b(:)
399 INTEGER(INTG),
INTENT(OUT) :: c(:)
400 INTEGER(INTG),
INTENT(IN) :: da(:,:)
401 INTEGER(INTG),
INTENT(IN) :: db(:,:)
402 INTEGER(INTG),
INTENT(OUT) :: dc(:,:)
403 INTEGER(INTG),
INTENT(OUT) :: err
406 INTEGER(INTG) :: derivIdx
408 enters(
"dCrossProductIntg",err,error,*999)
411 IF(
SIZE(da,1)==
SIZE(db,1).AND.
SIZE(a,1)==
SIZE(da,1).AND.
SIZE(b,1)==
SIZE(db,1))
THEN 412 IF(
SIZE(da,2)==n.AND.
SIZE(db,2)==n)
THEN 413 IF(
SIZE(c,1)==3)
THEN 414 SELECT CASE(
SIZE(a,1))
417 dc(1,derividx)=da(2,derividx)*b(3)-da(3,derividx)*b(2)+a(2)*db(3,derividx)-a(3)*db(2,derividx)
418 dc(2,derividx)=da(3,derividx)*b(1)-da(1,derividx)*b(3)+a(3)*db(1,derividx)-a(1)*db(3,derividx)
419 dc(3,derividx)=da(1,derividx)*b(2)-da(2,derividx)*b(1)+a(1)*db(2,derividx)-a(2)*db(1,derividx)
422 CALL flagerror(
"Invalid vector size.",err,error,*999)
425 CALL flagerror(
"The vector c is not the correct size.",err,error,*999)
428 CALL flagerror(
"The number of derivative vectors is too small.",err,error,*999)
431 CALL flagerror(
"The vectors for da and db are not the same size.",err,error,*999)
434 exits(
"dCrossProductIntg")
436 999 errorsexits(
"dCrossProductIntg",err,error)
450 INTEGER(INTG),
INTENT(IN) :: n
451 REAL(SP),
INTENT(IN) :: a(:)
452 REAL(SP),
INTENT(IN) :: b(:)
453 REAL(SP),
INTENT(OUT) :: c(:)
454 REAL(SP),
INTENT(IN) :: da(:,:)
455 REAL(SP),
INTENT(IN) :: db(:,:)
456 REAL(SP),
INTENT(OUT) :: dc(:,:)
457 INTEGER(INTG),
INTENT(OUT) :: err
460 INTEGER(INTG) :: derivIdx
462 enters(
"dCrossProductSP",err,error,*999)
465 IF(
SIZE(da,1)==
SIZE(db,1).AND.
SIZE(a,1)==
SIZE(da,1).AND.
SIZE(b,1)==
SIZE(db,1))
THEN 466 IF(
SIZE(da,2)==n.AND.
SIZE(db,2)==n)
THEN 467 IF(
SIZE(c,1)==3)
THEN 468 SELECT CASE(
SIZE(a,1))
471 dc(1,derividx)=da(2,derividx)*b(3)-da(3,derividx)*b(2)+a(2)*db(3,derividx)-a(3)*db(2,derividx)
472 dc(2,derividx)=da(3,derividx)*b(1)-da(1,derividx)*b(3)+a(3)*db(1,derividx)-a(1)*db(3,derividx)
473 dc(3,derividx)=da(1,derividx)*b(2)-da(2,derividx)*b(1)+a(1)*db(2,derividx)-a(2)*db(1,derividx)
476 CALL flagerror(
"Invalid vector size.",err,error,*999)
479 CALL flagerror(
"The vector c is not the correct size.",err,error,*999)
482 CALL flagerror(
"The number of derivative vectors is too small.",err,error,*999)
485 CALL flagerror(
"The vectors for da and db are not the same size.",err,error,*999)
488 exits(
"dCrossProductSP")
490 999 errorsexits(
"dCrossProductSP",err,error)
504 INTEGER(INTG),
INTENT(IN) :: n
505 REAL(DP),
INTENT(IN) :: a(:)
506 REAL(DP),
INTENT(IN) :: b(:)
507 REAL(DP),
INTENT(OUT) :: c(:)
508 REAL(DP),
INTENT(IN) :: da(:,:)
509 REAL(DP),
INTENT(IN) :: db(:,:)
510 REAL(DP),
INTENT(OUT) :: dc(:,:)
511 INTEGER(INTG),
INTENT(OUT) :: err
514 INTEGER(INTG) :: derivIdx
516 enters(
"dCrossProductDP",err,error,*999)
519 IF(
SIZE(da,1)==
SIZE(db,1).AND.
SIZE(a,1)==
SIZE(da,1).AND.
SIZE(b,1)==
SIZE(db,1))
THEN 520 IF(
SIZE(da,2)==n.AND.
SIZE(db,2)==n)
THEN 521 IF(
SIZE(c,1)==3)
THEN 522 SELECT CASE(
SIZE(a,1))
525 dc(1,derividx)=da(2,derividx)*b(3)-da(3,derividx)*b(2)+a(2)*db(3,derividx)-a(3)*db(2,derividx)
526 dc(2,derividx)=da(3,derividx)*b(1)-da(1,derividx)*b(3)+a(3)*db(1,derividx)-a(1)*db(3,derividx)
527 dc(3,derividx)=da(1,derividx)*b(2)-da(2,derividx)*b(1)+a(1)*db(2,derividx)-a(2)*db(1,derividx)
530 CALL flagerror(
"Invalid vector size.",err,error,*999)
533 CALL flagerror(
"The vector c is not the correct size.",err,error,*999)
536 CALL flagerror(
"The number of derivative vectors is too small.",err,error,*999)
539 CALL flagerror(
"The vectors for da and db are not the same size.",err,error,*999)
542 exits(
"dCrossProductDP")
544 999 errorsexits(
"dCrossProductDP",err,error)
557 REAL(SP),
INTENT(IN) :: A(:,:)
558 REAL(SP),
INTENT(IN) :: b(:)
559 REAL(SP),
INTENT(OUT) :: c(:)
563 enters(
"MatrixVectorProductSP",err,error,*999)
565 IF(
SIZE(a,2)==
SIZE(b,1).AND.
SIZE(a,1)==
SIZE(c,1))
THEN 566 SELECT CASE(
SIZE(a,1))
570 c(1)=a(1,1)*b(1)+a(1,2)*b(2)
571 c(2)=a(2,1)*b(1)+a(2,2)*b(2)
573 c(1)=a(1,1)*b(1)+a(1,2)*b(2)+a(1,3)*b(3)
574 c(2)=a(2,1)*b(1)+a(2,2)*b(2)+a(2,3)*b(3)
575 c(3)=a(3,1)*b(1)+a(3,2)*b(2)+a(3,3)*b(3)
577 CALL flagerror(
"Invalid matrix and/or vector size.",err,error,*999)
580 CALL flagerror(
"Invalid matrix sizes.",err,error,*999)
583 exits(
"MatrixVectorProductSP")
585 999 errorsexits(
"MatrixVectorProductSP",err,error)
598 REAL(DP),
INTENT(IN) :: A(:,:)
599 REAL(DP),
INTENT(IN) :: B(:)
600 REAL(DP),
INTENT(OUT) :: C(:)
604 enters(
"MatrixVectorProductDP",err,error,*999)
606 IF(
SIZE(a,2)==
SIZE(b,1).AND.
SIZE(a,1)==
SIZE(c,1))
THEN 607 SELECT CASE(
SIZE(a,1))
611 c(1)=a(1,1)*b(1)+a(1,2)*b(2)
612 c(2)=a(2,1)*b(1)+a(2,2)*b(2)
614 c(1)=a(1,1)*b(1)+a(1,2)*b(2)+a(1,3)*b(3)
615 c(2)=a(2,1)*b(1)+a(2,2)*b(2)+a(2,3)*b(3)
616 c(3)=a(3,1)*b(1)+a(3,2)*b(2)+a(3,3)*b(3)
618 CALL flagerror(
"Invalid matrix and/or vector size.",err,error,*999)
621 CALL flagerror(
"Invalid matrix sizes.",err,error,*999)
624 exits(
"MatrixVectorProductDP")
626 999 errorsexits(
"MatrixVectorProductDP",err,error)
639 REAL(SP),
INTENT(IN) :: A(:,:)
640 REAL(SP),
INTENT(IN) :: b(:)
641 REAL(SP),
INTENT(OUT) :: c(:)
645 enters(
"MatrixTransposeVectorProductSP",err,error,*999)
647 IF(
SIZE(a,1)==
SIZE(b,1).AND.
SIZE(a,2)==
SIZE(c,1))
THEN 648 SELECT CASE(
SIZE(a,2))
652 c(1)=a(1,1)*b(1)+a(2,1)*b(2)
653 c(2)=a(1,2)*b(1)+a(2,2)*b(2)
655 c(1)=a(1,1)*b(1)+a(2,1)*b(2)+a(3,1)*b(3)
656 c(2)=a(1,2)*b(1)+a(2,2)*b(2)+a(3,2)*b(3)
657 c(3)=a(1,3)*b(1)+a(2,3)*b(2)+a(3,3)*b(3)
659 CALL flagerror(
"Invalid matrix and/or vector size.",err,error,*999)
662 CALL flagerror(
"Invalid matrix sizes.",err,error,*999)
665 exits(
"MatrixTransposeVectorProductSP")
667 999 errorsexits(
"MatrixTransposeVectorProductSP",err,error)
680 REAL(DP),
INTENT(IN) :: A(:,:)
681 REAL(DP),
INTENT(IN) :: b(:)
682 REAL(DP),
INTENT(OUT) :: c(:)
686 enters(
"MatrixTransposeVectorProductDP",err,error,*999)
688 IF(
SIZE(a,1)==
SIZE(b,1).AND.
SIZE(a,2)==
SIZE(c,1))
THEN 689 SELECT CASE(
SIZE(a,2))
693 c(1)=a(1,1)*b(1)+a(2,1)*b(2)
694 c(2)=a(1,2)*b(1)+a(2,2)*b(2)
696 c(1)=a(1,1)*b(1)+a(2,1)*b(2)+a(3,1)*b(3)
697 c(2)=a(1,2)*b(1)+a(2,2)*b(2)+a(3,2)*b(3)
698 c(3)=a(1,3)*b(1)+a(2,3)*b(2)+a(3,3)*b(3)
700 CALL flagerror(
"Invalid matrix and/or vector size.",err,error,*999)
703 CALL flagerror(
"Invalid matrix sizes.",err,error,*999)
706 exits(
"MatrixTransposeVectorProductDP")
708 999 errorsexits(
"MatrixTransposeVectorProductDP",err,error)
721 INTEGER(INTG),
INTENT(IN) :: A(:,:)
722 INTEGER(INTG),
INTENT(OUT) :: err
725 INTEGER(INTG) :: DeterminantFullIntg
727 enters(
"DeterminantFullIntg",err,error,*999)
729 determinantfullintg=0
731 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 732 SELECT CASE(
SIZE(a,1))
734 determinantfullintg=a(1,1)
736 determinantfullintg=a(1,1)*a(2,2)-a(2,1)*a(1,2)
738 determinantfullintg=a(1,1)*a(2,2)*a(3,3)+a(1,2)*a(2,3)*a(3,1)+a(1,3)*a(2,1)*a(3,2)-a(1,1)*a(3,2)*a(2,3)- &
739 a(2,1)*a(1,2)*a(3,3)-a(3,1)*a(2,2)*a(1,3)
741 CALL flagerror(
"Matrix size not implemented.",err,error,*999)
744 CALL flagerror(
"Matrix is not square.",err,error,*999)
747 exits(
"DeterminantFullIntg")
749 999 errorsexits(
"DeterminantFullIntg",err,error)
762 REAL(SP),
INTENT(IN) :: A(:,:)
763 INTEGER(INTG),
INTENT(OUT) :: err
766 REAL(SP) :: DeterminantFullSP
768 enters(
"DeterminantFullSP",err,error,*999)
770 determinantfullsp=0.0_sp
772 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 773 SELECT CASE(
SIZE(a,1))
775 determinantfullsp=a(1,1)
777 determinantfullsp=a(1,1)*a(2,2)-a(2,1)*a(1,2)
779 determinantfullsp=a(1,1)*a(2,2)*a(3,3)+a(1,2)*a(2,3)*a(3,1)+a(1,3)*a(2,1)*a(3,2)-a(1,1)*a(3,2)*a(2,3)- &
780 a(2,1)*a(1,2)*a(3,3)-a(3,1)*a(2,2)*a(1,3)
782 CALL flagerror(
"Matrix size not implemented.",err,error,*999)
785 CALL flagerror(
"Matrix is not square.",err,error,*999)
788 exits(
"DeterminantFullSP")
790 999 errorsexits(
"DeterminantFullSP",err,error)
803 REAL(DP),
INTENT(IN) :: A(:,:)
804 INTEGER(INTG),
INTENT(OUT) :: err
807 REAL(DP) :: DeterminantFullDP
809 enters(
"DeterminantFullDP",err,error,*999)
811 determinantfulldp=0.0_dp
813 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 814 SELECT CASE(
SIZE(a,1))
816 determinantfulldp=a(1,1)
818 determinantfulldp=a(1,1)*a(2,2)-a(2,1)*a(1,2)
820 determinantfulldp=a(1,1)*a(2,2)*a(3,3)+a(1,2)*a(2,3)*a(3,1)+a(1,3)*a(2,1)*a(3,2)-a(1,1)*a(3,2)*a(2,3)- &
821 a(2,1)*a(1,2)*a(3,3)-a(3,1)*a(2,2)*a(1,3)
823 CALL flagerror(
"Matrix size not implemented.",err,error,*999)
826 CALL flagerror(
"Matrix is not square.",err,error,*999)
829 exits(
"DeterminantFullDP")
831 999 errorsexits(
"DeterminantFullDP",err,error)
841 PURE FUNCTION edpdp(x)
844 REAL(DP),
INTENT(IN) :: x
849 REAL(DP),
PARAMETER :: a1=0.44325141463_dp
850 REAL(DP),
PARAMETER :: a2=0.06260601220_dp
851 REAL(DP),
PARAMETER :: a3=0.04757383546_dp
852 REAL(DP),
PARAMETER :: a4=0.01736506451_dp
853 REAL(DP),
PARAMETER :: b1=0.24998368310_dp
854 REAL(DP),
PARAMETER :: b2=0.09200180037_dp
855 REAL(DP),
PARAMETER :: b3=0.04069697526_dp
856 REAL(DP),
PARAMETER :: b4=0.00526449639_dp
857 REAL(DP) :: term1,term2,x1
860 term1=1.0_dp+(a1+(a2+(a3+a4*x1)*x1)*x1)*x1
861 term2=(b1+(b2+(b3+b4*x1)*x1)*x1)*x1
862 edpdp=term1+term2*log(1.0_dp/x1)
872 PURE FUNCTION edpsp(x)
875 REAL(SP),
INTENT(IN) :: x
880 REAL(SP),
PARAMETER :: a1=0.44325141463_sp
881 REAL(SP),
PARAMETER :: a2=0.06260601220_sp
882 REAL(SP),
PARAMETER :: a3=0.04757383546_sp
883 REAL(SP),
PARAMETER :: a4=0.01736506451_sp
884 REAL(SP),
PARAMETER :: b1=0.24998368310_sp
885 REAL(SP),
PARAMETER :: b2=0.09200180037_sp
886 REAL(SP),
PARAMETER :: b3=0.04069697526_sp
887 REAL(SP),
PARAMETER :: b4=0.00526449639_sp
888 REAL(SP) :: term1,term2,x1
891 term1=1.0_sp+(a1+(a2+(a3+a4*x1)*x1)*x1)*x1
892 term2=(b1+(b2+(b3+b4*x1)*x1)*x1)*x1
893 edpsp=term1+term2*log(1.0_sp/x1)
907 REAL(SP),
INTENT(IN) :: A(:,:)
908 REAL(SP),
INTENT(OUT) :: eValues(:)
909 INTEGER(INTG),
INTENT(OUT) :: err
913 REAL(SP) :: angle,b2,b3,c1,c2,d,q,q3,r,ri1,ri2,ri3,ri4,rq,temp,theta
915 enters(
"EigenvalueFullSP",err,error,*999)
917 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 918 IF(
SIZE(a,1)<=
SIZE(evalues,1))
THEN 919 SELECT CASE(
SIZE(a,1))
925 ri2=a(1,1)*a(2,2)-a(1,2)**2
929 IF(c2>c1)
CALL flagerror(
"Complex roots found in quadratic equation.",err,error,*999)
930 b3=sqrt(c1-c2)/2.0_sp
937 IF(abs(evalues(2))>abs(evalues(1)))
THEN 939 evalues(1)=evalues(2)
943 ri1=a(1,1)+a(2,2)+a(3,3)
944 ri2=a(1,1)*a(2,2)+a(2,2)*a(3,3)+a(3,3)*a(1,1)-(a(1,2)**2+a(2,3)**2+a(3,1)**2)
949 r=ri4*(ri4*ri4-ri2/2.0_sp)+ri3/2.0_sp
957 theta=acos(r/sqrt(abs(q3)))/3.0_sp
959 angle=2.0_sp*
REAL(
pi,
sp)/3.0_SP
960 evalues(1)=2.0_sp*rq*cos(theta)+ri4
961 evalues(2)=2.0_sp*rq*cos(theta+angle)+ri4
962 evalues(3)=2.0_sp*rq*cos(theta+2.0_sp*angle)+ri4
964 IF(abs(evalues(3))>abs(evalues(i)))
THEN 966 evalues(i)=evalues(3)
971 CALL flagerror(
"Matrix size not implemented.",err,error,*999)
974 CALL flagerror(
"Evalues is too small.",err,error,*999)
977 CALL flagerror(
"Matrix is not square.",err,error,*999)
980 exits(
"EigenvalueFullSP")
982 999 errorsexits(
"EigenvalueFullSP",err,error)
995 REAL(DP),
INTENT(IN) :: A(:,:)
996 REAL(DP),
INTENT(OUT) :: eValues(:)
997 INTEGER(INTG),
INTENT(OUT) :: err
1001 REAL(DP) :: angle,b2,b3,c1,c2,d,q,q3,r,ri1,ri2,ri3,ri4,rq,temp,theta
1003 enters(
"EigenvalueFullDP",err,error,*999)
1005 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 1006 IF(
SIZE(a,1)<=
SIZE(evalues,1))
THEN 1007 SELECT CASE(
SIZE(a,1))
1013 ri2=a(1,1)*a(2,2)-a(1,2)**2
1017 IF(c2>c1)
CALL flagerror(
"Complex roots found in quadratic equation.",err,error,*999)
1018 b3=sqrt(c1-c2)/2.0_dp
1025 IF(abs(evalues(2))>abs(evalues(1)))
THEN 1027 evalues(1)=evalues(2)
1031 ri1=a(1,1)+a(2,2)+a(3,3)
1032 ri2=a(1,1)*a(2,2)+a(2,2)*a(3,3)+a(3,3)*a(1,1)-(a(1,2)**2+a(2,3)**2+a(3,1)**2)
1036 q=ri4*ri4-ri2/3.0_dp
1037 r=ri4*(ri4*ri4-ri2/2.0_dp)+ri3/2.0_dp
1045 theta=acos(r/sqrt(abs(q3)))/3.0_dp
1047 angle=2.0_dp*
pi/3.0_dp
1048 evalues(1)=2.0_dp*rq*cos(theta)+ri4
1049 evalues(2)=2.0_dp*rq*cos(theta+angle)+ri4
1050 evalues(3)=2.0_dp*rq*cos(theta+2.0_dp*angle)+ri4
1052 IF(abs(evalues(3))>abs(evalues(i)))
THEN 1054 evalues(i)=evalues(3)
1059 CALL flagerror(
"Matrix size not implemented.",err,error,*999)
1062 CALL flagerror(
"Evalues is too small.",err,error,*999)
1065 CALL flagerror(
"Matrix is not square.",err,error,*999)
1068 exits(
"EigenvalueFullDP")
1070 999 errorsexits(
"EigenvalueFullDP",err,error)
1083 REAL(SP),
INTENT(IN) :: A(:,:)
1084 REAL(SP),
INTENT(IN) :: eValue
1085 REAL(SP),
INTENT(OUT) :: eVector(:)
1086 INTEGER(INTG),
INTENT(OUT) :: err
1089 INTEGER(INTG) :: i,i1,i2,i3,iCycle(3,3)
1090 REAL(SP) :: al,b(size(a,1)),sum,U(size(a,1),size(a,2)),x(size(a,1))
1092 DATA icycle /2,1,1,3,1,2,1,2,1/
1094 enters(
"EigenvectorFullSP",err,error,*999)
1098 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 1099 IF(
SIZE(a,1)<=
SIZE(evector,1))
THEN 1100 SELECT CASE(
SIZE(a,1))
1105 IF(abs(a(1,1)-evalue)>abs(a(2,2)-evalue))
THEN 1106 al=sqrt(a(1,2)**2+(a(1,1)-evalue)**2)
1107 evector(1)=a(1,2)/al
1108 evector(2)=(evalue-a(1,1))/al
1110 al=sqrt(a(1,2)**2+(a(2,2)-evalue)**2)
1111 evector(1)=(evalue-a(2,2))/al
1112 evector(2)=a(1,2)/al
1124 CALL flagerror(
"Zero matrix?? Eigenvectors undetermined.",err,error,*999)
1128 u(i,i)=u(i,i)-evalue
1135 b(1)=-1.0_sp*u(
i1,i)
1136 b(2)=-1.0_sp*u(i2,i)
1138 sum=dot_product(u(i,:),x)
1141 IF(err /= 0)
GOTO 999
1146 CALL flagerror(
"Matrix size not implemented.",err,error,*999)
1149 CALL flagerror(
"Evector is too small.",err,error,*999)
1152 CALL flagerror(
"Matrix is not square.",err,error,*999)
1155 exits(
"EigenvectorFullSP")
1157 999 errorsexits(
"EigenvectorFullSP",err,error)
1170 REAL(DP),
INTENT(IN) :: A(:,:)
1171 REAL(DP),
INTENT(IN) :: eValue
1172 REAL(DP),
INTENT(OUT) :: eVector(:)
1173 INTEGER(INTG),
INTENT(OUT) :: err
1176 INTEGER(INTG) :: i,i1,i2,i3,iCycle(3,3)
1177 REAL(DP) :: al,b(size(a,1)),sum,U(size(a,1),size(a,2)),x(size(a,1))
1179 DATA icycle /2,1,1,3,1,2,1,2,1/
1181 enters(
"EigenvectorFullDP",err,error,*999)
1185 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 1186 IF(
SIZE(a,1)<=
SIZE(evector,1))
THEN 1187 SELECT CASE(
SIZE(a,1))
1192 IF(abs(a(1,1)-evalue)>abs(a(2,2)-evalue))
THEN 1193 al=sqrt(a(1,2)**2+(a(1,1)-evalue)**2)
1194 evector(1)=a(1,2)/al
1195 evector(2)=(evalue-a(1,1))/al
1197 al=sqrt(a(1,2)**2+(a(2,2)-evalue)**2)
1198 evector(1)=(evalue-a(2,2))/al
1199 evector(2)=a(1,2)/al
1211 CALL flagerror(
"Zero matrix?? Eigenvectors undetermined.",err,error,*999)
1215 u(i,i)=u(i,i)-evalue
1222 b(1)=-1.0_dp*u(
i1,i)
1223 b(2)=-1.0_dp*u(i2,i)
1225 sum=dot_product(u(i,:),x)
1228 IF(err /= 0)
GOTO 999
1233 CALL flagerror(
"Matrix size not implemented.",err,error,*999)
1236 CALL flagerror(
"Evector is too small.",err,error,*999)
1239 CALL flagerror(
"Matrix is not square.",err,error,*999)
1242 exits(
"EigenvectorFullDP")
1244 999 errorsexits(
"EigenvectorFullDP",err,error)
1255 PURE FUNCTION i0dp(x)
1258 REAL(DP),
INTENT(IN) :: x
1263 REAL(DP),
PARAMETER :: a1=1.0_dp
1264 REAL(DP),
PARAMETER :: a2=3.5156229_dp
1265 REAL(DP),
PARAMETER :: a3=3.0899424_dp
1266 REAL(DP),
PARAMETER :: a4=1.2067492_dp
1267 REAL(DP),
PARAMETER :: a5=0.2659732_dp
1268 REAL(DP),
PARAMETER :: a6=0.0360768_dp
1269 REAL(DP),
PARAMETER :: a7=0.0045813_dp
1273 t=x*x/(3.75_dp*3.75_dp)
1274 i0dp=a1+(a2+(a3+(a4+(a5+(a6+a7*t)*t)*t)*t)*t)*t
1286 PURE FUNCTION i0sp(x)
1289 REAL(SP),
INTENT(IN) :: x
1294 REAL(SP),
PARAMETER :: a1=1.0_sp
1295 REAL(SP),
PARAMETER :: a2=3.5156229_sp
1296 REAL(SP),
PARAMETER :: a3=3.0899424_sp
1297 REAL(SP),
PARAMETER :: a4=1.2067492_sp
1298 REAL(SP),
PARAMETER :: a5=0.2659732_sp
1299 REAL(SP),
PARAMETER :: a6=0.0360768_sp
1300 REAL(SP),
PARAMETER :: a7=0.0045813_sp
1304 t=x*x/(3.75_sp*3.75_sp)
1305 i0sp=a1+(a2+(a3+(a4+(a5+(a6+a7*t)*t)*t)*t)*t)*t
1317 PURE FUNCTION i1dp(x)
1320 REAL(DP),
INTENT(IN) :: x
1325 REAL(DP),
PARAMETER :: a1=0.5_dp
1326 REAL(DP),
PARAMETER :: a2=0.87890594_dp
1327 REAL(DP),
PARAMETER :: a3=0.51498869_dp
1328 REAL(DP),
PARAMETER :: a4=0.15084934_dp
1329 REAL(DP),
PARAMETER :: a5=0.02658733_dp
1330 REAL(DP),
PARAMETER :: a6=0.00301532_dp
1331 REAL(DP),
PARAMETER :: a7=0.00032411_dp
1335 t=(x/3.75_dp)*(x/3.75_dp)
1336 i1dp=(a1+(a2+(a3+(a4+(a5+(a6+a7*t)*t)*t)*t)*t)*t)*x
1348 PURE FUNCTION i1sp(x)
1351 REAL(SP),
INTENT(IN) :: x
1356 REAL(SP),
PARAMETER :: a1=0.5_sp
1357 REAL(SP),
PARAMETER :: a2=0.87890594_sp
1358 REAL(SP),
PARAMETER :: a3=0.51498869_sp
1359 REAL(SP),
PARAMETER :: a4=0.15084934_sp
1360 REAL(SP),
PARAMETER :: a5=0.02658733_sp
1361 REAL(SP),
PARAMETER :: a6=0.00301532_sp
1362 REAL(SP),
PARAMETER :: a7=0.00032411_sp
1366 t=(x/3.75_sp)*(x/3.75_sp)
1367 i1sp=(a1+(a2+(a3+(a4+(a5+(a6+7*t)*t)*t)*t)*t)*t)*x
1381 REAL(SP),
INTENT(OUT) :: A(:,:)
1382 INTEGER(INTG),
INTENT(OUT) :: err
1387 enters(
"IdentityMatrixSP",err,error,*999)
1389 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 1390 SELECT CASE(
SIZE(a,1))
1415 CALL flagerror(
"Matrix A is not square.",err,error,*999)
1418 exits(
"IdentityMatrixSP")
1420 999 errorsexits(
"IdentityMatrixSP",err,error)
1433 REAL(DP),
INTENT(OUT) :: A(:,:)
1434 INTEGER(INTG),
INTENT(OUT) :: err
1439 enters(
"IdentityMatrixDP",err,error,*999)
1441 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 1442 SELECT CASE(
SIZE(a,1))
1467 CALL flagerror(
"Matrix A is not square.",err,error,*999)
1470 exits(
"IdentityMatrixDP")
1472 999 errorsexits(
"IdentityMatrixDP",err,error)
1485 REAL(SP),
INTENT(IN) :: A(:,:)
1486 REAL(SP),
INTENT(OUT) :: B(:,:)
1487 REAL(SP),
INTENT(OUT) :: det
1488 INTEGER(INTG),
INTENT(OUT) :: err
1492 enters(
"InvertFullSP",err,error,*999)
1494 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 1495 IF(
SIZE(b,1)==
SIZE(a,1).AND.
SIZE(b,2)==
SIZE(a,2))
THEN 1496 SELECT CASE(
SIZE(a,1))
1500 b(1,1)=1.0_sp/a(1,1)
1502 CALL flagwarning(
"Matrix A is zero and cannot be inverted.",err,error,*999)
1506 det=a(1,1)*a(2,2)-a(1,2)*a(2,1)
1513 CALL flagwarning(
"Zero Determinant for matrix A.",err,error,*999)
1517 det=a(1,1)*a(2,2)*a(3,3)+a(1,2)*a(2,3)*a(3,1)+a(1,3)*a(2,1)*a(3,2)-a(1,1)*a(3,2)*a(2,3)-a(2,1)*a(1,2)*a(3,3)- &
1518 & a(3,1)*a(2,2)*a(1,3)
1520 b(1,1)=(a(2,2)*a(3,3)-a(3,2)*a(2,3))/det
1521 b(2,1)=(a(2,3)*a(3,1)-a(3,3)*a(2,1))/det
1522 b(3,1)=(a(2,1)*a(3,2)-a(3,1)*a(2,2))/det
1523 b(1,2)=(a(3,2)*a(1,3)-a(1,2)*a(3,3))/det
1524 b(2,2)=(a(3,3)*a(1,1)-a(1,3)*a(3,1))/det
1525 b(3,2)=(a(3,1)*a(1,2)-a(1,1)*a(3,2))/det
1526 b(1,3)=(a(1,2)*a(2,3)-a(2,2)*a(1,3))/det
1527 b(2,3)=(a(1,3)*a(2,1)-a(2,3)*a(1,1))/det
1528 b(3,3)=(a(1,1)*a(2,2)-a(2,1)*a(1,2))/det
1530 CALL flagwarning(
"Zero Determinant for matrix A.",err,error,*999)
1534 CALL flagerror(
"Matrix size is not implemented.",err,error,*999)
1537 CALL flagerror(
"Matrix B is not the same size as matrix A.",err,error,*999)
1540 CALL flagerror(
"Matrix A is not square.",err,error,*999)
1543 exits(
"InvertFullSP")
1545 999 errorsexits(
"InvertFullSP",err,error)
1558 REAL(DP),
INTENT(IN) :: A(:,:)
1559 REAL(DP),
INTENT(OUT) :: B(:,:)
1560 REAL(DP),
INTENT(OUT) :: det
1561 INTEGER(INTG),
INTENT(OUT) :: err
1565 enters(
"InvertFullDP",err,error,*999)
1567 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 1568 IF(
SIZE(b,1)==
SIZE(a,1).AND.
SIZE(b,2)==
SIZE(a,2))
THEN 1569 SELECT CASE(
SIZE(a,1))
1573 b(1,1)=1.0_dp/a(1,1)
1575 CALL flagwarning(
"Matrix A is zero and cannot be inverted",err,error,*999)
1579 det=a(1,1)*a(2,2)-a(2,1)*a(1,2)
1586 CALL flagwarning(
"Zero Determinant for matrix A.",err,error,*999)
1590 det=a(1,1)*a(2,2)*a(3,3)+a(1,2)*a(2,3)*a(3,1)+a(1,3)*a(2,1)*a(3,2)-a(1,1)*a(3,2)*a(2,3)-a(2,1)*a(1,2)*a(3,3)- &
1591 & a(3,1)*a(2,2)*a(1,3)
1593 b(1,1)=(a(2,2)*a(3,3)-a(3,2)*a(2,3))/det
1594 b(2,1)=(a(2,3)*a(3,1)-a(3,3)*a(2,1))/det
1595 b(3,1)=(a(2,1)*a(3,2)-a(3,1)*a(2,2))/det
1596 b(1,2)=(a(3,2)*a(1,3)-a(1,2)*a(3,3))/det
1597 b(2,2)=(a(3,3)*a(1,1)-a(1,3)*a(3,1))/det
1598 b(3,2)=(a(3,1)*a(1,2)-a(1,1)*a(3,2))/det
1599 b(1,3)=(a(1,2)*a(2,3)-a(2,2)*a(1,3))/det
1600 b(2,3)=(a(1,3)*a(2,1)-a(2,3)*a(1,1))/det
1601 b(3,3)=(a(1,1)*a(2,2)-a(2,1)*a(1,2))/det
1603 CALL flagwarning(
"Zero Determinant for matrix A.",err,error,*999)
1607 CALL flagerror(
"Matrix size is not implemented.",err,error,*999)
1610 CALL flagerror(
"Matrix B is not the same size as matrix A.",err,error,*999)
1613 CALL flagerror(
"Matrix A is not square.",err,error,*999)
1616 exits(
"InvertFullDP")
1618 999 errorsexits(
"InvertFullDP",err,error)
1629 PURE FUNCTION k0dp(x)
1632 REAL(DP),
INTENT(IN) :: x
1636 REAL(DP) :: a1,a2,a3,a4,a5,a6,a7,t
1649 k0dp=-log(x/2.0_dp)*
i0(x)+(a1+(a2+(a3+(a4+(a5+(a6+a7*t)*t)*t)*t)*t)*t)
1662 k0dp=(a1+(a2+(a3+(a4+(a5+(a6+a7*t)*t)*t)*t)*t)*t)*exp(-x)/sqrt(x)
1676 PURE FUNCTION k0sp(x)
1679 REAL(SP),
INTENT(IN) :: x
1683 REAL(SP) :: a1,a2,a3,a4,a5,a6,a7,t
1696 k0sp=-log(x/2.0_sp)*
i0(x)+(a1+(a2+(a3+(a4+(a5+(a6+a7*t)*t)*t)*t)*t)*t)
1709 k0sp=(a1+(a2+(a3+(a4+(a5+(a6+a7*t)*t)*t)*t)*t)*t)*exp(-x)/sqrt(x)
1723 PURE FUNCTION k1dp(x)
1726 REAL(DP),
INTENT(IN) :: x
1730 REAL(DP) :: a1,a2,a3,a4,a5,a6,a7,a8,t
1735 t=(x/2.0_dp)*(x/2.0_dp)
1736 a1=log(x/2.0_dp)*
i1(x)
1744 k1dp=a1+a2/x+(a3+(a4+(a5+(a6+(a7+a8*t)*t)*t)*t)*t)*x/4.0_dp
1746 IF (x>174.0_dp)
THEN 1757 k1dp=(a1+(a2+(a3+(a4+(a5+(a6+a7*t)*t)*t)*t)*t)*t)*exp(-x)/sqrt(x)
1771 PURE FUNCTION k1sp(x)
1774 REAL(SP),
INTENT(IN) :: x
1778 REAL(SP) :: a1,a2,a3,a4,a5,a6,a7,a8,t
1783 t=(x/2.0_sp)*(x/2.0_sp)
1784 a1=log(x/2.0_sp)*
i1(x)
1792 k1sp=a1+a2/x+(a3+(a4+(a5+(a6+(a7+a8*t)*t)*t)*t)*t)*x/4.0_sp
1794 IF (x>174.0_sp)
THEN 1805 k1sp=(a1+(a2+(a3+(a4+(a5+(a6+a7*t)*t)*t)*t)*t)*t)*exp(-x)/sqrt(x)
1818 PURE FUNCTION kdpdp(x)
1821 REAL(DP),
INTENT(IN) :: x
1826 REAL(DP),
PARAMETER :: a0=1.38629436112_dp
1827 REAL(DP),
PARAMETER :: a1=0.09666344259_dp
1828 REAL(DP),
PARAMETER :: a2=0.03590092383_dp
1829 REAL(DP),
PARAMETER :: a3=0.03742563713_dp
1830 REAL(DP),
PARAMETER :: a4=0.01451196212_dp
1831 REAL(DP),
PARAMETER :: b0=0.5_dp
1832 REAL(DP),
PARAMETER :: b1=0.12498593597_dp
1833 REAL(DP),
PARAMETER :: b2=0.06880248576_dp
1834 REAL(DP),
PARAMETER :: b3=0.03328355346_dp
1835 REAL(DP),
PARAMETER :: b4=0.00441787012_dp
1836 REAL(DP) :: term1,term2,x1
1839 term1=a0+(a1+(a2+(a3+a4*x)*x)*x)*x
1840 term2=b0+(b1+(b2+(b3+b4*x)*x)*x)*x
1841 kdpdp=term1+term2*log(1.0_dp/x)
1852 PURE FUNCTION kdpsp(x)
1855 REAL(SP),
INTENT(IN) :: x
1860 REAL(SP),
PARAMETER :: a0=1.38629436112_sp
1861 REAL(SP),
PARAMETER :: a1=0.09666344259_sp
1862 REAL(SP),
PARAMETER :: a2=0.03590092383_sp
1863 REAL(SP),
PARAMETER :: a3=0.03742563713_sp
1864 REAL(SP),
PARAMETER :: a4=0.01451196212_sp
1865 REAL(SP),
PARAMETER :: b0=0.5_sp
1866 REAL(SP),
PARAMETER :: b1=0.12498593597_sp
1867 REAL(SP),
PARAMETER :: b2=0.06880248576_sp
1868 REAL(SP),
PARAMETER :: b3=0.03328355346_sp
1869 REAL(SP),
PARAMETER :: b4=0.00441787012_sp
1870 REAL(SP) :: term1,term2,x1
1873 term1=a0+(a1+(a2+(a3+a4*x)*x)*x)*x
1874 term2=b0+(b1+(b2+(b3+b4*x)*x)*x)*x
1875 kdpsp=term1+term2*log(1.0_sp/x)
1889 REAL(SP),
INTENT(IN) :: a(:)
1891 REAL(SP) :: L2NormSP
1910 REAL(DP),
INTENT(IN) :: a(:)
1912 REAL(DP) :: L2NormDP
1931 REAL(SP),
INTENT(IN) :: A(:,:)
1932 REAL(SP),
INTENT(IN) :: B(:,:)
1933 REAL(SP),
INTENT(OUT) :: C(:,:)
1934 INTEGER(INTG),
INTENT(OUT) :: err
1938 enters(
"MatrixProductSP",err,error,*999)
1940 IF(
SIZE(a,2)==
SIZE(b,1).AND.
SIZE(a,1)==
SIZE(c,1).AND.
SIZE(b,2)==
SIZE(c,2))
THEN 1941 SELECT CASE(
SIZE(a,1))
1943 c(1,1)=a(1,1)*b(1,1)
1945 c(1,1)=a(1,1)*b(1,1)+a(1,2)*b(2,1)
1946 c(1,2)=a(1,1)*b(1,2)+a(1,2)*b(2,2)
1947 c(2,1)=a(2,1)*b(1,1)+a(2,2)*b(2,1)
1948 c(2,2)=a(2,1)*b(1,2)+a(2,2)*b(2,2)
1950 c(1,1)=a(1,1)*b(1,1)+a(1,2)*b(2,1)+a(1,3)*b(3,1)
1951 c(1,2)=a(1,1)*b(1,2)+a(1,2)*b(2,2)+a(1,3)*b(3,2)
1952 c(1,3)=a(1,1)*b(1,3)+a(1,2)*b(2,3)+a(1,3)*b(3,3)
1953 c(2,1)=a(2,1)*b(1,1)+a(2,2)*b(2,1)+a(2,3)*b(3,1)
1954 c(2,2)=a(2,1)*b(1,2)+a(2,2)*b(2,2)+a(2,3)*b(3,2)
1955 c(2,3)=a(2,1)*b(1,3)+a(2,2)*b(2,3)+a(2,3)*b(3,3)
1956 c(3,1)=a(3,1)*b(1,1)+a(3,2)*b(2,1)+a(3,3)*b(3,1)
1957 c(3,2)=a(3,1)*b(1,2)+a(3,2)*b(2,2)+a(3,3)*b(3,2)
1958 c(3,3)=a(3,1)*b(1,3)+a(3,2)*b(2,3)+a(3,3)*b(3,3)
1960 CALL flagerror(
"Invalid matrix size.",err,error,*999)
1963 CALL flagerror(
"Invalid matrix sizes.",err,error,*999)
1966 exits(
"MatrixProductSP")
1968 999 errorsexits(
"MatrixProductSP",err,error)
1981 REAL(DP),
INTENT(IN) :: A(:,:)
1982 REAL(DP),
INTENT(IN) :: B(:,:)
1983 REAL(DP),
INTENT(OUT) :: C(:,:)
1984 INTEGER(INTG),
INTENT(OUT) :: err
1988 enters(
"MatrixProductDP",err,error,*999)
1990 IF(
SIZE(a,2)==
SIZE(b,1).AND.
SIZE(a,1)==
SIZE(c,1).AND.
SIZE(b,2)==
SIZE(c,2))
THEN 1991 SELECT CASE(
SIZE(a,1))
1993 c(1,1)=a(1,1)*b(1,1)
1995 c(1,1)=a(1,1)*b(1,1)+a(1,2)*b(2,1)
1996 c(1,2)=a(1,1)*b(1,2)+a(1,2)*b(2,2)
1997 c(2,1)=a(2,1)*b(1,1)+a(2,2)*b(2,1)
1998 c(2,2)=a(2,1)*b(1,2)+a(2,2)*b(2,2)
2000 c(1,1)=a(1,1)*b(1,1)+a(1,2)*b(2,1)+a(1,3)*b(3,1)
2001 c(1,2)=a(1,1)*b(1,2)+a(1,2)*b(2,2)+a(1,3)*b(3,2)
2002 c(1,3)=a(1,1)*b(1,3)+a(1,2)*b(2,3)+a(1,3)*b(3,3)
2003 c(2,1)=a(2,1)*b(1,1)+a(2,2)*b(2,1)+a(2,3)*b(3,1)
2004 c(2,2)=a(2,1)*b(1,2)+a(2,2)*b(2,2)+a(2,3)*b(3,2)
2005 c(2,3)=a(2,1)*b(1,3)+a(2,2)*b(2,3)+a(2,3)*b(3,3)
2006 c(3,1)=a(3,1)*b(1,1)+a(3,2)*b(2,1)+a(3,3)*b(3,1)
2007 c(3,2)=a(3,1)*b(1,2)+a(3,2)*b(2,2)+a(3,3)*b(3,2)
2008 c(3,3)=a(3,1)*b(1,3)+a(3,2)*b(2,3)+a(3,3)*b(3,3)
2010 CALL flagerror(
"Invalid matrix size.",err,error,*999)
2013 CALL flagerror(
"Invalid matrix sizes.",err,error,*999)
2016 exits(
"MatrixProductDP")
2018 999 errorsexits(
"MatrixProductDP",err,error)
2031 REAL(SP),
INTENT(IN) :: A(:,:)
2032 REAL(SP),
INTENT(IN) :: B(:,:)
2033 REAL(SP),
INTENT(OUT) :: C(:,:)
2034 INTEGER(INTG),
INTENT(OUT) :: err
2038 enters(
"MatrixTransposeProductSP",err,error,*999)
2040 IF(
SIZE(a,2)==
SIZE(b,1).AND.
SIZE(a,1)==
SIZE(c,1).AND.
SIZE(b,2)==
SIZE(c,2))
THEN 2041 SELECT CASE(
SIZE(a,1))
2043 c(1,1)=a(1,1)*b(1,1)
2045 c(1,1)=a(1,1)*b(1,1)+a(2,1)*b(2,1)
2046 c(1,2)=a(1,1)*b(1,2)+a(2,1)*b(2,2)
2047 c(2,1)=a(1,2)*b(1,1)+a(2,2)*b(2,1)
2048 c(2,2)=a(1,2)*b(1,2)+a(2,2)*b(2,2)
2050 c(1,1)=a(1,1)*b(1,1)+a(2,1)*b(2,1)+a(3,1)*b(3,1)
2051 c(1,2)=a(1,1)*b(1,2)+a(2,1)*b(2,2)+a(3,1)*b(3,2)
2052 c(1,3)=a(1,1)*b(1,3)+a(2,1)*b(2,3)+a(3,1)*b(3,3)
2053 c(2,1)=a(1,2)*b(1,1)+a(2,2)*b(2,1)+a(3,2)*b(3,1)
2054 c(2,2)=a(1,2)*b(1,2)+a(2,2)*b(2,2)+a(3,2)*b(3,2)
2055 c(2,3)=a(1,2)*b(1,3)+a(2,2)*b(2,3)+a(3,2)*b(3,3)
2056 c(3,1)=a(1,3)*b(1,1)+a(2,3)*b(2,1)+a(3,3)*b(3,1)
2057 c(3,2)=a(1,3)*b(1,2)+a(2,3)*b(2,2)+a(3,3)*b(3,2)
2058 c(3,3)=a(1,3)*b(1,3)+a(2,3)*b(2,3)+a(3,3)*b(3,3)
2060 CALL flagerror(
"Invalid matrix size.",err,error,*999)
2063 CALL flagerror(
"Invalid matrix sizes.",err,error,*999)
2066 exits(
"MatrixTransposeProductSP")
2068 999 errorsexits(
"MatrixTransposeProductSP",err,error)
2081 REAL(DP),
INTENT(IN) :: A(:,:)
2082 REAL(DP),
INTENT(IN) :: B(:,:)
2083 REAL(DP),
INTENT(OUT) :: C(:,:)
2084 INTEGER(INTG),
INTENT(OUT) :: err
2088 enters(
"MatrixTransposeProductDP",err,error,*999)
2090 IF(
SIZE(a,2)==
SIZE(b,1).AND.
SIZE(a,1)==
SIZE(c,1).AND.
SIZE(b,2)==
SIZE(c,2))
THEN 2091 SELECT CASE(
SIZE(a,1))
2093 c(1,1)=a(1,1)*b(1,1)
2095 c(1,1)=a(1,1)*b(1,1)+a(2,1)*b(2,1)
2096 c(1,2)=a(1,1)*b(1,2)+a(2,1)*b(2,2)
2097 c(2,1)=a(1,2)*b(1,1)+a(2,2)*b(2,1)
2098 c(2,2)=a(1,2)*b(1,2)+a(2,2)*b(2,2)
2100 c(1,1)=a(1,1)*b(1,1)+a(2,1)*b(2,1)+a(3,1)*b(3,1)
2101 c(1,2)=a(1,1)*b(1,2)+a(2,1)*b(2,2)+a(3,1)*b(3,2)
2102 c(1,3)=a(1,1)*b(1,3)+a(2,1)*b(2,3)+a(3,1)*b(3,3)
2103 c(2,1)=a(1,2)*b(1,1)+a(2,2)*b(2,1)+a(3,2)*b(3,1)
2104 c(2,2)=a(1,2)*b(1,2)+a(2,2)*b(2,2)+a(3,2)*b(3,2)
2105 c(2,3)=a(1,2)*b(1,3)+a(2,2)*b(2,3)+a(3,2)*b(3,3)
2106 c(3,1)=a(1,3)*b(1,1)+a(2,3)*b(2,1)+a(3,3)*b(3,1)
2107 c(3,2)=a(1,3)*b(1,2)+a(2,3)*b(2,2)+a(3,3)*b(3,2)
2108 c(3,3)=a(1,3)*b(1,3)+a(2,3)*b(2,3)+a(3,3)*b(3,3)
2110 CALL flagerror(
"Invalid matrix size.",err,error,*999)
2113 CALL flagerror(
"Invalid matrix sizes.",err,error,*999)
2116 exits(
"MatrixTransposeProductDP")
2118 999 errorsexits(
"MatrixTransposeProductDP",err,error)
2130 REAL(SP),
INTENT(IN) :: A(:,:)
2131 REAL(SP),
INTENT(IN) :: B(:,:)
2132 REAL(SP),
INTENT(OUT) :: C(:,:)
2133 INTEGER(INTG),
INTENT(OUT) :: err
2137 enters(
"MatrixProductTransposeSP",err,error,*999)
2139 IF(
SIZE(a,2)==
SIZE(b,2).AND.
SIZE(a,1)==
SIZE(c,1).AND.
SIZE(b,1)==
SIZE(c,2))
THEN 2140 SELECT CASE(
SIZE(a,1))
2142 c(1,1)=a(1,1)*b(1,1)
2144 c(1,1)=a(1,1)*b(1,1)+a(1,2)*b(1,2)
2145 c(1,2)=a(1,1)*b(2,1)+a(1,2)*b(2,2)
2146 c(2,1)=a(2,1)*b(1,1)+a(2,2)*b(1,2)
2147 c(2,2)=a(2,1)*b(2,1)+a(2,2)*b(2,2)
2149 c(1,1)=a(1,1)*b(1,1)+a(1,2)*b(1,2)+a(1,3)*b(1,3)
2150 c(1,2)=a(1,1)*b(2,1)+a(1,2)*b(2,2)+a(1,3)*b(2,3)
2151 c(1,3)=a(1,1)*b(3,1)+a(1,2)*b(3,2)+a(1,3)*b(3,3)
2152 c(2,1)=a(2,1)*b(1,1)+a(2,2)*b(1,2)+a(2,3)*b(1,3)
2153 c(2,2)=a(2,1)*b(2,1)+a(2,2)*b(2,2)+a(2,3)*b(2,3)
2154 c(2,3)=a(2,1)*b(3,1)+a(2,2)*b(3,2)+a(2,3)*b(3,3)
2155 c(3,1)=a(3,1)*b(1,1)+a(3,2)*b(1,2)+a(3,3)*b(1,3)
2156 c(3,2)=a(3,1)*b(2,1)+a(3,2)*b(2,2)+a(3,3)*b(2,3)
2157 c(3,3)=a(3,1)*b(3,1)+a(3,2)*b(3,2)+a(3,3)*b(3,3)
2159 CALL flagerror(
"Invalid matrix size.",err,error,*999)
2162 CALL flagerror(
"Invalid matrix sizes.",err,error,*999)
2165 exits(
"MatrixProductTransposeSP")
2167 999 errorsexits(
"MatrixProductTransposeSP",err,error)
2180 REAL(DP),
INTENT(IN) :: A(:,:)
2181 REAL(DP),
INTENT(IN) :: B(:,:)
2182 REAL(DP),
INTENT(OUT) :: C(:,:)
2183 INTEGER(INTG),
INTENT(OUT) :: err
2187 enters(
"MatrixProductTranposeDP",err,error,*999)
2189 IF(
SIZE(a,2)==
SIZE(b,2).AND.
SIZE(a,1)==
SIZE(c,1).AND.
SIZE(b,1)==
SIZE(c,2))
THEN 2190 SELECT CASE(
SIZE(a,1))
2192 c(1,1)=a(1,1)*b(1,1)
2194 c(1,1)=a(1,1)*b(1,1)+a(1,2)*b(1,2)
2195 c(1,2)=a(1,1)*b(2,1)+a(1,2)*b(2,2)
2196 c(2,1)=a(2,1)*b(1,1)+a(2,2)*b(1,2)
2197 c(2,2)=a(2,1)*b(2,1)+a(2,2)*b(2,2)
2199 c(1,1)=a(1,1)*b(1,1)+a(1,2)*b(1,2)+a(1,3)*b(1,3)
2200 c(1,2)=a(1,1)*b(2,1)+a(1,2)*b(2,2)+a(1,3)*b(2,3)
2201 c(1,3)=a(1,1)*b(3,1)+a(1,2)*b(3,2)+a(1,3)*b(3,3)
2202 c(2,1)=a(2,1)*b(1,1)+a(2,2)*b(1,2)+a(2,3)*b(1,3)
2203 c(2,2)=a(2,1)*b(2,1)+a(2,2)*b(2,2)+a(2,3)*b(2,3)
2204 c(2,3)=a(2,1)*b(3,1)+a(2,2)*b(3,2)+a(2,3)*b(3,3)
2205 c(3,1)=a(3,1)*b(1,1)+a(3,2)*b(1,2)+a(3,3)*b(1,3)
2206 c(3,2)=a(3,1)*b(2,1)+a(3,2)*b(2,2)+a(3,3)*b(2,3)
2207 c(3,3)=a(3,1)*b(3,1)+a(3,2)*b(3,2)+a(3,3)*b(3,3)
2209 CALL flagerror(
"Invalid matrix size.",err,error,*999)
2212 CALL flagerror(
"Invalid matrix sizes.",err,error,*999)
2215 exits(
"MatrixProductTransposeDP")
2217 999 errorsexits(
"MatrixProductTransposeDP",err,error)
2230 REAL(SP),
INTENT(IN) :: A(:,:)
2231 REAL(SP),
INTENT(OUT) :: AT(:,:)
2232 INTEGER(INTG),
INTENT(OUT) :: err
2236 enters(
"MatrixTransposeSP",err,error,*999)
2238 IF(
SIZE(a,1)==
SIZE(at,2).AND.
SIZE(a,2)==
SIZE(at,1))
THEN 2239 SELECT CASE(
SIZE(a,1))
2258 CALL flagerror(
"Invalid matrix size.",err,error,*999)
2261 CALL flagerror(
"Invalid matrix size.",err,error,*999)
2264 exits(
"MatrixTransposeSP")
2266 999 errorsexits(
"MatrixTransposeSP",err,error)
2279 REAL(DP),
INTENT(IN) :: A(:,:)
2280 REAL(DP),
INTENT(OUT) :: AT(:,:)
2281 INTEGER(INTG),
INTENT(OUT) :: err
2285 enters(
"MatrixTransposeDP",err,error,*999)
2287 IF(
SIZE(a,1)==
SIZE(at,2).AND.
SIZE(a,2)==
SIZE(at,1))
THEN 2288 SELECT CASE(
SIZE(a,1))
2307 CALL flagerror(
"Invalid matrix size.",err,error,*999)
2310 CALL flagerror(
"Invalid matrix size.",err,error,*999)
2313 exits(
"MatrixTransposeDP")
2315 999 errorsexits(
"MatrixTransposeDP",err,error)
2328 REAL(SP),
INTENT(IN) :: a(:)
2329 INTEGER(INTG),
INTENT(OUT) :: err
2332 REAL(SP) :: NormaliseSP(size(a,1))
2336 enters(
"",err,error,*999)
2341 CALL flagerror(
"Length of the vector to normalise is zero.",err,error,*999)
2343 normalisesp=a/length
2346 exits(
"NormaliseSP")
2348 999 errorsexits(
"NormaliseSP",err,error)
2361 REAL(DP),
INTENT(IN) :: a(:)
2362 INTEGER(INTG),
INTENT(OUT) :: err
2365 REAL(DP) :: NormaliseDP(size(a,1))
2369 enters(
"NormaliseDP",err,error,*999)
2374 CALL flagerror(
"Length of the vector to normalise is zero.",err,error,*999)
2376 normalisedp=a/length
2379 exits(
"NormaliseDP")
2381 999 errorsexits(
"NormaliseDP",err,error)
2394 REAL(SP),
INTENT(IN) :: a(:)
2395 REAL(SP),
INTENT(IN) :: b(:)
2396 REAL(SP),
INTENT(OUT) :: c(:)
2397 INTEGER(INTG),
INTENT(OUT) :: err
2401 enters(
"NormCrossProductSP",err,error,*999)
2407 exits(
"NormCrossProductSP")
2409 999 errorsexits(
"NormCrossProductSP",err,error)
2422 REAL(DP),
INTENT(IN) :: a(:)
2423 REAL(DP),
INTENT(IN) :: b(:)
2424 REAL(DP),
INTENT(OUT) :: c(:)
2425 INTEGER(INTG),
INTENT(OUT) :: err
2429 enters(
"NormCrossProductDP",err,error,*999)
2435 exits(
"NormCrossProductDP")
2437 999 errorsexits(
"NormCrossProductDP",err,error)
2450 REAL(SP),
INTENT(IN) :: A(:,:)
2451 REAL(SP),
INTENT(OUT) :: x(:)
2452 REAL(SP),
INTENT(IN) :: b(:)
2453 INTEGER(INTG),
INTENT(OUT) :: err
2456 REAL(SP) :: AInv(size(a,1),size(a,2)),det
2458 enters(
"SolveSmallLinearSystemSP",err,error,*999)
2460 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 2461 IF(
SIZE(a,1)==
SIZE(b,1))
THEN 2462 IF(
SIZE(a,1)<=
SIZE(x,1))
THEN 2463 SELECT CASE(
SIZE(a,1))
2465 CALL invert(a,ainv,det,err,error,*999)
2468 CALL flagerror(
"Matrix size not implemented.",err,error,*999)
2471 CALL flagerror(
"x is too small.",err,error,*999)
2474 CALL flagerror(
"Size of b is not the same as the number of rows in A.",err,error,*999)
2477 CALL flagerror(
"Matrix is not square.",err,error,*999)
2480 exits(
"SolveSmallLinearSystemSP")
2482 999 errorsexits(
"SolveSmallLinearSystemSP",err,error)
2495 REAL(DP),
INTENT(IN) :: A(:,:)
2496 REAL(DP),
INTENT(OUT) :: x(:)
2497 REAL(DP),
INTENT(IN) :: b(:)
2498 INTEGER(INTG),
INTENT(OUT) :: err
2501 REAL(DP) :: AInv(size(a,1),size(a,2)),det
2503 enters(
"SolveSmallLinearSystemDP",err,error,*999)
2505 IF(
SIZE(a,1)==
SIZE(a,2))
THEN 2506 IF(
SIZE(a,1)==
SIZE(b,1))
THEN 2507 IF(
SIZE(a,1)<=
SIZE(x,1))
THEN 2508 SELECT CASE(
SIZE(a,1))
2510 CALL invert(a,ainv,det,err,error,*999)
2513 CALL flagerror(
"Matrix size not implemented.",err,error,*999)
2516 CALL flagerror(
"x is too small.",err,error,*999)
2519 CALL flagerror(
"Size of b is not the same as the number of rows in A.",err,error,*999)
2522 CALL flagerror(
"Matrix is not square.",err,error,*999)
2525 exits(
"SolveSmallLinearSystemDP")
2527 999 errorsexits(
"SolveSmallLinearSystemDP",err,error)
2540 REAL(SP),
INTENT(IN) :: a
2544 cothsp=(exp(a)+exp(-1.0_sp*a))/(exp(a)-exp(-1.0_sp*a))
2558 REAL(DP),
INTENT(IN) :: a
2562 cothdp=(exp(a)+exp(-1.0_dp*a))/(exp(a)-exp(-1.0_dp*a))
2574 SUBROUTINE spline_cubic_set (n, t, y, ibcbeg, ybcbeg, ibcend, ybcend, ypp, err, error, *)
2577 INTEGER(INTG),
INTENT(IN) :: n
2578 REAL(DP),
INTENT(IN) :: t(n)
2579 REAL(DP),
INTENT(IN) :: y(n)
2580 INTEGER(INTG),
INTENT(IN) :: ibcbeg
2581 REAL(DP),
INTENT(IN) :: ybcbeg
2582 INTEGER(INTG),
INTENT(IN) :: ibcend
2583 REAL(DP),
INTENT(IN) :: ybcend
2584 REAL(DP),
INTENT(OUT) :: ypp(n)
2585 INTEGER(INTG),
INTENT(OUT) :: err
2589 REAL(DP) :: sub(2:n)
2590 REAL(DP) :: sup(1:n-1)
2594 enters(
"spline_cubic_set",err,error,*999)
2598 localerror=
"spline interpolation requires at least 2 knots- user supplied "//
trim(
numbertovstring(n,
"*",err,error))
2599 CALL flagerror(localerror,err,error,*999)
2602 IF ( t(i) >= t(i+1) )
then 2603 localerror=
"Non-increasing knots supplied for cubic spline interpolation." 2604 CALL flagerror(localerror,err,error,*999)
2609 IF ( ibcbeg == 0 )
then 2611 diag(1) = 1.0e+00_dp
2612 sup(1) = -1.0e+00_dp
2613 ELSE IF ( ibcbeg == 1 )
then 2614 ypp(1) = ( y(2) - y(1) ) / ( t(2) - t(1) ) - ybcbeg
2615 diag(1) = ( t(2) - t(1) ) / 3.0e+00_dp
2616 sup(1) = ( t(2) - t(1) ) / 6.0e+00_dp
2617 ELSE IF ( ibcbeg == 2 )
then 2619 diag(1) = 1.0e+00_dp
2622 localerror=
"The boundary flag IBCBEG must be 0, 1 or 2." 2623 CALL flagerror(localerror,err,error,*999)
2628 ypp(i) = ( y(i+1) - y(i) ) / ( t(i+1) - t(i) ) &
2629 & - ( y(i) - y(i-1) ) / ( t(i) - t(i-1) )
2630 sub(i) = ( t(i) - t(i-1) ) / 6.0e+00_dp
2631 diag(i) = ( t(i+1) - t(i-1) ) / 3.0e+00_dp
2632 sup(i) = ( t(i+1) - t(i) ) / 6.0e+00_dp
2636 IF ( ibcend == 0 )
then 2638 sub(n) = -1.0e+00_dp
2639 diag(n) = 1.0e+00_dp
2640 ELSE IF ( ibcend == 1 )
then 2641 ypp(n) = ybcend - ( y(n) - y(n-1) ) / ( t(n) - t(n-1) )
2642 sub(n) = ( t(n) - t(n-1) ) / 6.0e+00_dp
2643 diag(n) = ( t(n) - t(n-1) ) / 3.0e+00_dp
2644 ELSE IF ( ibcend == 2 )
then 2647 diag(n) = 1.0e+00_dp
2649 localerror=
"The boundary flag IBCEND must be 0, 1 or 2." 2650 CALL flagerror(localerror,err,error,*999)
2655 IF ( n == 2 .and. ibcbeg == 0 .and. ibcend == 0 )
then 2661 CALL s3_fs ( sub, diag, sup, n, ypp, ypp, err, error, *999 )
2664 exits(
"spline_cubic_set")
2666 999 errorsexits(
"spline_cubic_set",err,error)
2677 SUBROUTINE s3_fs ( a1, a2, a3, n, b, x, err, error, *)
2680 REAL(DP),
INTENT(INOUT) :: a1(2:n)
2681 REAL(DP),
INTENT(INOUT) :: a2(1:n)
2682 REAL(DP),
INTENT(INOUT) :: a3(1:n-1)
2683 INTEGER(INTG),
INTENT(IN) :: n
2684 REAL(DP),
INTENT(INOUT) :: b(n)
2685 REAL(DP),
INTENT(OUT) :: x(n)
2686 INTEGER(INTG),
INTENT(OUT) :: err
2693 enters(
"s3_fs",err,error,*999)
2698 localerror=
"Zero diagonal entry in tridiagonal linear system." 2699 CALL flagerror(localerror,err,error,*999)
2704 xmult = a1(i) / a2(i-1)
2705 a2(i) = a2(i) - xmult * a3(i-1)
2706 b(i) = b(i) - xmult * b(i-1)
2709 xmult = a1(n) / a2(n-1)
2710 a2(n) = a2(n) - xmult * a3(n-1)
2711 x(n) = ( b(n) - xmult * b(n-1) ) / a2(n)
2713 x(i) = ( b(i) - a3(i) * x(i+1) ) / a2(i)
2718 999 errorsexits(
"s3_fs",err,error)
2721 END SUBROUTINE s3_fs 2729 SUBROUTINE spline_cubic_val (n, t, y, ypp, tval, yval, ypval, yppval, err, error, *)
2732 INTEGER(INTG),
INTENT(IN) :: n
2733 REAL(DP),
INTENT(IN) :: t(n)
2734 REAL(DP),
INTENT(IN) :: y(n)
2735 REAL(DP),
INTENT(IN) :: ypp(n)
2736 REAL(DP),
INTENT(IN) :: tval
2737 REAL(DP),
INTENT(OUT) :: yval
2738 REAL(DP),
INTENT(OUT) :: ypval
2739 REAL(DP),
INTENT(OUT) :: yppval
2740 INTEGER(INTG),
INTENT(OUT) :: err
2746 INTEGER(INTG) :: left
2747 INTEGER(INTG) :: right
2748 LOGICAL :: foundInterval
2750 enters(
"spline_cubic_val",err,error,*999)
2754 foundinterval = .false.
2756 IF ( tval < t(i) )
THEN 2757 foundinterval=.true.
2763 IF (foundinterval .EQV. .false.)
THEN 2770 h = t(right) - t(left)
2773 & + dt * ( ( y(right) - y(left) ) / h &
2774 & - ( ypp(right) / 6.0e+00_dp + ypp(left) / 3.0e+00_dp ) * h &
2775 & + dt * ( 0.5e+00 * ypp(left) &
2776 & + dt * ( ( ypp(right) - ypp(left) ) / ( 6.0e+00_dp * h ) ) ) )
2778 ypval = ( y(right) - y(left) ) / h &
2779 & - ( ypp(right) / 6.0e+00_dp + ypp(left) / 3.0e+00_dp ) * h &
2780 & + dt * ( ypp(left) &
2781 & + dt * ( 0.5e+00_dp * ( ypp(right) - ypp(left) ) / h ) )
2783 yppval = ypp(left) + dt * ( ypp(right) - ypp(left) ) / h
2785 exits(
"spline_cubic_val")
2787 999 errorsexits(
"spline_cubic_val",err,error)
Calculates the modified Bessel function of the first kind of order 0 using the approximation of Abrom...
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
pure real(dp) function k1dp(x)
Calculates the modified Bessel function of the second kind of order 1 using the approximation of Abro...
Returns the inverse of a matrix.
pure real(sp) function i0sp(x)
Calculates the modified Bessel function of the first kind of order 0 using the approximation of Abrom...
Returns the transpose of a matrix A in A^T.
real(sp) function, dimension(size(a, 1)) normalisesp(a, err, error)
Normalises a real single precision vector a.
real(sp), parameter zero_tolerance_sp
The zero tolerance for single precision zero tests i.e., if(abs(x)>zero_tolerance) then...
Calculates the modified Bessel function of the second kind of order 0 using the approximation of Abro...
real(dp), parameter pi
The double precision value of pi.
subroutine normcrossproductsp(a, b, c, err, error,)
Calculates and returns the normalised vector cross-prouct of the single precision vectors a x b in c...
pure real(dp) function edpdp(x)
Calculates the elliptic integral of the second kind - E(m), for a double precision argument...
real(dp) function determinantfulldp(A, err, error)
Returns the determinant of a full double precision matrix A.
subroutine eigenvectorfulldp(A, eValue, eVector, err, error,)
Returns the normalised eigenvector of a full double precision symmetric matrix A that corresponds to ...
Solves a small linear system Ax=b.
real(dp) function cothdp(a)
Calculates double precision hyperbolic cotangent function.
This module contains all string manipulation and transformation routines.
Flags a warning to the user.
subroutine matrixvectorproductsp(A, b, c, err, error,)
Calculates and returns the matrix-vector product of the single precision vector A*b in c...
Calculates and returns the matrix-vector-product A*b in the vector c.
Solves a small linear system Ax=b.
Calculates the the vector cross product of a x b in c and the n derivatives, dc, of the vector cross ...
pure real(sp) function kdpsp(x)
Calculates the elliptic integral of the first kind - K(m), for a single precision argument...
subroutine, public spline_cubic_val(n, t, y, ypp, tval, yval, ypval, yppval, err, error,)
Evaluates a cubic spline at a specified point. First call spline_cubic_set to calculate derivatives a...
subroutine dcrossproductdp(n, a, b, c, da, db, dc, err, error,)
Calculates the the vector cross product of a x b in c and the n derivatives, dc, of the vector cross ...
pure real(dp) function i1dp(x)
Calculates the modified Bessel function of the first kind of order 1 using the approximation of Abrom...
subroutine, public spline_cubic_set(n, t, y, ibcbeg, ybcbeg, ibcend, ybcend, ypp, err, error,)
Calculates second derivatives of a cubic spline function for a tabulated function y(x)...
subroutine normcrossproductdp(a, b, c, err, error,)
Calculates and returns the normalised vector cross-prouct of the double precision vectors a x b in c...
This module contains all mathematics support routines.
pure real(sp) function l2normsp(a)
Returns the L2-norm of the single precision vector a.
Calculates the elliptic integral of the second kind - E(m).
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
pure real(sp) function i1sp(x)
Calculates the modified Bessel function of the first kind of order 1 using the approximation of Abrom...
Calculates the elliptic integral of the first kind - K(m).
This module contains all program wide constants.
Calculates the normalised vector cross product of two vectors.
Calculates the vector cross product of two vectors.
subroutine dcrossproductintg(n, a, b, c, da, db, dc, err, error,)
Calculates the the vector cross product of a x b in c and the n derivatives, dc, of the vector cross ...
subroutine crossproductintg(a, b, c, err, error,)
Calculates and returns the vector cross-product of the integer vectors a x b in c.
Calculates and returns the matrix-product-transpose A*B^T in the matrix C.
subroutine invertfullsp(A, B, det, err, error,)
Inverts a full single precision matrix A to give matrix B and returns the determinant of A in det...
Calculates the modified Bessel function of the first kind of order 1 using the approximation of Abrom...
subroutine crossproductsp(a, b, c, err, error,)
Calculates and returns the vector cross-product of the single precision vectors a x b in c...
Returns the eigenvectors of a matrix.
real(sp) function determinantfullsp(A, err, error)
Returns the determinant of a full single precision matrix A.
Calculates the normalised vector cross product of two vectors.
Calculates and returns the matrix-transpose vector-product A^T*b in the vector c. ...
subroutine, public exits(NAME)
Records the exit out of the named procedure.
real(dp), parameter zero_tolerance_dp
The zero tolerance for double precision zero tests i.e., if(abs(x)>zero_tolerance) then...
real(dp) function l2normdp(A)
Returns the L2-norm of the double precision vector a.
Calculates the modified Bessel function of the second kind of order 1 using the approximation of Abro...
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
subroutine matrixtransposeproductdp(A, B, C, err, error,)
Calculates and returns the matrix-transpose product of the double precision matrix A^T*B in C for dou...
pure real(sp) function edpsp(x)
Calculates the elliptic integral of the second kind - E(m), for a single precision argument...
subroutine solvesmalllinearsystemdp(A, x, b, err, error,)
Finds the solution to a small double precision linear system Ax=b.
subroutine eigenvaluefullsp(A, eValues, err, error,)
Returns the eigenvalues of a full single precision matrix A.
Returns hyperbolic cotangent of argument.
subroutine matrixproducttransposedp(A, B, C, err, error,)
Calculates and returns the matrix-product-transpose of the double precision matrix A*B^T in C...
subroutine matrixtransposedp(A, AT, err, error,)
Returns the transpose of a double precision matrix A in AT.
Returns the transpose of a matrix A in A^T.
subroutine eigenvectorfullsp(A, eValue, eVector, err, error,)
Returns the normalised eigenvector of a full single precision symmetric matrix A that corresponds to ...
integer, parameter sp
Single precision real kind.
Calculates and returns the matrix-transpose product A^T*B in the matrix C.
subroutine matrixvectorproductdp(A, b, c, err, error,)
Calculates and returns the matrix-vector product of the double precision vectir A*b in c...
subroutine, public s3_fs(a1, a2, a3, n, b, x, err, error,)
S3_FS factors and solves a tridiagonal linear system. algorithm adapted from John Burkhardt's s3_fs r...
pure real(dp) function i0dp(x)
Calculates the modified Bessel function of the first kind of order 0 using the approximation of Abrom...
Calculates and returns the matrix-vector-product A*b in the vector c.
pure real(sp) function k0sp(x)
Calculates the modified Bessel function of the second kind of order 0 using the approximation of Abro...
subroutine matrixtransposesp(A, AT, err, error,)
Returns the transpose of a single precision matrix A in AT.
subroutine identitymatrixsp(A, err, error,)
Returns an identity matrix.
integer(intg) function determinantfullintg(A, err, error)
Returns the determinant of a full integer matrix A.
Returns the determinant of a matrix.
subroutine invertfulldp(A, B, det, err, error,)
Inverts a full double precision matrix A to give matrix B and returns the determinant of A in det...
subroutine matrixproductsp(A, B, C, err, error,)
Calculates and returns the matrix-product of the single precision matrix A*B in C for single precisio...
real(dp) function, dimension(size(a, 1)) normalisedp(a, err, error)
Normalises a real double precision vector a.
pure real(sp) function k1sp(x)
Calculates the modified Bessel function of the second kind of order 1 using the approximation of Abro...
subroutine matrixtransposevectorproductdp(A, b, c, err, error,)
Calculates and returns the matrix-transpose vector product of the double precision vector A^T*b in c...
Calculates the vector cross product of two vectors.
subroutine eigenvaluefulldp(A, eValues, err, error,)
Returns the eigenvalues of a full double precision matrix A.
subroutine dcrossproductsp(n, a, b, c, da, db, dc, err, error,)
Calculates the the vector cross product of a x b in c and the n derivatives, dc, of the vector cross ...
subroutine crossproductdp(a, b, c, err, error,)
Calculates and returns the vector cross-product of the double precision vectors a x b in c...
Returns the identity matrix.
pure real(dp) function kdpdp(x)
Calculates the elliptic integral of the first kind - K(m), for a double precision argument...
subroutine matrixproducttransposesp(A, B, C, err, error,)
Calculates and returns the matrix-product-transpose of the single precision matrix A*B^T in C for sin...
subroutine identitymatrixdp(A, err, error,)
Returns an identity matrix.
pure real(dp) function k0dp(x)
Calculates the modified Bessel function of the second kind of order 1 using the approximation of Abro...
Calculates and returns the matrix-product A*B in the matrix C.
real(sp) function cothsp(a)
Calculates single precision hyperbolic cotangent function.
Returns the L2 norm of a vector.
Returns the eigenvalues of a matrix.
Flags an error condition.
subroutine matrixtransposeproductsp(A, B, C, err, error,)
Calculates and returns the matrix-transpose product of the single precision matrix A^T*B in C for sin...
subroutine matrixproductdp(A, B, C, err, error,)
Calculates and returns the matrix-product of the double precision matrix A*B in C.
Calculates and returns the matrix-product A*B in the matrix C.
real(dp), parameter zero_tolerance
This module contains all kind definitions.
Calculates the the vector cross product of A*B in C and the N derivatives, D_C, of the vector cross p...
subroutine solvesmalllinearsystemsp(A, x, b, err, error,)
Finds the solution to a small single precision linear system Ax=b.
subroutine matrixtransposevectorproductsp(A, b, c, err, error,)
Calculates and returns the matrix-transpose vector product of the single precision vector A^T*b in c...