Getting parent array of a specified array in Julia - parent() Method Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report 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: Python # Julia program to illustrate # the use of Array parent() method # Getting the parent array of the # specified 1D array view type (i.e, SubArray) # or the array itself if it is not a view. A = [1, 2, 3, 4]; B = view(A, 2) println(parent(B)) # Getting the parent array of the # specified 2D array view type (i.e, SubArray) # or the array itself if it is not a view. C = [1 2; 3 4]; D = view(C, 1:2,: ) println(parent(D)) Output: Example 2: Python # Julia program to illustrate # the use of Array parent() method # Getting the parent array of the # specified 1D array view type (i.e, SubArray) # or the array itself if it is not a view. A = [1, 2, 3, 4]; println(parent(A)) # Getting the parent array of the # specified 2D array view type (i.e, SubArray) # or the array itself if it is not a view. B = [1 2; 3 4]; println(parent(B)) # Getting the parent array of the # specified 3D array view type (i.e, SubArray) # or the array itself if it is not a view. C = cat([1 2; 3 4], [5 6; 7 8], [2 2; 3 4], dims = 3); println(parent(C)) Output: Create Quiz Comment K Kanchan_Ray Follow 0 Improve K Kanchan_Ray Follow 0 Improve Article Tags : Julia Explore DSA Tutorial - Learn Data Structures and Algorithms 6 min read System Design Tutorial 3 min read Aptitude Questions and Answers 3 min read Web Development Technologies 6 min read AI, ML and Data Science Tutorial 3 min read DevOps Tutorial 5 min read Like