Mercurial > hg > octave-lyh
view libcruft/odepack/svnorm.f @ 13754:e652ff4d1522
don't crash when concatenating structs with no fields
* oct-map.cc (octave_map::cat (int, octave_idx_type, const
octave_scalar_map*)): Quick return for N == 1.
(octave_map::cat (int, octave_idx_type, const octave_map*)):
Quick return for N == 1. Only call permute_to_correct_order if there
are fields. Use dim_vector::concat to compute result dimensions if
there are no fields.
New tests for concatentation of structs with no fields.
* pt-mat.cc (tm_const::init (const tree_matrix&)): Initialize all_1x1
to true if tree_matrix argument is not empty.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 26 Oct 2011 00:50:39 -0400 |
parents | 96ba591be50f |
children |
line wrap: on
line source
REAL FUNCTION SVNORM (N, V, W) C***BEGIN PROLOGUE SVNORM C***SUBSIDIARY C***PURPOSE Weighted root-mean-square vector norm. C***TYPE SINGLE PRECISION (SVNORM-S, DVNORM-D) C***AUTHOR Hindmarsh, Alan C., (LLNL) C***DESCRIPTION C C This function routine computes the weighted root-mean-square norm C of the vector of length N contained in the array V, with weights C contained in the array W of length N: C SVNORM = SQRT( (1/N) * SUM( V(i)*W(i) )**2 ) C C***SEE ALSO SLSODE C***ROUTINES CALLED (NONE) C***REVISION HISTORY (YYMMDD) C 791129 DATE WRITTEN C 890501 Modified prologue to SLATEC/LDOC format. (FNF) C 890503 Minor cosmetic changes. (FNF) C 930809 Renamed to allow single/double precision versions. (ACH) C***END PROLOGUE SVNORM C**End INTEGER N, I REAL V, W, SUM DIMENSION V(N), W(N) C C***FIRST EXECUTABLE STATEMENT SVNORM SUM = 0.0E0 DO 10 I = 1,N 10 SUM = SUM + (V(I)*W(I))**2 SVNORM = SQRT(SUM/N) RETURN C----------------------- END OF FUNCTION SVNORM ------------------------ END