* [#15577](http://bugzilla.scilab.org/show_bug.cgi?id=15577): `edit` did not accept a line number as text, as with `edit linspace 21`.
* [#15668](http://bugzilla.scilab.org/show_bug.cgi?id=15668): `save(filename)` saved all predefined Scilab constants %e %pi etc.. (regression)
* [#15715](http://bugzilla.scilab.org/show_bug.cgi?id=15715): `%nan` indices crashed Scilab.
+* [#15581](http://bugzilla.scilab.org/show_bug.cgi?id=15581): display of complex matrix was ugly.
* [#15812](http://bugzilla.scilab.org/show_bug.cgi?id=15812): On assigning variables the source variable may become become corrupted
* [#15840](http://bugzilla.scilab.org/show_bug.cgi?id=15840): `grand(1,"prm",m)` yielded an unsqueezed size([size(m) 1]) hypermatrix
* [#15964](http://bugzilla.scilab.org/show_bug.cgi?id=15954): A complex empty sparse matrix could be obtained after insertion.
#include "os_string.h"
#include "dynlib_ast.h"
+#define BLANK_SIZE 1
#define SIZE_BETWEEN_TWO_VALUES 1
#define SPACE_BETWEEN_TWO_VALUES L" "
#define SIZE_BOOL 1
#define MINUS_STRING L"-"
#define PLUS_STRING L"+"
#define SYMBOL_I L"i"
+#define SIZE_SYMBOL_I 1
#define MAX_LINES 100
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2008-2008 - DIGITEO - Antoine ELIAS
-*
+* Copyright (C) 2019 - Stéphane MOTTELET
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
ostr << std::endl;
}
}
- else if (getCols() == 1)
- {
- //column vector
- if (isComplex() == false)
- {
- for (int i = m_iRows1PrintState ; i < getRows() ; i++)
- {
- iCurrentLine++;
- if ((iMaxLines == 0 && iCurrentLine >= MAX_LINES) || (iMaxLines != 0 && iCurrentLine >= iMaxLines))
- {
- // Number of lines to print exceeds the max lines allowed
- // Record what line we were at
- m_iRows1PrintState = i;
- return false;
- }
-
- _piDims[1] = 0;
- _piDims[0] = i;
- int iPos = getIndex(_piDims);
-
- printDoubleValue(ostr, m_pRealData[iPos]);
- ostr << std::endl;
- }
- }
- else
- {
- for (int i = m_iRows1PrintState ; i < getRows() ; i++)
- {
- //complex value
- iCurrentLine++;
- if ((iMaxLines == 0 && iCurrentLine >= MAX_LINES) || (iMaxLines != 0 && iCurrentLine >= iMaxLines))
- {
- m_iRows1PrintState = i;
- return false;
- }
-
- _piDims[1] = 0;
- _piDims[0] = i;
- int iPos = getIndex(_piDims);
-
- printComplexValue(ostr, m_pRealData[iPos], m_pImgData[iPos]);
- ostr << std::endl;
- }
- }
- }
- else if (getRows() == 1)
- {
- //row vector
- std::wostringstream ostemp;
- int iLastVal = m_iCols1PrintState;
-
- if (isComplex() == false)
- {
- int iLen = 0;
- for (int i = m_iCols1PrintState ; i < getCols() ; i++)
- {
- _piDims[0] = 0;
- _piDims[1] = i;
- int iPos = getIndex(_piDims);
-
- DoubleFormat df;
- // Get the size of the column to print
- getDoubleFormat(ZeroIsZero(m_pRealData[iPos]), &df);
- iLen = static_cast<int>(ostemp.str().size()) + SIZE_BETWEEN_TWO_VALUES + df.iSignLen + df.iWidth;
- if (iLen >= iLineLen - 1 && iLastVal != i)
- {
- //Max length, new line
- iCurrentLine += 4; //"column x to Y" + empty line + value + empty line
- if ((iMaxLines == 0 && iCurrentLine >= MAX_LINES) || (iMaxLines != 0 && iCurrentLine >= iMaxLines))
- {
- // Number of lines to print exceeds the max lines allowed
- // Record what column we were at
- m_iCols1PrintState = iLastVal;
- return false;
- }
-
- addColumnString(ostr, iLastVal + 1, i);
- ostr << ostemp.str() << std::endl;
- ostemp.str(L"");
- iLastVal = i;
- }
-
- ostemp << SPACE_BETWEEN_TWO_VALUES;
- addDoubleValue(&ostemp, ZeroIsZero(m_pRealData[iPos]), &df);
- }
-
- if (iLastVal != 0)
- {
- addColumnString(ostr, iLastVal + 1, getCols());
- }
- ostemp << std::endl;
- ostr << ostemp.str();
- }
- else //complex case
- {
- int iTotalLen = 0;
- int iLen = 0;
-
- for (int i = m_iCols1PrintState ; i < getCols() ; i++)
- {
- _piDims[0] = 0;
- _piDims[1] = i;
- int iPos = getIndex(_piDims);
-
- DoubleFormat dfR, dfI;
- getComplexFormat(ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), &iTotalLen, &dfR, &dfI);
- iLen = static_cast<int>(ostemp.str().size()) + SIZE_BETWEEN_TWO_VALUES + iTotalLen;
- if (iLen >= iLineLen - 1 && iLastVal != i)
- {
- //Max length, new line
- iCurrentLine += 4; //"column x to Y" + empty line + value + empty line
- if ((iMaxLines == 0 && iCurrentLine >= MAX_LINES) || (iMaxLines != 0 && iCurrentLine >= iMaxLines))
- {
- // Number of lines to print exceeds the max lines allowed
- // Record what column we were at
- m_iCols1PrintState = iLastVal;
- return false;
- }
-
- addColumnString(ostr, iLastVal + 1, i);
- ostr << ostemp.str() << std::endl;
- ostemp.str(L"");
- iLastVal = i;
- }
-
- ostemp << SPACE_BETWEEN_TWO_VALUES;
- addDoubleComplexValue(&ostemp, ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), iTotalLen, &dfR, &dfI);
- }
-
- if (iLastVal != 0)
- {
- addColumnString(ostr, iLastVal + 1, getCols());
- }
- ostemp << std::endl;
- ostr << ostemp.str();
- }
- }
else // matrix
{
std::wostringstream ostemp;
- int iLen = 0;
+ int iLen = SIZE_BETWEEN_TWO_VALUES;
int iLastCol = m_iCols1PrintState;
+ // some unchanging field is to be retrieved for later used
+ DoubleFormat df;
+ int iBlankSize = df.bPrintBlank ? BLANK_SIZE : 0;
//Array with the max printed size of each col
int *piSize = new int[getCols()];
+ int *piRSize = new int[getCols()];
+ int *piISize = new int[getCols()];
memset(piSize, 0x00, getCols() * sizeof(int));
+ memset(piRSize, 0x00, getCols() * sizeof(int));
+ memset(piISize, 0x00, getCols() * sizeof(int));
if (isComplex() == false)
{
ostemp << std::endl;
}
- iLen = 0;
+ iLen = SIZE_BETWEEN_TWO_VALUES;
iCurrentLine++;
if (m_iRows2PrintState == 0)
m_iCols1PrintState = 0;
}
- iLen += piSize[iCols1] + SIGN_LENGTH + SIZE_BETWEEN_TWO_VALUES;
+ iLen += piSize[iCols1] + SIZE_BETWEEN_TWO_VALUES + iBlankSize;
}
for (int iRows2 = m_iRows2PrintState ; iRows2 < getRows() ; iRows2++)
DoubleFormat dfR, dfI;
getComplexFormat(ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), &iTotalWidth, &dfR, &dfI);
-
- iTotalWidth += (dfR.iWidth == 0 ? 0 : SIGN_LENGTH) + (dfI.iWidth == 0 ? 0 : SIGN_LENGTH + 1);
- if (iTotalWidth > piSize[iCols1])
- {
- piSize[iCols1] = iTotalWidth;
- }
-
+ // keep track of real and imaginary part width for further alignment
+ piISize[iCols1] = std::max(piISize[iCols1], dfI.iWidth);
+ piRSize[iCols1] = std::max(piRSize[iCols1], dfR.iWidth);
+ piSize[iCols1] = std::max(piSize[iCols1], iTotalWidth);
}
}
m_iRows2PrintState = iRows2;
m_iCols1PrintState = iLastCol;
delete[] piSize;
+ delete[] piRSize;
+ delete[] piISize;
return false;
}
DoubleFormat dfR, dfI;
getComplexFormat(ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), &iTotalWidth, &dfR, &dfI);
+ // override with precomputed real part width for alignment of imaginary part sign
+ dfR.iWidth = piRSize[iCols2];
+ dfI.iWidth = piISize[iCols2];
ostemp << SPACE_BETWEEN_TWO_VALUES;
- addDoubleComplexValue(&ostemp, ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), piSize[iCols2], &dfR, &dfI);
+ addDoubleComplexValue(&ostemp, ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), piSize[iCols2], &dfR, &dfI);
}
ostemp << std::endl;
}
- iLen = 0;
+ iLen = SIZE_BETWEEN_TWO_VALUES;
iCurrentLine++;
if (m_iRows2PrintState == 0)
m_iRows2PrintState = iRows2;
m_iCols1PrintState = iLastCol;
delete[] piSize;
+ delete[] piRSize;
return false;
}
DoubleFormat dfR, dfI;
getComplexFormat(ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), &iTotalWidth, &dfR, &dfI);
+ // override with precomputed real part width for aligment of imaginary part sign
+ dfR.iWidth = piRSize[iCols2];
+ dfI.iWidth = piISize[iCols2];
ostemp << SPACE_BETWEEN_TWO_VALUES;
- addDoubleComplexValue(&ostemp, ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), piSize[iCols2], &dfR, &dfI);
+ addDoubleComplexValue(&ostemp, ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), piSize[iCols2], &dfR, &dfI);
}
ostemp << std::endl;
}
}
delete[] piSize;
+ delete[] piRSize;
+ delete[] piISize;
}
return true;
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2009 - DIGITEO - Antoine ELIAS
-* Copyright (C) 2018 - Stéphane MOTTELET
+* Copyright (C) 2018 - 2019 - Stéphane MOTTELET
*
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
#include "os_string.h"
#include "dtoa.h"
#include "charEncoding.h"
-#include "sciprint.h"
}
-#define BLANK_SIZE 1
#define POINT_SIZE 1
#define EXPOSANT_SIZE 2 //exposant symbol + exposant sign
{
getDoubleFormat(_dblR, _pDFR);
getDoubleFormat(_dblI, _pDFI);
-
- *_piTotalWidth = 0;
- if (isRealZero(_dblI))
- {
- if (isRealZero(_dblR))
- {
- *_piTotalWidth += 1; //"0"
- _pDFI->iWidth = 0;
- _pDFI->iSignLen = 0;
- }
- else
- {
- *_piTotalWidth += _pDFR->iWidth;
- _pDFI->iWidth = 0;
- _pDFI->iSignLen = 0;
- }
- }
- else
- {
- if (isRealZero(_dblR))
- {
- *_piTotalWidth += _pDFI->iWidth;
- _pDFR->iWidth = 0;
- }
- else
- {
- *_piTotalWidth += _pDFR->iWidth + _pDFI->iWidth;
- }
-
- // i character
- *_piTotalWidth += 1;
- }
+
+ *_piTotalWidth = _pDFR->iWidth + _pDFI->iWidth + 2*(_pDFR->bPrintBlank ? BLANK_SIZE : 0) + BLANK_SIZE + SIZE_SYMBOL_I;
}
void addDoubleValue(std::wostringstream * _postr, double _dblVal, DoubleFormat * _pDF)
{
if (_pDF->bPrintPoint)
{
- /* str.append(std::max(0, (ConfigVariable::getFormatSize() - (int)str.length()))-1, '0'); */
+ /*str.append(std::max(0, (ConfigVariable::getFormatSize() - (int)str.length()))-1, '0');*/
}
else
{
- iWidth = 1+str.length();
+ iWidth = 1 + str.length();
}
}
wchar_t* pwstData = to_wide_string(str.data());
- os_swprintf(pwstOutput, 32, L"%ls%-*ls", pwstSign, iWidth-1, pwstData);
+ os_swprintf(pwstOutput, 32, L"%ls%-*ls", pwstSign, iWidth - 1, pwstData);
FREE(pwstData);
}
else if (wcslen(pwstSign) != 0)
*/
// *_postr << "|%" << _iTotalWitdh << "%|";
- if (_dblR == 0)
- {
- //no real part
- if (_dblI == 0)
- {
- //no imaginary part
- //0
- DoubleFormat df;
+ //R
+ DoubleFormat df;
- addDoubleValue(&ostemp, 0, &df);
- }
- else
- {
- //imaginary part
-
- //I
- DoubleFormat df;
-
- df.iWidth = 0;
- df.iPrec = _pDFI->iPrec;
- df.bExp = _pDFI->bExp;
- df.bPrintPlusSign = false;
- df.bPrintOne = false;
- addDoubleValue(&ostemp, _dblI, &df);
- ostemp << std::left << SYMBOL_I;
- if (_dblI == 1)
- {
- addSpaces(&ostemp, 1);
- }
+ df.iPrec = _pDFR->iPrec;
+ df.bExp = _pDFR->bExp;
- }
+ if (ISNAN(_dblR) || !finite(_dblR))
+ {
+ ostemp << std::left << std::setw(_pDFR->iWidth + 1);
+ addDoubleValue(&ostemp, _dblR, &df);
}
else
{
- //real part
- if (_dblI == 0)
- {
- //no imaginary part
-
- //R
- DoubleFormat df;
-
- df.iWidth = 0;
- df.iPrec = _pDFR->iPrec;
- df.bExp = _pDFR->bExp;
- addDoubleValue(&ostemp, _dblR, &df);
- }
- else
- {
- //imaginary part
-
- //R
- DoubleFormat df;
-
- df.iPrec = _pDFR->iPrec;
- df.bExp = _pDFR->bExp;
-
- addDoubleValue(&ostemp, _dblR, &df);
-
- //I
- df.iPrec = _pDFI->iPrec;
- df.bExp = _pDFI->bExp;
- df.bPrintPlusSign = true;
- df.bPrintComplexPlusSpace = true;
- df.bPrintOne = false;
-
- addDoubleValue(&ostemp, _dblI, &df);
- ostemp << std::left << SYMBOL_I;
- if (_dblI == 1)
- {
- addSpaces(&ostemp, 2);
- }
- }
+ // following line allows to align sign of imaginary part
+ addDoubleValue(&ostemp, _dblR, &df);
+ addSpaces(&ostemp, _pDFR->iWidth - ostemp.tellp() + 1);
+ }
+ //I
+ df.iPrec = _pDFI->iPrec;
+ df.bExp = _pDFI->bExp;
+ df.bPrintPlusSign = true;
+ df.bPrintComplexPlusSpace = true;
+ df.bPrintOne = false;
+
+ addDoubleValue(&ostemp, _dblI, &df);
+ ostemp << std::left << SYMBOL_I;
+ if (_dblI == 1 && _pDFI->bExp == false)
+ {
+ addSpaces(&ostemp, 2);
}
configureStream(_postr, _iTotalWidth, 0, ' ');
void printComplexValue(std::wostringstream& ostr, double val_r, double val_i)
{
DoubleFormat dfR, dfI;
- getDoubleFormat(ZeroIsZero(val_r), &dfR);
- getDoubleFormat(ZeroIsZero(val_i), &dfI);
+ int iTotalWidth;
+ getComplexFormat(ZeroIsZero(val_r), ZeroIsZero(val_i), &iTotalWidth, &dfR, &dfI);
ostr << SPACE_BETWEEN_TWO_VALUES;
- addDoubleComplexValue(&ostr, ZeroIsZero(val_r), ZeroIsZero(val_i), dfR.iWidth + dfI.iWidth, &dfR, &dfI);
+ addDoubleComplexValue(&ostr, ZeroIsZero(val_r), ZeroIsZero(val_i), iTotalWidth, &dfR, &dfI);
}
--- /dev/null
+// Copyright (C) 2019 - Stéphane MOTTELET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 15781 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/15781
+//
+// <-- Short Description -->
+// display of complex matrix is ugly.
+n=4
+ n =
+ 4.
+a=testmatrix("magic",4);
+for f = ["v","e"]
+ format(f)
+ x=complex(cos(a),sin(a));
+ x(3,3)=%nan;
+ x(4,4)=%inf;
+ x(2,1:2)=1+%i;
+ x(:,1)=0;
+ disp(x)
+ for i=1:n
+ disp(x(i,:))
+ disp(" ")
+ end
+ for i=1:n
+ disp(x(:,i))
+ disp(" ")
+ end
+ x=x-x;
+ disp(x)
+ disp(" ")
+ acoth(-2:0.5:2).'
+end
+ column 1 to 3
+ 0. + 0.i -0.4161468 + 0.9092974i -0.9899925 + 0.14112i
+ 0. + 0.i 1. + i -0.8390715 - 0.5440211i
+ 0. + 0.i 0.7539023 + 0.6569866i Nan + 0.i
+ 0. + 0.i 0.1367372 + 0.9906074i -0.7596879 + 0.6502878i
+ column 4
+ 0.9074468 + 0.420167i
+ -0.1455 + 0.9893582i
+ 0.843854 - 0.5365729i
+ Inf + 0.i
+ column 1 to 3
+ 0. + 0.i -0.4161468 + 0.9092974i -0.9899925 + 0.14112i
+ column 4
+ 0.9074468 + 0.420167i
+
+ 0. + 0.i 1. + i -0.8390715 - 0.5440211i -0.1455 + 0.9893582i
+
+ column 1 to 3
+ 0. + 0.i 0.7539023 + 0.6569866i Nan + 0.i
+ column 4
+ 0.843854 - 0.5365729i
+
+ column 1 to 3
+ 0. + 0.i 0.1367372 + 0.9906074i -0.7596879 + 0.6502878i
+ column 4
+ Inf + 0.i
+
+ 0. + 0.i
+ 0. + 0.i
+ 0. + 0.i
+ 0. + 0.i
+
+ -0.4161468 + 0.9092974i
+ 1. + i
+ 0.7539023 + 0.6569866i
+ 0.1367372 + 0.9906074i
+
+ -0.9899925 + 0.14112i
+ -0.8390715 - 0.5440211i
+ Nan + 0.i
+ -0.7596879 + 0.6502878i
+
+ 0.9074468 + 0.420167i
+ -0.1455 + 0.9893582i
+ 0.843854 - 0.5365729i
+ Inf + 0.i
+
+ 0. + 0.i 0. + 0.i 0. + 0.i 0. + 0.i
+ 0. + 0.i 0. + 0.i 0. + 0.i 0. + 0.i
+ 0. + 0.i 0. + 0.i Nan + 0.i 0. + 0.i
+ 0. + 0.i 0. + 0.i 0. + 0.i Nan + 0.i
+
+ ans =
+ -0.5493061 + 0.i
+ -0.804719 + 0.i
+ -Inf - 0.7853982i
+ -0.5493061 - 1.5707963i
+ 0. - 1.5707963i
+ 0.5493061 - 1.5707963i
+ Inf + Nani
+ 0.804719 + 3.1415927i
+ 0.5493061 + 3.1415927i
+ column 1 to 2
+ 0.000D+00 + 0.000D+00i -4.161D-01 + 9.093D-01i
+ 0.000D+00 + 0.000D+00i 1.000D+00 + 1.000D+00i
+ 0.000D+00 + 0.000D+00i 7.539D-01 + 6.570D-01i
+ 0.000D+00 + 0.000D+00i 1.367D-01 + 9.906D-01i
+ column 3 to 4
+ -9.900D-01 + 1.411D-01i 9.074D-01 + 4.202D-01i
+ -8.391D-01 - 5.440D-01i -1.455D-01 + 9.894D-01i
+ Nan + 0.000D+00i 8.439D-01 - 5.366D-01i
+ -7.597D-01 + 6.503D-01i Inf + 0.000D+00i
+ column 1 to 2
+ 0.000D+00 + 0.000D+00i -4.161D-01 + 9.093D-01i
+ column 3 to 4
+ -9.900D-01 + 1.411D-01i 9.074D-01 + 4.202D-01i
+
+ column 1 to 2
+ 0.000D+00 + 0.000D+00i 1.000D+00 + 1.000D+00i
+ column 3 to 4
+ -8.391D-01 - 5.440D-01i -1.455D-01 + 9.894D-01i
+
+ column 1 to 3
+ 0.000D+00 + 0.000D+00i 7.539D-01 + 6.570D-01i Nan + 0.000D+00i
+ column 4
+ 8.439D-01 - 5.366D-01i
+
+ column 1 to 2
+ 0.000D+00 + 0.000D+00i 1.367D-01 + 9.906D-01i
+ column 3 to 4
+ -7.597D-01 + 6.503D-01i Inf + 0.000D+00i
+
+ 0.000D+00 + 0.000D+00i
+ 0.000D+00 + 0.000D+00i
+ 0.000D+00 + 0.000D+00i
+ 0.000D+00 + 0.000D+00i
+
+ -4.161D-01 + 9.093D-01i
+ 1.000D+00 + 1.000D+00i
+ 7.539D-01 + 6.570D-01i
+ 1.367D-01 + 9.906D-01i
+
+ -9.900D-01 + 1.411D-01i
+ -8.391D-01 - 5.440D-01i
+ Nan + 0.000D+00i
+ -7.597D-01 + 6.503D-01i
+
+ 9.074D-01 + 4.202D-01i
+ -1.455D-01 + 9.894D-01i
+ 8.439D-01 - 5.366D-01i
+ Inf + 0.000D+00i
+
+ column 1 to 2
+ 0.000D+00 + 0.000D+00i 0.000D+00 + 0.000D+00i
+ 0.000D+00 + 0.000D+00i 0.000D+00 + 0.000D+00i
+ 0.000D+00 + 0.000D+00i 0.000D+00 + 0.000D+00i
+ 0.000D+00 + 0.000D+00i 0.000D+00 + 0.000D+00i
+ column 3 to 4
+ 0.000D+00 + 0.000D+00i 0.000D+00 + 0.000D+00i
+ 0.000D+00 + 0.000D+00i 0.000D+00 + 0.000D+00i
+ Nan + 0.000D+00i 0.000D+00 + 0.000D+00i
+ 0.000D+00 + 0.000D+00i Nan + 0.000D+00i
+
+ ans =
+ -5.493D-01 + 0.000D+00i
+ -8.047D-01 + 0.000D+00i
+ -Inf - 7.854D-01i
+ -5.493D-01 - 1.571D+00i
+ 0.000D+00 - 1.571D+00i
+ 5.493D-01 - 1.571D+00i
+ Inf + Nani
+ 8.047D-01 + 3.142D+00i
+ 5.493D-01 + 3.142D+00i
--- /dev/null
+// Copyright (C) 2019 - Stéphane MOTTELET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 15781 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/15781
+//
+// <-- Short Description -->
+// display of complex matrix is ugly.
+
+n=4
+
+a=testmatrix("magic",4);
+
+for f = ["v","e"]
+ format(f)
+ x=complex(cos(a),sin(a));
+ x(3,3)=%nan;
+ x(4,4)=%inf;
+ x(2,1:2)=1+%i;
+ x(:,1)=0;
+ disp(x)
+
+ for i=1:n
+ disp(x(i,:))
+ disp(" ")
+ end
+
+ for i=1:n
+ disp(x(:,i))
+ disp(" ")
+ end
+
+ x=x-x;
+
+ disp(x)
+ disp(" ")
+
+ acoth(-2:0.5:2).'
+end