jason-neal / companion_simulations

Simulating combined host+companion spectra, and fitting to observed crires spectra.
MIT License
2 stars 0 forks source link

Broadcast inner loops #8

Closed jason-neal closed 7 years ago

jason-neal commented 7 years ago

broadcast the alpha parameter for the combined modeling.

something like xy = x + y[:, np.newaxis] * alpha

will result in shape(len(x), len(alpha))

jason-neal commented 7 years ago

If the vectors are atleast 2d with shapes like A.shape = (2,3,1) and B.shape= (7,1) can transpose them to broad cast out the one (numpy does this when they are on the right) (A.T * B.T).T).shape = (2,3,7) which would be the same as A * B[:,:, np.newaxis]