RowConcat
This function concates the rows of array (of rank 1 or 2).
Calling example:
c(:,:) = a(:) .RowConcat. b(:)
c(:,:) = a(:,:) .RowConcat. b(:)
c(:,:) = a(:) .RowConcat. b(:,:)
c(:,:) = a(:,:) .RowConcat. b(:,:)
Interface 1
- ܀ Interface
- ️܀ See example
- ↢
MODULE PURE FUNCTION rowConcat(a, b) RESULT(ans)
REAL(REAL32), INTENT(IN) :: a(:)
REAL(REAL32), INTENT(IN) :: b(:)
REAL(REAL32), ALLOCATABLE :: ans(:, :)
END FUNCTION rowConcat
PROGRAM main
USE easifemBase
IMPLICIT NONE
Concat two integer vectors
call display( RowConcat(a=[1,2], b=[3,4]), "RowConcat=" )
call ok( all( RowConcat(a=[1,2], b=[3,4]) &
& .eq. reshape([1,3,2,4], [2,2])), "RowConcat" )
See results
results
RowConcat=
----------
1 2
3 4
Concat two integer vectors of different length
call display( RowConcat(a=[1,2], b=[3,4,5]), "RowConcat=" )
call ok( all( RowConcat(a=[1,2], b=[3,4,5]) &
& .eq. reshape([1,3,2,4,0,5], [2,3])), "RowConcat" )
See results
results
RowConcat=
----------
1 2 0
3 4 5
END PROGRAM main
Interface 2
- ܀ Interface
- ️܀ See example
- ↢
MODULE PURE FUNCTION rowConcat(a, b) RESULT(ans)
REAL(REAL32), INTENT(IN) :: a(:, :)
REAL(REAL32), INTENT(IN) :: b(:)
REAL(REAL32), ALLOCATABLE :: ans(:, :)
END FUNCTION rowConcat
PROGRAM main
USE easifemBase
IMPLICIT NONE
Concat columns of a rank2 array and rank 1 array.
call display( RowConcat(a=reshape([1,2,4,5], [2,2]), &
& b=[3,6]), "RowConcat=" )
See results
results
RowConcat=
----------
1 4
2 5
3 6
RowConcat works fine even when number of columns in rank-2 array is not the same as the size of rank-1 array.
call display( RowConcat(a=reshape([1,2,4,5], [2,2]), &
& b=[3,6, 7]), "RowConcat=" )
See results
results
RowConcat=
----------
1 4 0
2 5 0
3 6 7
We can also concat the columns of a vector and a matrix.
call display( RowConcat(b=reshape([1,2,4,5], [2,2]), &
& a=[3,6]), "RowConcat=" )
call display( RowConcat(b=reshape([1,2,4,5], [2,2]), &
& a=[3,6,7]), "RowConcat=" )
See results
results
RowConcat=
----------
3 6
1 4
2 5
RowConcat=
----------
3 6 7
1 4 0
2 5 0
END PROGRAM main
Interface 3
- ܀ Interface
- ️܀ See example
- ↢
MODULE PURE FUNCTION rowConcat(a, b) RESULT(ans)
REAL(REAL32), INTENT(IN) :: a(:)
REAL(REAL32), INTENT(IN) :: b(:, :)
REAL(REAL32), ALLOCATABLE :: ans(:, :)
END FUNCTION rowConcat
PROGRAM main
USE easifemBase
IMPLICIT NONE
Concat columns of a rank2 array and rank 1 array.
call display( RowConcat(a=reshape([1,2,4,5], [2,2]), &
& b=[3,6]), "RowConcat=" )
See results
results
RowConcat=
----------
1 4
2 5
3 6
RowConcat works fine even when number of columns in rank-2 array is not the same as the size of rank-1 array.
call display( RowConcat(a=reshape([1,2,4,5], [2,2]), &
& b=[3,6, 7]), "RowConcat=" )
See results
results
RowConcat=
----------
1 4 0
2 5 0
3 6 7
We can also concat the columns of a vector and a matrix.
call display( RowConcat(b=reshape([1,2,4,5], [2,2]), &
& a=[3,6]), "RowConcat=" )
call display( RowConcat(b=reshape([1,2,4,5], [2,2]), &
& a=[3,6,7]), "RowConcat=" )
See results
results
RowConcat=
----------
3 6
1 4
2 5
RowConcat=
----------
3 6 7
1 4 0
2 5 0
END PROGRAM main
Interface 4
- ܀ Interface
- ️܀ See example
- ↢
MODULE PURE FUNCTION rowConcat(a, b) RESULT(ans)
REAL(REAL32), INTENT(IN) :: a(:, :)
REAL(REAL32), INTENT(IN) :: b(:, :)
REAL(REAL32), ALLOCATABLE :: ans(:, :)
END FUNCTION rowConcat
PROGRAM main
USE easifemBase
IMPLICIT NONE
We can also concat the columns of two matrices.
call display( RowConcat(a=reshape([1,2,3,4], [2,2]), &
& b=reshape([5,6,7,8], [2,2]) ), "RowConcat=" )
See results
results
RowConcat=
----------
1 3
2 4
5 7
6 8
call display( RowConcat(a=reshape(arange(1,9), [3,3]), &
& b=reshape(arange(10,13), [2,2]) ), "RowConcat=" )
See results
results
RowConcat=
----------
1 4 7
2 5 8
3 6 9
10 12 0
11 13 0
call display( RowConcat(a=reshape(arange(1,4), [2,2]), &
& b=reshape(arange(5,13), [3,3]) ), "RowConcat=" )
See results
results
RowConcat=
----------
1 3 0
2 4 0
5 8 11
6 9 12
7 10 13
END PROGRAM main