MATLAB Release Notes Previous page   Next Page

Mathematics Features

MATLAB 7.0 adds the following mathematics features and enhancements:

New Nondouble Mathematics Features

MATLAB Version 7.0 now supports many arithmetic operations and mathematical functions on the following nondouble MATLAB data types:

Most of the built-in MATLAB functions that perform mathematical operations now support inputs of type single. In addition, the arithmetic operators and the functions sum, diff, colon, and some elementary functions now support integer data types.

This section covers the following topics:

Nondouble Arithmetic

This section describes how MATLAB performs arithmetic on nondouble data types.

Single Arithmetic.   You can now combine numbers of type single with numbers of type double or single. MATLAB performs arithmetic as if both inputs had type single and returns a result of type single. For more information, see Single-Precision Mathematics in the online MATLAB documentation.

Integer Arithmetic.   You can now combine numbers of an integer data type with numbers of the same integer data type or type scalar double. MATLAB performs arithmetic as if both inputs had type double and then converts the result to the same integer data type.

MATLAB computes operations on arrays of integer data type using saturating integer arithmetic. Saturating means that if the result is greater than the upper bound of the integer data type, MATLAB returns the upper bound. Similarly, if the result is less than the lower bound of the data type, MATLAB returns the lower bound. For more information, see Integer Mathematics in the online MATLAB documentation.

New Class and Data Inputs for eps

You can now call the function eps with the syntax

If x has type double, eps(x) returns the distance from x to the next largest double-precision floating point number. This is a measure of the accuracy of x as a double-precision number. eps(1) returns the same value as eps with no input argument.

You can now replace expressions of the form

with

If x has type single, eps(x) returns the distance from x to the next largest single-precision floating point number. This is a measure of the accuracy of x as a single-precision number.

The command

returns the same value as eps(single(1)). The value of eps('single') is the same as single(2^-23). The command eps('double') returns the same result as eps.

See eps in Double and Single-Precision Arithmetic in the online MATLAB documentation for more information.

New Class Inputs for realmax and realmin

You can now call the function realmax with the syntax

which returns the largest single-precision number. Similarly,

returns the smallest single-precision number.

The commands realmax('double') and realmin('double') return the same results as realmax and realmin, respectively. See Largest and Smallest Numbers in the online MATLAB documentation for more information.

New Functions intmax and intmin

Two new functions, intmax and intmin, return the largest and smallest numbers, respectively, for integer data types. For example,

returns the largest number of type int8. See Largest and Smallest Values for Integer Data Types in the online MATLAB documentation for more information.

New Warnings for Integer Arithmetic

This section describes four new warning messages for integer arithmetic in Version 7.0. While these warnings are turned off by default, you can turn them on as a diagnostic tool or to warn of behavior in integer arithmetic that might not be expected.

To turn all four warning messages on at once, enter

Integer Conversion of Noninteger Values.   MATLAB can now return a warning when it rounds up a number in converting to an integer data type. For example,

Integer Conversion of NaN.   When MATLAB converts NaN (Not-a-Number) to an integer data type, the result is 0. MATLAB can now return a warning when this occurs. For example,

Integer Conversion Overflow.   MATLAB can now return a warning when you convert a number to an integer data type and the number is outside the range of the data type. For example,

Integer Arithmetic Overflow.   MATLAB can now return a warning when the result of an operation on integer data types is either NaN or outside the range of that data type. For example,

To turn all of these warnings off at once, enter

New Class Inputs for ones, zeros, and eye

You can now call ones or zeros with an input argument specifying the data type of the output. For example,

or

returns an m-by-n-by-p-by ... array of type single containing all ones. zeros uses the same syntax.

You can now call eye with this input argument for two-dimensional arrays. For example,

returns an m-by-m identity matrix of type single. The command

returns an m-by-n array of type int8.

New Class and Size Inputs for Inf and NaN

The functions Inf and NaN now accept inputs that enable you to create Infs or NaNs of specified sizes and floating-point data types. As examples,

See the reference pages for Inf and NaN for more information.

New Class Inputs for sum

The following new input arguments for sum control how the summation is performed on numeric inputs:

