From 1208ddd73b4ace2e4e724e431937d2688124546c Mon Sep 17 00:00:00 2001 From: vijay gopal chilkuri Date: Wed, 26 May 2021 14:08:09 +0530 Subject: [PATCH] Added checks for LDB and LDC in qmckl_distance. #15 --- org/qmckl_distance.org | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/org/qmckl_distance.org b/org/qmckl_distance.org index 1c9ed06..77b63f3 100644 --- a/org/qmckl_distance.org +++ b/org/qmckl_distance.org @@ -520,6 +520,7 @@ integer function qmckl_distance_f(context, transa, transb, m, n, & return endif + ! check for LDA if (iand(transab,1) == 0 .and. LDA < 3) then info = QMCKL_INVALID_ARG_7 return @@ -540,6 +541,33 @@ integer function qmckl_distance_f(context, transa, transb, m, n, & return endif + ! check for LDB + if (iand(transab,1) == 0 .and. LDB < 3) then + info = QMCKL_INVALID_ARG_9 + return + endif + + if (iand(transab,1) == 1 .and. LDB < n) then + info = QMCKL_INVALID_ARG_9 + return + endif + + if (iand(transab,2) == 0 .and. LDB < 3) then + info = QMCKL_INVALID_ARG_9 + return + endif + + if (iand(transab,2) == 2 .and. LDB < n) then + info = QMCKL_INVALID_ARG_9 + return + endif + + ! check for LDC + if (LDC < m) then + info = QMCKL_INVALID_ARG_11 + return + endif + select case (transab) @@ -901,6 +929,7 @@ integer function qmckl_distance_rescaled_f(context, transa, transb, m, n, & transab = -100 endif + ! check for LDA if (transab < 0) then info = QMCKL_INVALID_ARG_1 return @@ -926,6 +955,33 @@ integer function qmckl_distance_rescaled_f(context, transa, transb, m, n, & return endif + ! check for LDB + if (iand(transab,1) == 0 .and. LDB < 3) then + info = QMCKL_INVALID_ARG_9 + return + endif + + if (iand(transab,1) == 1 .and. LDB < n) then + info = QMCKL_INVALID_ARG_9 + return + endif + + if (iand(transab,2) == 0 .and. LDB < 3) then + info = QMCKL_INVALID_ARG_9 + return + endif + + if (iand(transab,2) == 2 .and. LDB < n) then + info = QMCKL_INVALID_ARG_9 + return + endif + + ! check for LDC + if (LDC < m) then + info = QMCKL_INVALID_ARG_11 + return + endif + select case (transab)