File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,28 +75,22 @@ contains
7575
7676 size_prepend = 0
7777 size_append = 0
78+
79+ dim_ = 1
7880 if (present(dim)) then
79- if (dim == 1 .or. dim == 2) then
80- dim_ = dim
81- else
82- dim_ = 1
83- end if
84- else
85- dim_ = 1
81+ if (dim == 1 .or. dim == 2) dim_ = dim
8682 end if
87-
83+
8884 if (present(prepend)) then
8985 if (size(prepend, 3 - dim_) /= size(x, 3 - dim_)) then
90- allocate(y(0, 0))
91- return
86+ error stop "stdlib_math_diff: non-differencing dimension of 'prepend' must match 'x'"
9287 end if
9388 size_prepend = size(prepend, dim_)
9489 end if
9590
9691 if (present(append)) then
9792 if (size(append, 3 - dim_) /= size(x, 3 - dim_)) then
98- allocate(y(0, 0))
99- return
93+ error stop "stdlib_math_diff: non-differencing dimension of 'append' must match 'x'"
10094 end if
10195 size_append = size(append, dim_)
10296 end if
@@ -110,8 +104,6 @@ contains
110104 allocate(y(0, size(x, 2)))
111105 case (2)
112106 allocate(y(size(x, 1), 0))
113- case default
114- error stop "diff_2: internal error: invalid dimension (dim_ must be 1 or 2)"
115107 end select
116108 return
117109 end if
You can’t perform that action at this time.
0 commit comments