Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Help with array multiplication

$
0
0

@hasanOryx wrote:

I aware that to multiple arrays, dimensions should match as:
A: array of (x,y) , B: array of (y,z)

In Python below is working fine:

X = np.array([  
        [0,0,1],
        [0,1,1],
        [1,0,1],
        [1,1,1] 
    ])

syn0 = 2*np.random.random((3,1)) - 1

z = np.dot(X,syn0)

I tried to replicate it in Julia as:

# input dataset
X = [ [0,0,1],
      [0,1,1],
      [1,0,1],
      [1,1,1] 
    ]

syn0 = 2 * rand(3,1)

z = X * syn0

But I got the below error:

DimensionMismatch("matrix A has dimensions (4,1), matrix B has dimensions (3,1)")

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 2795

Latest Images

Trending Articles



Latest Images