Re: suggestion for new intrinsic function: CONFORM



On Feb 27, 4:33 pm, "Beliavsky" <beliav...@xxxxxxx> wrote:
When passing assumed shape arrays to procedures, typically the first
thing I do is check that the dimension are what I expect, in
particular that certain pairs of arguments conform, for example

subroutine foo(imat,y,z)
integer, intent(in) :: imat(:,:) ! (n1,n2)
real, intent(in) :: x(:,:) ! (n1,n2)
real, intent(out) :: z(:,:) ! (n1,n2)
if (size(imat,1) /= size(x,1) .or. size(imat,2) /= size(x,2) .or.
size(x,1) /= size(z,1) .or. size(x,2) /= size(z,2)) then

It occurs to me using the SHAPE function to check that arrays conform
is shorter, especially for high-rank arrays. So the question is
whether providing

conform(x,y)

as a shorter alternative to

all(shape(x) == shape(y))

is woth providing.

.