You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a string representation of a matrix, with the following code in
mpIValue.cpp
string_type IValue::ToString() const
{
stringstream_type ss;
switch (GetType())
{
case 'm':
{
const matrix_type &arr(GetArray());
// if (arr.GetRows()>1)
ss << _T("{");
for (int i=0; i<arr.GetRows(); ++i)
{
if (arr.GetCols()>1)
ss << _T("{");
for (int j=0; j<arr.GetCols();++j)
{
ss << arr.At(i, j).ToString();
if (j!=arr.GetCols()-1)
ss << _T(", ");
}
if (arr.GetCols()>1)
ss << _T("}");
if (i!=arr.GetRows()-1)
ss << _T("; ");
}
// if (arr.GetRows()>1)
ss << _T("} ");
}
break;
I wonder if it would be better to not test for
"if (arr.GetRows()>1)" at the start and end of the string build (I have
commented the two lines above).
Right now the output for a matrix of 1 value is just
value
however I think it should be
{value}
even if the matrix has only one value, in order to make a difference with the
non-matrix
value
Original issue reported on code.google.com by ssecm...@gmail.com on 13 Feb 2012 at 11:10
The text was updated successfully, but these errors were encountered:
This was done deliberately because the engine should automatically unbox a
matrix if it contains only a single element. Internally plain nonmatrix values
should be treated like a 1x1 matrix. From the outside you shoudnt see a
difference between a 1x1 matrix and a plain value.
Original comment by ib...@gmx.info on 16 Feb 2012 at 9:18
Original issue reported on code.google.com by
ssecm...@gmail.com
on 13 Feb 2012 at 11:10The text was updated successfully, but these errors were encountered: