Vectorization of matrix

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Vectorization of matrix

mayank9889
X_norm = (X - (t * mu)) ./ (t * sigma);  %vectorized

In above Octave code, if X is 97 x 3 matrix then will it implicitly get
converted to column vector?



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Vectorization of matrix

Juan Pablo Carbajal-2
> X_norm = (X - (t * mu)) ./ (t * sigma);  %vectorized
>
> In above Octave code, if X is 97 x 3 matrix then will it implicitly get
> converted to column vector?
I do not see any operation there that would reduce the size of the X
matrix. so i dare say no, that wont happen.
If this is a norm, you probably need some matrix product against a
transpose of X or something on that line.


Reply | Threaded
Open this post in threaded view
|

Re: Vectorization of matrix

nrjank
In reply to this post by mayank9889


On Mon, Jun 17, 2019, 8:50 AM mayank9889 <[hidden email]> wrote:
X_norm = (X - (t * mu)) ./ (t * sigma);  %vectorized

In above Octave code, if X is 97 x 3 matrix then will it implicitly get
converted to column vector?


What are the shapes of t mu and sigma


Reply | Threaded
Open this post in threaded view
|

Re: Vectorization of matrix

mayank9889
%X is 97 x 3 matrix
X_norm = X;
mu = zeros(1, size(X, 2));
sigma = zeros(1, size(X, 2));
mu = mean(X);
sigma = std(X);

t = ones(length(X), 1);
X_norm = (X - (t * mu)) ./ (t * sigma); % Vectorized
   





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Vectorization of matrix

mayank9889
In reply to this post by Juan Pablo Carbajal-2
This is the complete code



%X is 97 x 3 matrix
X_norm = X;
mu = zeros(1, size(X, 2));
sigma = zeros(1, size(X, 2));
mu = mean(X);
sigma = std(X);

t = ones(length(X), 1);
X_norm = (X - (t * mu)) ./ (t * sigma); % Vectorized
   




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Vectorization of matrix

nrjank
In reply to this post by mayank9889
On Mon, Jun 17, 2019 at 10:00 AM mayank9889 <[hidden email]> wrote:
%X is 97 x 3 matrix
X_norm = X;
mu = zeros(1, size(X, 2));
sigma = zeros(1, size(X, 2));
mu = mean(X);
sigma = std(X);

t = ones(length(X), 1);
X_norm = (X - (t * mu)) ./ (t * sigma); % Vectorized





I get a 97x3 output from that code. 


Reply | Threaded
Open this post in threaded view
|

Re: Vectorization of matrix

mayank9889
I'm sorry, i actually miscalculated the order of t*mu matrix. I am grateful
to you for your early response.



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html