The parent()
is an inbuilt function in julia which is used to return the parent array of a specified array view type (i.e, SubArray) or the array itself if it is not a view.
Syntax: parent(A)
Parameters:
- A: Specified array or an array view type.
Returns: It returns the parent array of a specified array view type (i.e, SubArray) or the array itself if it is not a view.
Example 1:
A = [ 1 , 2 , 3 , 4 ];
B = view(A, 2 )
println(parent(B))
C = [ 1 2 ; 3 4 ];
D = view(C, 1 : 2 ,: )
println(parent(D))
|
Output:

Example 2:
A = [ 1 , 2 , 3 , 4 ];
println(parent(A))
B = [ 1 2 ; 3 4 ];
println(parent(B))
C = cat([ 1 2 ; 3 4 ], [ 5 6 ; 7 8 ], [ 2 2 ; 3 4 ], dims = 3 );
println(parent(C))
|
Output:

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
26 Mar, 2020
Like Article
Save Article