📄 matrix.h
字号:
// -15 22
\endcode
\return true if successful, false otherwise.
*/
bool Multiply( const Matrix &B, const Matrix &C );
public: // Matlab/Octave style functions
/**
\brief Compute the absolute value of each element of the matrix inplace.
\code
Matrix A;
A = "[-1 2 3]";
if( !A.Inplace_abs() )
return false;
// A
// [1 2 3]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_abs();
/**
\brief Compute the arc-cosine of each element of the matrix inplace.
Complex results are obtained if elements are greater than abs(1).
Results in radians.
\code
Matrix A;
A = "[0 0.5 1]";
if( !A.Inplace_acos() )
return false;
// A
// [pi/2 pi/3 0]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_acos();
/**
\brief Compute the arc-cosine of each element of the matrix inplace.
Complex results are obtained if elements are greater than abs(1).
Results in degrees.
\code
Matrix A;
A = "[0 0.5 1]";
if( !A.Inplace_acosd() )
return false;
// A
// [90 60 0]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_acosd();
/**
\brief Compute the inverse hyperbolic cosine of each element of the matrix inplace.
Results in radians.
\code
Matrix A;
A = "[0 1.0471975511966 1.5707963267949]";
if( !A.Inplace_acosh() )
return false;
// A
// [0 pi/3 pi/2]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_acosh();
/**
\brief Compute the phase angle in radians of the elements of the matrix.
\code
Matrix A;
A = "[1+1i 1-1i 3+2i]";
if( !A.Inplace_acosh() )
return false;
// A
// [pi/4 -pi/4 0.588002603547568]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_angle();
/**
\brief Compute the arc-sine of each element of the matrix inplace.
Complex results are obtained if elements are greater than abs(1).
Results in radians.
\code
Matrix A;
A = "[0 0.5 1.0]";
if( !A.Inplace_asin() )
return false;
// A
// [0 pi/6 pi/2]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_asin();
/**
\brief Compute the arc-sine of each element of the matrix inplace.
Complex results are obtained if elements are greater than abs(1).
Results in degrees.
\code
Matrix A;
A = "[0 0.5 1.0]";
if( !A.Inplace_asind() )
return false;
// A
// [0 30 90]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_asind();
/**
\brief Compute the inverse hyperbolic sine of each element of the matrix inplace.
Results in radians.
\code
Matrix A;
A = "[0 0.521095305493747 1.1752011936438]";
if( !A.Inplace_asinh() )
return false;
// A
// [0 0.5 1]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_asinh();
/**
\brief Compute the arc-tangent of each element of the matrix inplace.
Results in radians bounded [-pi/2, pi/2].
\code
Matrix A;
A = "[0 1.73205080756888 1.63312393531954e+016]";
if( !A.Inplace_atan() )
return false;
// A
// [0 pi/3 pi/2]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_atan();
/**
\brief Compute the arc-tangent of each element of the matrix inplace.
Results in degrees bounded [-90, 90].
\code
Matrix A;
A = "[0 1.73205080756888 1.63312393531954e+016]";
if( !A.Inplace_atand() )
return false;
// A
// [0 60 90]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_atand();
/**
\brief Compute the inverse hyperbolic tangent of each element of the matrix inplace.
\code
Matrix A;
A = "[0 0.46211715726001 0.761594155955765]";
if( !A.Inplace_atanh() )
return false;
// A
// [0 0.5 1]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_atanh();
/**
\brief Create a column vector [start:increment:end) beginning at start
with step size of increment until less than or equal to end.
Note that arguments must be real scalars. \n
\code
Matrix A;
if( !A.Inplace_colon( 2, 2, 9 ) )
return false;
// A
// [2; 4; 6; 8]
if( !A.Inplace_colon( 2, -2, -9 ) )
return false;
// A
// [2; 0; -2; -4; -6; -9;]
if( !A.Inplace_colon( -10, 0.01, 10 ) )
return false;
// A
// [-10 -9.99 -9.98 ... 10]
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_colon( double start, double increment, double end );
/**
\brief Compute the cosine of each element of the matrix inplace. This
function assumes radian values in the matrix.
\code
Matrix A;
A = "[0 1.0471975511966 1.5707963267949]"; // [0 pi/3 pi/2]
if( !A.Inplace_cos() )
return false;
// A
// 1 0.5 0
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_cos();
/**
\brief Compute the hyperbolic cosine of each element of the matrix inplace. This
function assumes radian values in the matrix.
\code
Matrix A;
A = "[0 0.5 1]";
if( !A.Inplace_cosh() )
return false;
// A
// 1 1.12762596520638 1.54308063481524
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_cosh();
/**
\brief Compute the cotangent of each element of the matrix inplace. This
function assumes radian values in the matrix.
\code
Matrix A;
A = "[0 1.0471975511966 1.5707963267949]"; // [0 pi/3 pi/2]
if( !A.Inplace_cot() )
return false;
// A
// Inf 0.577350269189626 0
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_cot();
/**
\brief Compute the hyperbolic cotangent of each element of the matrix inplace. This
function assumes radian values in the matrix.
\code
Matrix A;
A = "[0 0.5 1]";
if( !A.Inplace_coth() )
return false;
// A
// Inf 2.16395341373865 1.31303528549933
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_coth();
/**
\brief Complex conjugate. z = x+yi. conj(z) = x-yi.
\code
Matrix A;
A = "[2-2i -3+2i]";
if( !A.Inplace_conj() )
return false;
// A
// 2+2i -3-2i
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_conj();
/**
\brief Compute the exponential of each element of the matrix inplace.
If real, computes the exp(value) of each element in the matrix.
If complex, computes exp(M) = exp(real)*(cos(imag)+i*sin(imag)).
\code
Matrix A;
A = "[1 2]";
if( !A.Inplace_exp() )
return false;
// A
// 2.71828182845905 7.38905609893065
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_exp();
/**
\brief Create an indentity matrix with nrows and ncols.
\code
Matrix A;
if( !A.eye(3,3) )
return false;
// A
// 1 0 0
// 0 1 0
// 0 0 1
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_eye( const unsigned nrows, const unsigned ncols );
/**
\brief Imaginary part of the complex matrix. z = x+yi. real(z) = y.
\code
Matrix A;
A = "[2-2i -3+2i]";
if( !A.Inplace_imag() )
return false;
// A
// -2 2
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_imag();
/**
\brief Compute the log base 2 of the elements of the matrix.
Complex results if elements are negative.
\code
Matrix A;
A = "[2 32]";
if( !A.Inplace_log2() )
return false;
// A
// 1 5
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_log2();
/**
\brief Compute the log base 10 of the elements of the matrix.
Complex results if elements are negative.
\code
Matrix A;
A = "[10 1000]";
if( !A.Inplace_log10() )
return false;
// A
// 1 3
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_log10();
/**
\brief Create a matrix of nrows by ncols filled with 1.0.
\code
Matrix A;
if( !A.Inplace_ones(2,3) )
return false;
// A
// 1 1 1
// 1 1 1
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_ones( const unsigned nrows, const unsigned ncols );
/**
\brief Real part of the complex matrix. z = x+yi. real(z) = x.
\code
Matrix A;
A = "[2-2i -3+2i]";
if( !A.Inplace_real() )
return false;
// A
// 2 3
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_real();
/**
\brief Compute the sine of each element of the matrix inplace. This
function assumes radian values in the matrix.
\code
Matrix A;
A = "[0 0.523598775598299 1.5707963267949]"; //[0 pi/6 pi/2]
if( !A.Inplace_sin() )
return false;
// A
// 0 0.5 1
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_sin();
/**
\brief Compute the sinc of each element*pi of the matrix inplace.
i.e. y = sin(pi*x)./(pi*x).
\code
Matrix A;
A = "[0 0.523598775598299 1.5707963267949]"; //[0 pi/6 pi/2]
if( !A.Inplace_sinc() )
return false;
// A
// 1 0.606257160324575 -0.19765087483668
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_sinc();
/**
\brief Compute the hyperbolic sine of each element of the matrix inplace. This
function assumes radian values in the matrix.
\code
Matrix A;
A = "[0 0.5 1]";
if( !A.Inplace_sinh() )
return false;
// A
// 0 0.521095305493747 1.1752011936438
\endcode
\return true if successful, false otherwise.
*/
bool Inplace_sinh();
/**
\brief Compute the sqrt of each element of the matrix inplace.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -