[Numpy-discussion] Numpy newbie question: matrix creation

Alan G Isaac alan.isaac at gmail.com
Wed Sep 25 09:00:36 EDT 2013


On 9/25/2013 3:06 AM, Edmondo Porcu wrote:
> advice on how to create a matrix with certain characteristics :
>   - Every entry should be minimum 0 maximum 1 with a step of 0.1 (legal values are 0,0.1,0.2,0.3 etc)
> - The number of columns of the matrix is a parameter of this matrix creation algorithm
> - Only the rows where the sum is 1 must be kept


This is not nearly enough information.
But since it is all you offer, here is an answer
for a square matrix with parameter n:
np.identity(n)

Alan Isaac



More information about the NumPy-Discussion mailing list