In Version 7.0, sum applied to a vector of type single performs single accumulation and returns a result of type single. In other words, sum(x) is the same as sum(x, 'native') if x has type single. This is a change in the behavior of sum from previous releases. To make sum accumulate in double, as in previous releases, use the input argument 'double'.

New Functions for Numerical Data Types

MATLAB 7.0 contains three new functions for detecting and converting data types:

complex Now Accepts Inputs of Different Data Types

The function complex now accepts inputs of different data types when you use the syntax

according to the following rules:

Bit Functions Now Work on Unsigned Integers

The following functions now work on unsigned integer inputs:

Instead of using flints (integer values stored in floating point) to do your bit manipulations, consider using unsigned integers, as a more natural representation of bit strings. Instead of using bitmax, use the intmax function with the appropriate class name. For example, use intmax('uint32') if you are working with unsigned 32 bit integers.

In addition, the function bitcmp now accepts the following new syntax for inputs of type uint8, uint16, and uint32:

bitcmp now uses the data type of A to determine how to take the bitwise complement.

New Function linsolve for Solving Systems of Linear Equations

The new linsolve function enables you to solve systems of linear equations of the form Ax = b more quickly when the matrix of coefficients A has a special form, such as upper triangular. When you specify one of these special types of systems, linsolve is faster than mldivide or \ (backslash) because it does not check whether the matrix actually has the form you specify.

New Function accumarray for Constructing Arrays with Accumulation

The new accumarray function enables you to construct an array with accumulation. The following example uses accumarray to construct a 5-by-5 matrix A from a vector val. The function accumarray adds the entries of val to A at the indices specified by the matrix ind, which has the same number of rows as val. If an index in ind is repeated, the entries of val accumulate at the corresponding entry of A.

To get the (5,5) entry of A, accumarray adds the entries of val corresponding to repeated pair of indices (5,5).

In general, if ind has ndim columns, A will be an N-dimensional array with ndim dimensions, whose size is max(ind).

Enhancements to Discrete Fourier Transform Functions

The new function fftw enables you to optimize the speed of the discrete Fourier transform (DFT) functions fft, ifft, fft2, ifft2, fftn, and ifftn. You can use fftw to set options for a tuning algorithm that experimentally determines the fastest algorithm for computing a discrete Fourier transform of a particular size and dimension at run time.

The functions ifft, ifft2, and ifftn now accept the input argument 'symmetric', which causes these functions to treat the array X as conjugate symmetric. This option is useful when X is not exactly conjugate symmetric, merely because of round-off error.

Enhancements to lscov

The command

now accepts either a weight vector or a covariance matrix for V. If you enter lscov(A,b) without a third argument, lscov uses the identity matrix for V.

The command lscov(A, b, V, alg) now enables you to specify the algorithm used to compute the result when V is a matrix. You can specify alg to be one of the following:

The command

now returns mse, the mean squared estimate (MSE).

The command

now returns S, the estimated covariance matrix of x.

In addition, lscov can now accept a design matrix A that is rank deficient and a covariance matrix, V, that is positive semidefinite.

Enhanced Functions for Computational Geometry

The following functions, which perform geometric computations on a set of points in N-dimensional space, now provide many new options:

These functions now accept an input cell array options that gives you greater control over how they perform calculations. These functions use the software Qhull, created at the National Science and Technology Research Center for Computation and Visualization of Geometric Structures (the Geometry Center). For more information on the available options, see http://www.qhull.org/.

New and Enhanced Functions for Ordinary Differential Equations (ODEs)

MATLAB 7.0 provides two new functions for solving implicit ODEs and extending solutions to ODEs, along with several enhancements to existing ODE-related functions:

New Output Function for Optimization Functions

In MATLAB 7.0, you can create an output function for several optimization functions in MATLAB. The optimization function calls the output function at each iteration of its algorithm. You can use the output function to obtain information about the data at each iteration or to stop the algorithm based on the current values of the data. You can use the output function with the following optimization functions:

See Calling an Output Function Iteratively for an example of how to use the output function.

New Support for Interpolation Functions

The following interpolation functions now have enhanced features:

Enhanced sort Capabilities and Performance

Improved Performance

sort performance has been improved for numeric arrays of randomly ordered data. Although there is some performance improvement for all such numeric arrays, you should see the greatest improvement for integer arrays and multidimensional arrays.

