Using the C++ Math Library | ![]() |
Alphabetized Error Messages
Cannot extract shared data. Use copy() first.
The function mwArray::FreezeData()
issues this error when it is called on an array with a reference count higher than one. See Example Program: Passing Functions As Arguments (ex3.cpp) in Chapter 5 for more details on using FreezeData()
.
Deleting Matrix with nonzero reference count = <number>.
A matrix that is still in use is being deleted. This is an internal error indicating the matrix reference counting code has become confused.
Don't set library allocation functions to NULL.
The library memory allocation and deallocation functions must never be NULL
. This error indicates a user's attempt to set one of the library's allocation functions to NULL
, for example, mwSetFreeHandler(NULL)
.
Don't set library error handler to NULL.
By default, the error handler throws an exception. You can change this behavior, but you must always have an error handling function. If you try to set the error handler to NULL
, for example, mwSetErrorHandler(NULL)
, you'll get this message.
Don't set library error message handler to NULL.
The library error message handling function must never be NULL
. This error indicates a user's attempt to set it to NULL
, for example, mwSetErrorMsgHandler(NULL)
.
Don't set library exception message handler to NULL.
The library exception message handling function must never be NULL
. This error indicates a user's attempt to set it to NULL
, for example, mwSetExceptionMsgHandler(NULL)
.
Don't set library print handler to NULL.
The library print handling function must never be NULL
. This error indicates a user attempt to set it to NULL
, for example, mwSetPrintHandler(NULL)
.
Extraction from NULL matrix.
This internal error occurs when the program attempts to extract a double-precision floating-point number from a 1-by-1 matrix that contains no data.
Inconsistent precision: expecting <number>, found <number>.
This is an internal error issued by the matrix printing routine when it discovers that an element of a matrix is too large (too many digits) to print in the space allocated for it.
Input to <name> must be 1-by-2; was <number>-by-<number>.
The matrix creation functions, ones()
, eye()
, zeros()
, magic()
, rand(),
and randn()
, accept one or two doubles or a matrix of two doubles as input arguments. This error occurs when the input matrix is not 1-by-2, for example, ones(zeros(4))
. The inner call, to zeros()
, succeeds and returns a 4-by-4 matrix. The second call, to ones()
with a 4-by-4 matrix, produces this error.
Line width must be positive: <number> isn't.
You can set the width of the lines (the maximum number of characters that will fit on a line) on your display screen; the wider the screen, the more matrix elements will be displayed on each line. However, if you specify a negative or zero width, you will see this error.
Matrix input format error: All rows must be the same length (<number>).
All the rows in a matrix must contain the same number of columns. This error occurs when the matrix input routine, operator>>()
, detects a ``ragged'' matrix; i.e., one in which all the rows do not contain the same number of columns. For example, [ 1 2 ; 3 ; 4 5 ]
. The second row contains only one column, while rows one and three contain two columns.
Matrix input format error: Can't find scale factor.
A scale factor, for example, 1e-10 * [1 2; 3 4]
, may precede a matrix in the input stream. This error occurs when the first nonblank character read by the matrix input routine is neither a bracket [
nor the beginning of a valid double-precision floating-point number. A scale factor of 0.0
also causes this error.
Matrix input format error: Complex numbers must end with an 'i'. Found '<character>' instead.
3+5i, 0-2i, and even 9.35i are all valid complex numbers. The terminating `i' character indicates the numbers are complex. This error occurs when the input routine thinks it is reading a complex number and is surprised to find that the number being read does not end with an `i'. Missing whitespace between columns, for example [1-2; 3 4]
, causes this error. Whitespace inserted between the 1
and the -
, [1 -2; 3 4]
, makes this into a valid matrix.
Matrix input format error: Expecting a digit, found '<character>'.
When the characters +
and -
occur in the input stream, they must be followed by a digit between 0
and 9
. This error occurs when the input routine encounters a +
or -
and the next (nonwhitespace) character is not a digit between 0
and 9
.
Matrix input format error: Missing '*' from scale factor.
A matrix scale factor consists of a nonzero double-precision floating-point number followed by an asterisk denoting multiplication. If the asterisk is not present, this error occurs.
Matrix input format error: Missing '['.
The matrix input format stipulates that all matrices begin with a bracket [
. This error occurs when the matrix input routine, operator>>()
, can't find the initial bracket [
character.
Matrix input format error: Missing ']'.
The matrix input format stipulates that all matrices (except string matrices) end with a bracket ]
. This error occurs when the matrix input routine, operator>>()
, can't find the terminating bracket ]
character.
Matrix input format error: String matrix terminated with <character> rather than '.
To be recognized as a string matrix, a matrix must begin and end with a single quote character. This error occurs when the trailing single quote character is missing.
Matrix input format error: Unrecognized character: '<character>'.
Only the digits 0-9, the symbols +
and -
, the period .
, the semicolon ;
, the letter e
(for scientific notation), the letter i
(to indicate a complex number), and whitespace characters (space, tab, and carriage return) are permitted between the opening bracket [
and closing bracket ]
of a matrix definition. This error indicates that a character outside that set appeared in the input stream. Correct this problem by removing the out-of-range character.
A memory allocation request failed.
The program is out of memory. There is very little you can do about this. Try to rewrite your code to use less memory. Exit any nonessential programs. Increase the size of your swap partition. Add more memory to your machine.
Need array pointer to determine size of ':'.
This is an internal error that indicates the mwArray
object is corrupt.
Not yet implemented: <some text>.
The feature you are trying to use, indicated by <some text>
in the message, has not yet been implemented.
Null matrix data.
The mwArray
copy constructor checks the data pointer of the matrix it is copying. If the data pointer is NULL
, this internal error occurs.
Null matrix on left-hand side.
Assignment with NULL
matrices is a special case. If you see this error message, it means the library failed to detect this case correctly.
Null reference matrix in index operation.
Matrix index operations generally involve an intermediate mwSubArray
object. The mwSubArray
contains a pointer to the matrix on which the index operation was performed. This pointer should never be NULL
. This error occurs when the pointer is NULL
.
Null Reference() pointer!
The reference field of an mwArray
object is NULL
when it should not be. This is an internal error.
Only 1-by-1 matrices can be cast to doubles. Matrix is <number>-by-<number>.
This error occurs when you treat a matrix with a size other than 1-by-1 as a scalar; for example, by assigning it to a double.
The error message displays the dimensions of the matrix. Correct this error by using an indexing operation to extract the number you want from the matrix or, if this error occurs in a logical expression (for example, an if
-statement), by placing a call to tobool()
around the conditional expression.
Only noncomplex matrices can be cast to doubles.
You cannot cast a matrix with a complex component to a double, even if the matrix is 1-by-1. If you were able to, the complex component of the matrix would be lost in translation. If you really need access to the complex component of a matrix A
, the code mxGetPi(A.GetData())
will return a pointer to the two-dimensional array of complex matrix data. However, by using this construct, you are circumventing the safeguards built into the library. If you write to this array, the mwArray
object(s) that contain(s) it may no longer be able to function properly. Reading from the array is relatively safe.
Output pointer (first arg.) NULL.
There is a special, efficient, version of the size()
routine that returns the size of the matrix as two integers rather than as a matrix. The first argument to this version of size()
is a pointer to an integer; size()
stores the number of columns there. If that pointer is NULL
, this error occurs.
Premature end of file.
The matrix input routine, operator>>()
, came to the end of the file before reading a complete matrix. Check to be sure the file exists and that the data in it is correct. Remember: operator>>()
can only read ASCII files.
<function> with complex result.
Four functions, reallog()
, reallog10()
, realpow()
, and realsqrt()
, verify that their return value is noncomplex. If the return value is complex, this error occurs. This is caused by incorrect input, for example, realsqrt(-1)
.
![]() | Error Messages |