Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python NumPy asfortranarray Function Example array to fortanarray

# welcome to softhunt.net
# Python program explaining
# numpy.asfortranarray() function

import numpy as np

in_arr = np.arange(16).reshape(4, 4)

print ("Input array : 
", in_arr)

# checking if it is fortanarray
print(in_arr.flags['F_CONTIGUOUS'])

out_arr = np.asfortranarray(in_arr, dtype ='float')
print ("output array from input array : 
", out_arr)

# checking if it has become fortanarray
print(out_arr.flags['F_CONTIGUOUS'])
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Python #NumPy #asfortranarray #Function #Example #array #fortanarray
ADD COMMENT
Topic
Name
9+5 =