[amibroker] Matrix Operations [1 Attachment]

 
[Attachment(s) from Aron Pipa included below]

I have noticed that,

for :
x = Matrix( 1, 10 , 1 );


// returns matrix:
z  = 10 ^ x;  

// returns array:
z = log( x );

//  error:
x = Matrix( 10, 10 , 1 ); 
z = log( x );



Just in case someone would need to calculate the log() of all the elements in a matrix, the following function will do that.

function  mxlog( mx )
{
    m = MxGetSize( mx, 0 );
    n = MxGetSize( mx, 1 );

    for( j = 0 ; j < n ; j ++ )
    {
        block = MxGetBlock( mx, 0, m - 1, j, j , True );
        mx = MxSetBlock( mx, 0, m - 1, j, j ,
log( block ) );
    }

    return mx ;
}

__._,_.___

Attachment(s) from Aron Pipa | View attachments on the web

1 of 1 Photo(s)


Posted by: Aron Pipa <aron@myafl.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (17)

Check out the automatic photo album with 2 photo(s) from this topic.
DJIA ADAPTIVE EQUITY.png ebigfggc.png

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/


.

__,_._,___


EmoticonEmoticon