Sort Direction

A new argument, mode, lets you specify whether sort returns the sorted array in ascending or descending order.

New Input Argument for Incomplete Gamma Function

The incomplete gamma function, gammainc, now accepts the input argument tail, using the syntax

Y = gammainc(X,A,tail)

tail specifies the tail of the incomplete gamma function when X is non-negative. The choices are for tail are 'lower' (the default) and 'upper'. The upper incomplete gamma function is defined as

New Function quadv Integrates Complex, Array-Valued Functions

The new function quadv integrates complex, array-valued functions.

New Form for Generalized Hessian

The function hess has a new syntax of the form

where A and B are square matrices, and returns an upper Hessenberg matrix AA, an upper triangular matrix BB, and unitary matrices Q and Z such that

and

New Output for polyeig

The function polyeig can now return a vector of condition numbers for the eigenvalues, when you call it with the syntax

At least one of A0 and Ap must be nonsingular. Large condition numbers imply that the problem is close to one with multiple eigenvalues.

New Trigonometric Functions For Angles in Degrees

The following new functions compute trigonometric functions of arguments in degrees.

Function
Purpose
sind
Compute the sine of an argument in degrees
cosd
Compute the cosine of an argument in degrees
tand
Compute the tangent of an argument in degrees
cotd
Compute the cotangent of an argument in degrees
secd
Compute the secant of an argument in degrees
cscd
Compute the cosecant of an argument in degrees

The following new functions compute the inverse trigonometric functions are return the answer in degrees:

Function
Purpose
asind
Compute the inverse sine of an argument and return answer in degrees
acosd
Compute the inverse cosine of an argument and return answer in degrees
atand
Compute the inverse tangent of an argument and return answer in degrees
acotd
Compute the inverse cotangent of an argument and return answer in degrees
asecd
Compute the inverse secant of an argument and return answer in degrees
acscd
Compute the inverse cosecant of an argument and return answer in degrees

New Functions for Computing Logarithms, Exponentials, and nth Roots

The following new functions compute logarithms, exponentials, and nth roots of real numbers.

Function
Purpose
expm1
Compute exp(x)-1 accurately for small values of x
log1p
Compute log(1+x) accurately for small values of x
nthroot
Compute the real nth root of a real number

Overriding the Default BLAS Library on Intel/Windows Systems

MATLAB uses the Basic Linear Algebra Subroutines (BLAS) libraries to speed up matrix multiplication and LAPACK-based functions like eig, svd, and \ (mldivide). At start-up, MATLAB selects the BLAS library to use.

For R14, MATLAB still uses the ATLAS BLAS libraries, however, on Windows systems running on Intel processors, you can switch the BLAS library that MATLAB uses to the Math Kernel Library (MKL) BLAS, provided by Intel.

If you want to take advantage of the potential performance enhancements provided by the Intel BLAS, you can set the value of the environment variable BLAS_VERSION to the name of the MKL library, mkl.dll. MATLAB uses the BLAS specified by this environment variable, if it exists.

To set the BLAS_VERSION environment variable, follow this procedure:

  1. Click the Start button, go to the Settings menu, and select Control Panel.
  2. On the Control Panel menu, select System.
  3. In the System Properties dialog box, click the Advanced tab.
  4. On the Advanced panel, click the Environment Variables button.
  5. In the Environment Variables dialog box, click the New button in the User variables section.
  6. In the New User Variable dialog box, enter the name of the variable as BLAS_VERSION and set the value of the variable to the name of the MKL library: mkl.dll.

Multithreading Disabled in Intel Math Kernel Library (MKL) BLAS

The Intel Math Kernel Library (MKL) is multithreaded in several areas. By default, this threading capability is disabled. To enable threading in the MKL library, set the value of the OMP_NUM_THREADS environment variable. Intel recommends setting the value of the OMP_NUM_THREADS variable to the number of processors you want to use in your application.

To set the value of this environment variable, follow the instructions outlined in Overriding the Default BLAS Library on Intel/Windows Systems.

Before enabling multithreading, read the Intel Math Kernel Library 6.1 for Windows Technical User Notes that explains certain limitations of this capability.


Previous page  Publishing Results Programming Features Next page

© 1994-2005 The MathWorks, Inc.