Rashid Umarov #: You need to rest and re-read all your questions in this discussion tomorrow.
Your advice helped, thank you.
But, now I'm still struggling with questions:
1. I need to divide a matrix by a vector - this is a typical task for calculating percentages, when there is a total of each row/column and I need to know the percentage of each cell - very demanded.
matrixf Test;
Test.Init(3,2);
Test.Fill(1);//Fill the matrix with zeros
vectorf Zero;
Zero.Init(3);
Zero.Fill(0);//Fill the matrix with zeros
Zero=Test/Zero;
I get an error
cannot convert type 'vectorf' to type 'matrixf' Primer_02.mq5 325 11
cannot convert type 'matrixf' to type 'vectorf' Primer_02.mq5 325 10
If you make a matrix from a vector, essentially duplicating columns to restore the size of the matrix over which the calculation is performed, this approach consumes a lot of memory unnecessarily. Pulling vectors out of a matrix in cycles is resource-consuming and seems not rational.
2. Sometimes the divisor is zero, and then we get "-nan(ind)". - but this is not very convenient for further work, maybe there is a possibility to get zero or other forced value in this case, or not to carry out calculation in this cell - by choice?
matrixf Test;
Test.Init(3,2);
Test.Fill(0);//Fill the matrix with zerosfloat z=0;
Test=Test/z;
Print(Test);
1. I need to divide a matrix by a vector - this is a typical task for calculating percentages, when there is a total sum of each row/column and I need to know the percentage of each cell - very demanded.
I get an error
You have a desire to break everything. Go further yourself, I won't help you any more - it hurts to look at the examples
//+------------------------------------------------------------------+//| Script programme start function|//+------------------------------------------------------------------+voidOnStart()
{
//---
matrixf m;
m.Init(3,2);
m.Fill(7);//Fill the matrix with NON-ZEROs
vectorf divider;
divider.Init(2);
divider.Fill(3);//Fill the vector with NONE zerosfor(ulong i=0;i<m.Rows();i++)
{
m.Row(m.Row(i)/divider,i);
}
Print(m);
}
You have a desire to break everything. You can take it from here, I won't help you any further, it hurts to see examples of this.
So do it more reliably :)))))))
The example is wrong, I need to divide each column of the matrix by the corresponding value in the row of the vector. That is, the vector should represent a column, not a row. I understand that then I need to transpose the matrix..... I thought it was possible without a loop.
And, I am of course very interested in the answer to the second question. Not even an answer, but rather adding a possibility to put a zero in the final matrix when dividing by zero.
Maxim Dmitrievsky #: The man has already broken the catbuster, soon there will be nothing left of the matrices )
By throwing in false information, you strengthen the statement of a respected person on this resource, apparently trying to attach to his authority and make me in a bad light,
By throwing in false information, you amplify the statement of a respected person on this resource, apparently trying to attach yourself to his authority and make me look bad,
It's probably funny. I can even surmise the real premise of the statement. However, few people will understand what we are talking about, if they are not regulars of the MoD thread.
Do you understand the new syntax of matrices, and am I the only one who is so bad at thinking?
Maybe it's funny. I can even surmise the real premise of the statement. However, few people will understand what it is about unless they are regulars in the MoD thread.
Do you understand the new syntax of matrices, and am I the only one who is so bad at thinking?
I haven't read it, it's implemented differently everywhere, you just have to look at the peculiarities.
I think everything is clear, I use dataframes in python myself, it has its own specifics.
Please clarify how to copy a column from one matrix to another!
I don't understand the example through copy to vector.
vectormatrix::Col(
constulong ncol // column number
);
voidmatrix::Col(
constvector v, // column vectorconstulong ncol // column number
);
Here is a piece of my code
for(P=0; P<Type_Q_Perebor; P++)
{
matrixf m_Data_calc;//Matrix with table for calculationsvectorf V_Data_calc;//Vector for array to matrix transferswitch(P)
{
case0:
m_Data_calc.Init(Strok_Total_Data*N_1, 1);//Initialise the matrix
m_Data.Reshape(Strok_Total_Data, Stolb_Total_Data);//Improve the matrix size with the databreak;
case1:
m_Data_calc.Init(Strok_Total_Data*N_0, 1);//Initialise the matrix
m_Data.Reshape(Strok_Total_Data, Stolb_Total_Data);//Improve the matrix size with the databreak;
}
V_Data_calc.Cov(m_Data_calc,0);//Copy the column vector from the matrix
m_Data_calc.Col(V_Data_calc,0);//Copy the column vector into the matrix
}
You need to rest and re-read all your questions in this discussion tomorrow.
Your advice helped, thank you.
But, now I'm still struggling with questions:
1. I need to divide a matrix by a vector - this is a typical task for calculating percentages, when there is a total of each row/column and I need to know the percentage of each cell - very demanded.
I get an error
If you make a matrix from a vector, essentially duplicating columns to restore the size of the matrix over which the calculation is performed, this approach consumes a lot of memory unnecessarily. Pulling vectors out of a matrix in cycles is resource-consuming and seems not rational.
2. Sometimes the divisor is zero, and then we get "-nan(ind)". - but this is not very convenient for further work, maybe there is a possibility to get zero or other forced value in this case, or not to carry out calculation in this cell - by choice?
Your advice helped, thank you.
But now I'm still wondering:
1. I need to divide a matrix by a vector - this is a typical task for calculating percentages, when there is a total sum of each row/column and I need to know the percentage of each cell - very demanded.
I get an error
You have a desire to break everything. Go further yourself, I won't help you any more - it hurts to look at the examples
You have a desire to break everything. You can take it from here, I won't help you any further, it hurts to see examples of this.
I guess the syntax doesn't go)))))
You have a desire to break everything. You can take it from here, I won't help you any further, it hurts to see examples of this.
So do it more reliably :)))))))
The example is wrong, I need to divide each column of the matrix by the corresponding value in the row of the vector. That is, the vector should represent a column, not a row. I understand that then I need to transpose the matrix..... I thought it was possible without a loop.
And, I am of course very interested in the answer to the second question. Not even an answer, but rather adding a possibility to put a zero in the final matrix when dividing by zero.
The man has already broken the catbuster, soon there will be nothing left of the matrices )
By throwing in false information, you strengthen the statement of a respected person on this resource, apparently trying to attach to his authority and make me in a bad light,
Do you have a personal grudge?
By throwing in false information, you amplify the statement of a respected person on this resource, apparently trying to attach yourself to his authority and make me look bad,
Do you have a personal grudge?
I don't think humour has been banned yet.
I don't think they've banned humour yet.
It's probably funny. I can even surmise the real premise of the statement. However, few people will understand what we are talking about, if they are not regulars of the MoD thread.
Do you understand the new syntax of matrices, and am I the only one who is so bad at thinking?
Maybe it's funny. I can even surmise the real premise of the statement. However, few people will understand what it is about unless they are regulars in the MoD thread.
Do you understand the new syntax of matrices, and am I the only one who is so bad at thinking?
I haven't read it, it's implemented differently everywhere, you just have to look at the peculiarities.
I think everything is clear, I use dataframes in python myself, it has its own specifics.
Please clarify how to copy a column from one matrix to another!
I don't understand the example through copy to vector.
Here is a piece of my code
I get an error