About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
See full specifications

scripts default iconDNorm2 (Scripts) Publisher's description

Fast euclidian norm over N.th dimension of a DOUBLE array

Fast euclidian norm over N.th dimension of a DOUBLE array

Y = DNorm2(X, N)
X: Real DOUBLE array.
N: Dimension to operate on.
Y: Euclidian norm over N.th dimension: Y = sqrt(sum(X .* X, N)).
Length of N.th dimension of Y is 1.
NaN's are considered.

Matlab's built-in function NORM is fast for vectors, but for matrices the matrix norm is replied. Other efficient methods for vectors(!):
Y = sqrt(sum(X .* X));
Y = sqrt(X * X'); % row vectors, faster than DNorm2!
And James Tursa's MTIMESX is very fast for vectors also and can operate on the 1st dimension of arrays also:
X = rand(100, 100); X = reshape(X, 100, 1, 100);
Y = sqrt(mtimesx(X, 't', X));
But for arrays DNorm2 is faster, and I do not see a way to apply MTIMESX for trailing dimensions without time-consuming transpositions.

This function must be compiled before using:
mex -O DNorm2.c
See DNorm2.c for detailed instructions.

TEST: Run uTest_DNorm2 to test validity and speed.

NOTES: See DNorm2.c for strategies to optimize processing speed depending on the size of X.
Unfortunately this function is not multi-threaded. Assistence to include OMP would be very welcome.

Tested: Matlab 6.5, 7.7, 7.8, WinXP, 32bit
Compiler: LCC2.4/3.8, BCC5.5, OWC1.8, MSVC2008
Assumed Compatibility: higher Matlab versions, Mac, Linux, 64bit

System Requirements:

MATLAB 7.8 (R2009a)
Program Release Status: New Release
Program Install Support: Install and Uninstall

DNorm2 (Scripts) Tags:

Click on a tag to find related softwares

Is DNorm2 (Scripts) your software?

Manage your software

Most Popular

scripts default icon ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation 1.1
ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation contain several functions for digital modulation simulation
scripts default icon Simulink Communication Labs 1.1
Simulink Communication Labs allows you to learn communication systems in greater depth.
scripts default icon M-QAM modulation and demodulation 1.1
M-QAM modulation and demodulation is the QAM modulation and demodulation tech.
scripts default icon LZW Compression/Decompression 1.1
LZW Compression/Decompression - Updated LZW compressor and decompressor with reasonable performance
scripts default icon InSPIRE utility to plot a 2D displacement field (Scripts) 1.0
This program plots the deformation field (displace vectors) contained in vector.txt.