PCL
Vector.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.1.19
6 // ----------------------------------------------------------------------------
7 // pcl/Vector.h - Released 2019-11-07T10:59:34Z
8 // ----------------------------------------------------------------------------
9 // This file is part of the PixInsight Class Library (PCL).
10 // PCL is a multiplatform C++ framework for development of PixInsight modules.
11 //
12 // Copyright (c) 2003-2019 Pleiades Astrophoto S.L. All Rights Reserved.
13 //
14 // Redistribution and use in both source and binary forms, with or without
15 // modification, is permitted provided that the following conditions are met:
16 //
17 // 1. All redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 //
20 // 2. All redistributions in binary form must reproduce the above copyright
21 // notice, this list of conditions and the following disclaimer in the
22 // documentation and/or other materials provided with the distribution.
23 //
24 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
25 // of their contributors, may be used to endorse or promote products derived
26 // from this software without specific prior written permission. For written
27 // permission, please contact info@pixinsight.com.
28 //
29 // 4. All products derived from this software, in any form whatsoever, must
30 // reproduce the following acknowledgment in the end-user documentation
31 // and/or other materials provided with the product:
32 //
33 // "This product is based on software from the PixInsight project, developed
34 // by Pleiades Astrophoto and its contributors (http://pixinsight.com/)."
35 //
36 // Alternatively, if that is where third-party acknowledgments normally
37 // appear, this acknowledgment must be reproduced in the product itself.
38 //
39 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
40 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
41 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
43 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
45 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
46 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 // POSSIBILITY OF SUCH DAMAGE.
50 // ----------------------------------------------------------------------------
51 
52 #ifndef __PCL_Vector_h
53 #define __PCL_Vector_h
54 
56 
57 #include <pcl/Defs.h>
58 #include <pcl/Diagnostics.h>
59 
60 #include <pcl/Container.h>
61 #include <pcl/Exception.h>
62 #include <pcl/ReferenceCounter.h>
63 #include <pcl/Search.h>
64 #include <pcl/Sort.h>
65 #include <pcl/Utility.h>
66 
67 #ifndef __PCL_NO_VECTOR_STATISTICS
68 # include <pcl/Selection.h>
69 #endif
70 
71 #ifndef __PCL_NO_VECTOR_INSTANTIATE
72 # include <pcl/Complex.h>
73 #endif
74 
75 namespace pcl
76 {
77 
78 // ----------------------------------------------------------------------------
79 
105 template <typename T>
106 class PCL_CLASS GenericVector : public DirectContainer<T>
107 {
108 public:
109 
113  typedef T scalar;
114 
118  typedef T component;
119 
123  typedef T* iterator;
124 
128  typedef const T* const_iterator;
129 
135  {
136  m_data = new Data;
137  }
138 
147  GenericVector( int len )
148  {
149  m_data = new Data( len );
150  }
151 
158  GenericVector( const component& x, int len )
159  {
160  m_data = new Data( len );
161  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i )
162  *i = x;
163  }
164 
175  template <typename T1>
176  GenericVector( const T1* a, int len )
177  {
178  m_data = new Data( len );
179  if ( a != nullptr )
180  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i )
181  *i = component( *a++ );
182  }
183 
192  template <typename T1>
193  GenericVector( std::initializer_list<T1> c ) : GenericVector( c.begin(), int( c.size() ) )
194  {
195  }
196 
201  template <typename T1>
202  GenericVector( const T1& x, const T1& y, const T1& z )
203  {
204  m_data = new Data( 3 );
205  iterator v = m_data->Begin();
206  *v++ = component( x );
207  *v++ = component( y );
208  *v = component( z );
209  }
210 
215  template <typename T1>
216  GenericVector( const T1& x, const T1& y, const T1& z, const T1& t )
217  {
218  m_data = new Data( 4 );
219  iterator v = m_data->Begin();
220  *v++ = component( x );
221  *v++ = component( y );
222  *v++ = component( z );
223  *v = component( t );
224  }
225 
230  GenericVector( const GenericVector& x ) : m_data( x.m_data )
231  {
232  m_data->Attach();
233  }
234 
238  GenericVector( GenericVector&& x ) : m_data( x.m_data )
239  {
240  x.m_data = nullptr;
241  }
242 
248  virtual ~GenericVector()
249  {
250  if ( m_data != nullptr )
251  {
252  DetachFromData();
253  m_data = nullptr;
254  }
255  }
256 
260  void Clear()
261  {
262  if ( !IsEmpty() )
263  if ( m_data->IsUnique() )
264  m_data->Deallocate();
265  else
266  {
267  Data* newData = new Data( 0 );
268  DetachFromData();
269  m_data = newData;
270  }
271  }
272 
278  GenericVector& operator =( const GenericVector& x )
279  {
280  Assign( x );
281  return *this;
282  }
283 
296  void Assign( const GenericVector& x )
297  {
298  x.m_data->Attach();
299  DetachFromData();
300  m_data = x.m_data;
301  }
302 
308  GenericVector& operator =( GenericVector&& x )
309  {
310  Transfer( x );
311  return *this;
312  }
313 
327  {
328  DetachFromData();
329  m_data = x.m_data;
330  x.m_data = nullptr;
331  }
332 
346  {
347  DetachFromData();
348  m_data = x.m_data;
349  x.m_data = nullptr;
350  }
351 
358  friend void Swap( GenericVector& x1, GenericVector& x2 )
359  {
360  pcl::Swap( x1.m_data, x2.m_data );
361  }
362 
371  GenericVector& operator =( const scalar& x )
372  {
373  if ( !IsUnique() )
374  {
375  Data* newData = new Data( m_data->Length() );
376  DetachFromData();
377  m_data = newData;
378  }
379 
380  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i )
381  *i = x;
382  return *this;
383  }
384 
398  GenericVector& operator +=( const GenericVector& x )
399  {
400  if ( x.Length() < Length() )
401  throw Error( "Invalid vector addition." );
402  EnsureUnique();
403  const_iterator s = x.Begin();
404  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i, ++s )
405  *i += *s;
406  return *this;
407  }
408 
422  GenericVector& operator -=( const GenericVector& x )
423  {
424  if ( x.Length() < Length() )
425  throw Error( "Invalid vector subtraction." );
426  EnsureUnique();
427  const_iterator s = x.Begin();
428  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i, ++s )
429  *i -= *s;
430  return *this;
431  }
432 
446  GenericVector& operator *=( const GenericVector& x )
447  {
448  if ( x.Length() < Length() )
449  throw Error( "Invalid vector multiplication." );
450  EnsureUnique();
451  const_iterator s = x.Begin();
452  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i, ++s )
453  *i *= *s;
454  return *this;
455  }
456 
474  GenericVector& operator /=( const GenericVector& x )
475  {
476  if ( x.Length() < Length() )
477  throw Error( "Invalid vector division." );
478  EnsureUnique();
479  const_iterator s = x.Begin();
480  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i, ++s )
481  *i /= *s;
482  return *this;
483  }
484 
485 #define IMPLEMENT_SCALAR_ASSIGN_OP( op ) \
486  if ( IsUnique() ) \
487  { \
488  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i ) \
489  *i op##= x; \
490  } \
491  else \
492  { \
493  Data* newData = new Data( m_data->Length() ); \
494  for ( iterator i = m_data->Begin(), j = m_data->End(), k = newData->Begin(); i < j; ++i, ++k ) \
495  *k = *i op x; \
496  DetachFromData(); \
497  m_data = newData; \
498  } \
499  return *this;
500 
509  GenericVector& operator +=( const scalar& x )
510  {
511  IMPLEMENT_SCALAR_ASSIGN_OP( + )
512  }
513 
522  GenericVector& operator -=( const scalar& x )
523  {
524  IMPLEMENT_SCALAR_ASSIGN_OP( - )
525  }
526 
535  GenericVector& operator *=( const scalar& x )
536  {
537  IMPLEMENT_SCALAR_ASSIGN_OP( * )
538  }
539 
548  GenericVector& operator /=( const scalar& x )
549  {
550  IMPLEMENT_SCALAR_ASSIGN_OP( / )
551  }
552 
561  GenericVector& operator ^=( const scalar& x )
562  {
563  if ( IsUnique() )
564  {
565  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i )
566  *i = pcl::Pow( *i, x );
567  }
568  else
569  {
570  Data* newData = new Data( m_data->Length() );
571  for ( iterator i = m_data->Begin(), j = m_data->End(), k = newData->Begin(); i < j; ++i, ++k )
572  *k = pcl::Pow( *i, x );
573  DetachFromData();
574  m_data = newData;
575  }
576  return *this;
577  }
578 
579 #undef IMPLEMENT_SCALAR_ASSIGN_OP
580 
587  {
588  GenericVector R( m_data->Length() );
589  iterator r = R.Begin();
590  for ( const_iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i )
591  *r++ = *i * *i;
592  return R;
593  }
594 
601  void SetSqr()
602  {
603  if ( IsUnique() )
604  {
605  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i )
606  *i *= *i;
607  }
608  else
609  {
610  Data* newData = new Data( m_data->Length() );
611  for ( iterator i = m_data->Begin(), j = m_data->End(), k = newData->Begin(); i < j; ++i, ++k )
612  *k = *i * *i;
613  DetachFromData();
614  m_data = newData;
615  }
616  }
617 
624  {
625  GenericVector R( m_data->Length() );
626  iterator r = R.Begin();
627  for ( const_iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i )
628  *r++ = pcl::Sqrt( *i );
629  return R;
630  }
631 
638  void SetSqrt()
639  {
640  if ( IsUnique() )
641  {
642  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i )
643  *i = pcl::Sqrt( *i );
644  }
645  else
646  {
647  Data* newData = new Data( m_data->Length() );
648  for ( iterator i = m_data->Begin(), j = m_data->End(), k = newData->Begin(); i < j; ++i, ++k )
649  *k = pcl::Sqrt( *i );
650  DetachFromData();
651  m_data = newData;
652  }
653  }
654 
661  {
662  GenericVector R( m_data->Length() );
663  iterator r = R.Begin();
664  for ( const_iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i )
665  *r++ = pcl::Abs( *i );
666  return R;
667  }
668 
675  void SetAbs()
676  {
677  if ( IsUnique() )
678  {
679  for ( iterator i = m_data->Begin(), j = m_data->End(); i < j; ++i )
680  *i = pcl::Abs( *i );
681  }
682  else
683  {
684  Data* newData = new Data( m_data->Length() );
685  for ( iterator i = m_data->Begin(), j = m_data->End(), k = newData->Begin(); i < j; ++i, ++k )
686  *k = pcl::Abs( *i );
687  DetachFromData();
688  m_data = newData;
689  }
690  }
691 
702  double Norm( double p ) const
703  {
704  return pcl::Norm( m_data->Begin(), m_data->End(), p );
705  }
706 
711  double L1Norm() const
712  {
713  return pcl::L1Norm( m_data->Begin(), m_data->End() );
714  }
715 
720  double L2Norm() const
721  {
722  return pcl::L2Norm( m_data->Begin(), m_data->End() );
723  }
724 
729  double Norm() const
730  {
731  return L2Norm();
732  }
733 
739  {
740  GenericVector R( *this );
741  double N = L2Norm();
742  if ( 1 + N > 1 )
743  R /= N;
744  return R;
745  }
746 
751  void SetUnit()
752  {
753  double N = L2Norm();
754  if ( 1 + N > 1 )
755  (void)operator /=( N );
756  }
757 
761  void Sort()
762  {
763  EnsureUnique();
764  pcl::Sort( m_data->Begin(), m_data->End() );
765  }
766 
771  {
772  GenericVector R( *this );
773  R.Sort();
774  return R;
775  }
776 
780  void ReverseSort()
781  {
782  EnsureUnique();
783  pcl::Sort( m_data->Begin(), m_data->End(),
784  []( const scalar& a, const scalar& b ){ return b < a; } );
785  }
786 
791  {
792  GenericVector R( *this );
793  R.ReverseSort();
794  return R;
795  }
796 
803  template <class BP>
804  void Sort( BP p )
805  {
806  EnsureUnique();
807  pcl::Sort( m_data->Begin(), m_data->End(), p );
808  }
809 
814  template <class BP>
815  GenericVector Sorted( BP p ) const
816  {
817  GenericVector R( *this );
818  R.Sort( p );
819  return R;
820  }
821 
826  int Find( const component& x ) const
827  {
828  const_iterator p = pcl::LinearSearch( m_data->Begin(), m_data->End(), x );
829  return (p != m_data->End()) ? int( p - m_data->Begin() ) : -1;
830  }
831 
837  int FindFirst( const component& x ) const
838  {
839  return Find( x );
840  }
841 
846  int FindLast( const component& x ) const
847  {
848  const_iterator p = pcl::LinearSearchLast( m_data->Begin(), m_data->End(), x );
849  return (p != m_data->End()) ? int( p - m_data->Begin() ) : -1;
850  }
851 
855  bool Contains( const component& x ) const
856  {
857  return pcl::LinearSearch( m_data->Begin(), m_data->End(), x ) != m_data->End();
858  }
859 
860 #ifndef __PCL_NO_VECTOR_STATISTICS
861 
870  {
871  return int( pcl::MinItem( m_data->Begin(), m_data->End() ) - m_data->Begin() );
872  }
873 
882  {
883  return int( pcl::MaxItem( m_data->Begin(), m_data->End() ) - m_data->Begin() );
884  }
885 
895  {
896  iterator i = m_data->Begin();
897  if ( m_data->Length() > 0 )
898  for ( iterator j = m_data->Begin(); ++j < m_data->End(); )
899  if ( *j <= *i )
900  i = j;
901  return i - m_data->Begin();
902  }
903 
913  {
914  iterator i = m_data->Begin();
915  if ( m_data->Length() > 0 )
916  for ( iterator j = m_data->Begin(); ++j < m_data->End(); )
917  if ( *i <= *j )
918  i = j;
919  return i - m_data->Begin();
920  }
921 
930  {
931  iterator i = m_data->Begin();
932  if ( m_data->Length() > 0 )
933  for ( iterator j = m_data->Begin(); ++j < m_data->End(); )
934  if ( *j != component( 0 ) )
935  if ( *j < *i )
936  i = j;
937  return i - m_data->Begin();
938  }
939 
949  {
950  iterator i = m_data->Begin();
951  if ( m_data->Length() > 0 )
952  for ( iterator j = m_data->Begin(); ++j < m_data->End(); )
953  if ( *j != component( 0 ) )
954  if ( *j <= *i )
955  i = j;
956  return i - m_data->Begin();
957  }
958 
963  component MinComponent() const
964  {
965  if ( m_data->Length() > 0 )
966  return *pcl::MinItem( m_data->Begin(), m_data->End() );
967  return component( 0 );
968  }
969 
974  component MaxComponent() const
975  {
976  if ( m_data->Length() > 0 )
977  return *pcl::MaxItem( m_data->Begin(), m_data->End() );
978  return component( 0 );
979  }
980 
997  component OrderStatistic( int k )
998  {
999  PCL_PRECONDITION( !IsEmpty() )
1000  PCL_PRECONDITION( k >= 0 && k < m_data->Length() )
1001  EnsureUnique();
1002  return *pcl::Select( m_data->Begin(), m_data->End(), k );
1003  }
1004 
1020  component OrderStatistic( int k ) const
1021  {
1022  return GenericVector( *this ).OrderStatistic( k );
1023  }
1024 
1029  double Sum() const
1030  {
1031  return pcl::Sum( m_data->Begin(), m_data->End() );
1032  }
1033 
1040  double StableSum() const
1041  {
1042  return pcl::StableSum( m_data->Begin(), m_data->End() );
1043  }
1044 
1049  double Modulus() const
1050  {
1051  return pcl::Modulus( m_data->Begin(), m_data->End() );
1052  }
1053 
1060  double StableModulus() const
1061  {
1062  return pcl::StableModulus( m_data->Begin(), m_data->End() );
1063  }
1064 
1069  double SumOfSquares() const
1070  {
1071  return pcl::SumOfSquares( m_data->Begin(), m_data->End() );
1072  }
1073 
1080  double StableSumOfSquares() const
1081  {
1082  return pcl::StableSumOfSquares( m_data->Begin(), m_data->End() );
1083  }
1084 
1089  double Mean() const
1090  {
1091  return pcl::Mean( m_data->Begin(), m_data->End() );
1092  }
1093 
1100  double StableMean() const
1101  {
1102  return pcl::StableMean( m_data->Begin(), m_data->End() );
1103  }
1104 
1110  double Variance() const
1111  {
1112  return pcl::Variance( m_data->Begin(), m_data->End() );
1113  }
1114 
1121  double StdDev() const
1122  {
1123  return pcl::StdDev( m_data->Begin(), m_data->End() );
1124  }
1125 
1138  double Median()
1139  {
1140  EnsureUnique();
1141  return pcl::Median( m_data->Begin(), m_data->End() );
1142  }
1143 
1156  double Median() const
1157  {
1158  return GenericVector( *this ).Median();
1159  }
1160 
1175  double AvgDev( double center ) const
1176  {
1177  return pcl::AvgDev( m_data->Begin(), m_data->End(), center );
1178  }
1179 
1195  double StableAvgDev( double center ) const
1196  {
1197  return pcl::StableAvgDev( m_data->Begin(), m_data->End(), center );
1198  }
1199 
1212  double AvgDev() const
1213  {
1214  return pcl::AvgDev( m_data->Begin(), m_data->End() );
1215  }
1216 
1230  double StableAvgDev() const
1231  {
1232  return pcl::StableAvgDev( m_data->Begin(), m_data->End() );
1233  }
1234 
1246  double MAD( double center ) const
1247  {
1248  return pcl::MAD( m_data->Begin(), m_data->End(), center );
1249  }
1250 
1261  double MAD() const
1262  {
1263  return pcl::MAD( m_data->Begin(), m_data->End() );
1264  }
1265 
1290  double BiweightMidvariance( double center, double sigma, int k = 9 ) const
1291  {
1292  return pcl::BiweightMidvariance( m_data->Begin(), m_data->End(), center, sigma, k );
1293  }
1294 
1313  double BiweightMidvariance( int k = 9 ) const
1314  {
1315  double center = Median();
1316  double sigma = 1.4826*MAD( center );
1317  return pcl::BiweightMidvariance( m_data->Begin(), m_data->End(), center, sigma, k );
1318  }
1319 
1342  double BendMidvariance( double center, double beta = 0.2 ) const
1343  {
1344  return pcl::BendMidvariance( m_data->Begin(), m_data->End(), center, beta );
1345  }
1346 
1366  double BendMidvariance( double beta = 0.2 ) const
1367  {
1368  return pcl::BendMidvariance( m_data->Begin(), m_data->End(), Median(), beta );
1369  }
1370 
1392  double Sn() const
1393  {
1394  GenericVector v( *this );
1395  return pcl::Sn( v.Begin(), v.End() );
1396  }
1397 
1418  double Qn() const
1419  {
1420  GenericVector v( *this );
1421  return pcl::Qn( v.Begin(), v.End() );
1422  }
1423 
1424 #endif // !__PCL_NO_VECTOR_STATISTICS
1425 
1434  uint64 Hash64( uint64 seed = 0 ) const
1435  {
1436  return pcl::Hash64( m_data->Begin(), m_data->Size(), seed );
1437  }
1438 
1447  uint32 Hash32( uint32 seed = 0 ) const
1448  {
1449  return pcl::Hash32( m_data->Begin(), m_data->Size(), seed );
1450  }
1451 
1456  uint64 Hash( uint64 seed = 0 ) const
1457  {
1458  return Hash64( seed );
1459  }
1460 
1464  bool IsUnique() const
1465  {
1466  return m_data->IsUnique();
1467  }
1468 
1473  bool IsAliasOf( const GenericVector& x ) const
1474  {
1475  return m_data == x.m_data;
1476  }
1477 
1486  {
1487  if ( !IsUnique() )
1488  {
1489  Data* newData = new Data( m_data->Length() );
1490  const_iterator a = m_data->Begin();
1491  for ( iterator i = newData->Begin(), j = newData->End(); i < j; ++i, ++a )
1492  *i = component( *a );
1493  DetachFromData();
1494  m_data = newData;
1495  }
1496  }
1497 
1502  int Length() const
1503  {
1504  return m_data->Length();
1505  }
1506 
1511  size_type Size() const
1512  {
1513  return m_data->Size();
1514  }
1515 
1530  bool IsValid() const
1531  {
1532  return m_data != nullptr;
1533  }
1534 
1539  bool IsEmpty() const
1540  {
1541  return Length() == 0;
1542  }
1543 
1549  operator bool() const
1550  {
1551  return !IsEmpty();
1552  }
1553 
1559  bool operator ==( const GenericVector& x ) const
1560  {
1561  return IsAliasOf( x ) || SameLength( x ) && pcl::Equal( Begin(), x.Begin(), x.End() );
1562  }
1563 
1573  bool operator <( const GenericVector& x ) const
1574  {
1575  return !IsAliasOf( x ) && pcl::Compare( Begin(), End(), x.Begin(), x.End() ) < 0;
1576  }
1577 
1581  bool SameLength( const GenericVector& x ) const
1582  {
1583  return Length() == x.Length();
1584  }
1585 
1593  iterator At( int i )
1594  {
1595  EnsureUnique();
1596  return m_data->At( i );
1597  }
1598 
1603  const_iterator At( int i ) const
1604  {
1605  return m_data->At( i );
1606  }
1607 
1618  iterator Begin()
1619  {
1620  EnsureUnique();
1621  return m_data->Begin();
1622  }
1623 
1631  const_iterator Begin() const
1632  {
1633  return m_data->Begin();
1634  }
1635 
1639  const_iterator ConstBegin() const
1640  {
1641  return Begin();
1642  }
1643 
1650  iterator operator *()
1651  {
1652  return Begin();
1653  }
1654 
1661  const_iterator operator *() const
1662  {
1663  return Begin();
1664  }
1665 
1677  iterator End()
1678  {
1679  EnsureUnique();
1680  return m_data->End();
1681  }
1682 
1691  const_iterator End() const
1692  {
1693  return m_data->End();
1694  }
1695 
1699  const_iterator ConstEnd() const
1700  {
1701  return End();
1702  }
1703 
1711  component& operator []( int i )
1712  {
1713  return *At( i );
1714  }
1715 
1720  const component& operator []( int i ) const
1721  {
1722  return *At( i );
1723  }
1724 
1743  iterator DataPtr()
1744  {
1745  return m_data->v;
1746  }
1747 
1758  iterator ComponentPtr( int i )
1759  {
1760  return m_data->At( i );
1761  }
1762 
1763 #ifndef __PCL_NO_STL_COMPATIBLE_ITERATORS
1764 
1767  iterator begin()
1768  {
1769  return Begin();
1770  }
1771 
1775  const_iterator begin() const
1776  {
1777  return Begin();
1778  }
1779 
1783  iterator end()
1784  {
1785  return End();
1786  }
1787 
1791  const_iterator end() const
1792  {
1793  return End();
1794  }
1795 #endif // !__PCL_NO_STL_COMPATIBLE_ITERATORS
1796 
1818  template <typename T1, typename T2>
1819  void ToSpherical( T1& lon, T2& lat ) const
1820  {
1821  PCL_PRECONDITION( Length() >= 3 )
1822  double x = *At( 0 );
1823  double y = *At( 1 );
1824  double z = *At( 2 );
1825  double m2 = x*x + y*y;
1826  lon = T1( (m2 == 0) ? 0.0 : ArcTan( y, x ) );
1827  lat = T2( (z == 0) ? 0.0 : ArcTan( z, pcl::Sqrt( m2 ) ) );
1828  }
1829 
1838  template <typename T1, typename T2>
1839  void ToSpherical2Pi( T1& lon, T2& lat ) const
1840  {
1841  ToSpherical( lon, lat );
1842  if ( lon < 0 )
1843  lon += TwoPi();
1844  }
1845 
1861  static GenericVector FromSpherical( double slon, double clon, double slat, double clat )
1862  {
1863  return GenericVector( clon*clat, slon*clat, slat );
1864  }
1865 
1879  template <typename T1, typename T2>
1880  static GenericVector FromSpherical( const T1& lon, const T2& lat )
1881  {
1882  double slon, clon, slat, clat;
1883  SinCos( double( lon ), slon, clon );
1884  SinCos( double( lat ), slat, clat );
1885  return FromSpherical( slon, clon, slat, clat );
1886  }
1887 
1904  template <class S, typename SP>
1905  S& ToSeparated( S& s, SP separator ) const
1906  {
1907  const_iterator i = m_data->Begin(), j = m_data->End();
1908  if ( i < j )
1909  {
1910  s.Append( S( *i ) );
1911  if ( ++i < j )
1912  do
1913  {
1914  s.Append( separator );
1915  s.Append( S( *i ) );
1916  }
1917  while ( ++i < j );
1918  }
1919  return s;
1920  }
1921 
1944  template <class S, typename SP, class AF>
1945  S& ToSeparated( S& s, SP separator, AF append ) const
1946  {
1947  const_iterator i = m_data->Begin(), j = m_data->End();
1948  if ( i < j )
1949  {
1950  append( s, S( *i ) );
1951  if ( ++i < j )
1952  {
1953  S p( separator );
1954  do
1955  {
1956  append( s, p );
1957  append( s, S( *i ) );
1958  }
1959  while ( ++i < j );
1960  }
1961  }
1962  return s;
1963  }
1964 
1973  template <class S>
1974  S& ToCommaSeparated( S& s ) const
1975  {
1976  return ToSeparated( s, ',' );
1977  }
1978 
1987  template <class S>
1988  S& ToSpaceSeparated( S& s ) const
1989  {
1990  return ToSeparated( s, ' ' );
1991  }
1992 
2001  template <class S>
2002  S& ToTabSeparated( S& s ) const
2003  {
2004  return ToSeparated( s, '\t' );
2005  }
2006 
2007 private:
2008 
2014  struct Data : public ReferenceCounter
2015  {
2016  int n = 0;
2017  component* v = nullptr;
2018 
2019  Data() = default;
2020 
2021  Data( int len )
2022  {
2023  if ( len > 0 )
2024  Allocate( len );
2025  }
2026 
2027  ~Data()
2028  {
2029  Deallocate();
2030  }
2031 
2032  int Length() const
2033  {
2034  return n;
2035  }
2036 
2037  size_type Size() const
2038  {
2039  return size_type( n )*sizeof( component );
2040  }
2041 
2042  iterator At( int i ) const
2043  {
2044  return v + i;
2045  }
2046 
2047  iterator Begin() const
2048  {
2049  return v;
2050  }
2051 
2052  iterator End() const
2053  {
2054  return v + n;
2055  }
2056 
2057  void Allocate( int len )
2058  {
2059  v = new component[ n = len ];
2060  }
2061 
2062  void Deallocate()
2063  {
2064  PCL_PRECONDITION( refCount == 0 )
2065  delete [] v;
2066  v = nullptr;
2067  n = 0;
2068  }
2069  };
2070 
2075  Data* m_data = nullptr;
2076 
2081  void DetachFromData()
2082  {
2083  if ( !m_data->Detach() )
2084  delete m_data;
2085  }
2086 };
2087 
2088 // ----------------------------------------------------------------------------
2089 
2104 template <typename T> inline
2106 {
2107  int n = A.Length();
2108  if ( B.Length() < n )
2109  throw Error( "Invalid vector addition." );
2110  GenericVector<T> R( n );
2111  typename GenericVector<T>::iterator r = R.Begin();
2112  for ( typename GenericVector<T>::const_iterator a = A.Begin(), b = B.Begin(), a1 = A.End(); a < a1; ++a, ++b )
2113  *r++ = *a + *b;
2114  return R;
2115 }
2116 
2124 template <typename T> inline
2126 {
2127  A += B;
2128  return std::move( A );
2129 }
2130 
2138 template <typename T> inline
2140 {
2141  B += A;
2142  return std::move( B );
2143 }
2144 
2153 template <typename T> inline
2155 {
2156  A += B;
2157  return std::move( A );
2158 }
2159 
2164 template <typename T> inline
2166 {
2167  GenericVector<T> R( A.Length() );
2168  typename GenericVector<T>::iterator r = R.Begin();
2169  for ( typename GenericVector<T>::const_iterator a = A.Begin(), a1 = A.End(); a < a1; ++a )
2170  *r++ = *a + x;
2171  return R;
2172 }
2173 
2178 template <typename T> inline
2180 {
2181  A += x;
2182  return std::move( A );
2183 }
2184 
2192 template <typename T> inline
2194 {
2195  return A + x;
2196 }
2197 
2205 template <typename T> inline
2207 {
2208  A += x;
2209  return std::move( A );
2210 }
2211 
2212 // ----------------------------------------------------------------------------
2213 
2221 template <typename T> inline
2223 {
2224  int n = A.Length();
2225  if ( B.Length() < n )
2226  throw Error( "Invalid vector subtraction." );
2227  GenericVector<T> R( n );
2228  typename GenericVector<T>::iterator r = R.Begin();
2229  for ( typename GenericVector<T>::const_iterator a = A.Begin(), b = B.Begin(), a1 = A.End(); a < a1; ++a, ++b )
2230  *r++ = *a - *b;
2231  return R;
2232 }
2233 
2242 template <typename T> inline
2244 {
2245  A -= B;
2246  return std::move( A );
2247 }
2248 
2257 template <typename T> inline
2259 {
2260  if ( A.Length() < B.Length() )
2261  throw Error( "Invalid vector subtraction." );
2262  typename GenericVector<T>::const_iterator a = A.Begin();
2263  for ( typename GenericVector<T>::iterator b = B.Begin(), b1 = B.End(); b < b1; ++a, ++b )
2264  *b = *a - *b;
2265  return std::move( B );
2266 }
2267 
2276 template <typename T> inline
2278 {
2279  A -= B;
2280  return std::move( A );
2281 }
2282 
2287 template <typename T> inline
2289 {
2290  GenericVector<T> R( A.Length() );
2291  typename GenericVector<T>::iterator r = R.Begin();
2292  for ( typename GenericVector<T>::const_iterator a = A.Begin(), a1 = A.End(); a < a1; ++a )
2293  *r++ = *a - x;
2294  return R;
2295 }
2296 
2302 template <typename T> inline
2304 {
2305  A -= x;
2306  return std::move( A );
2307 }
2308 
2317 template <typename T> inline
2319 {
2320  GenericVector<T> R( A.Length() );
2321  typename GenericVector<T>::iterator r = R.Begin();
2322  for ( typename GenericVector<T>::const_iterator a = A.Begin(), a1 = A.End(); a < a1; ++a )
2323  *r++ = x - *a;
2324  return R;
2325 }
2326 
2336 template <typename T> inline
2338 {
2339  for ( typename GenericVector<T>::iterator a = A.Begin(), a1 = A.End(); a < a1; ++a )
2340  *a = x - *a;
2341  return std::move( A );
2342 }
2343 
2344 // ----------------------------------------------------------------------------
2345 
2353 template <typename T> inline
2355 {
2356  PCL_PRECONDITION( A.Length() == 3 && B.Length() == 3 )
2357  return GenericVector<T>( A[1]*B[2] - A[2]*B[1],
2358  A[2]*B[0] - A[0]*B[2],
2359  A[0]*B[1] - A[1]*B[0] );
2360 }
2361 
2369 template <typename T> inline
2371 {
2372  T x = A[1]*B[2] - A[2]*B[1],
2373  y = A[2]*B[0] - A[0]*B[2],
2374  z = A[0]*B[1] - A[1]*B[0];
2375  typename GenericVector<T>::iterator a = A.Begin();
2376  a[0] = x; a[1] = y; a[2] = z;
2377  return std::move( A );
2378 }
2379 
2387 template <typename T> inline
2389 {
2390  T x = A[1]*B[2] - A[2]*B[1],
2391  y = A[2]*B[0] - A[0]*B[2],
2392  z = A[0]*B[1] - A[1]*B[0];
2393  typename GenericVector<T>::iterator b = B.Begin();
2394  b[0] = x; b[1] = y; b[2] = z;
2395  return std::move( B );
2396 }
2397 
2406 template <typename T> inline
2408 {
2409  T x = A[1]*B[2] - A[2]*B[1],
2410  y = A[2]*B[0] - A[0]*B[2],
2411  z = A[0]*B[1] - A[1]*B[0];
2412  typename GenericVector<T>::iterator a = A.Begin();
2413  a[0] = x; a[1] = y; a[2] = z;
2414  return std::move( A );
2415 }
2416 
2417 // ----------------------------------------------------------------------------
2418 
2426 template <typename T> inline
2428 {
2429  PCL_PRECONDITION( B.Length() >= A.Length() )
2430  T r = 0;
2431  for ( typename GenericVector<T>::const_iterator a = A.Begin(), b = B.Begin(), a1 = A.End(); a < a1; ++a, ++b )
2432  r += *a * *b;
2433  return r;
2434 }
2435 
2436 // ----------------------------------------------------------------------------
2437 
2442 template <typename T> inline
2444 {
2445  GenericVector<T> R( A.Length() );
2446  typename GenericVector<T>::iterator r = R.Begin();
2447  for ( typename GenericVector<T>::const_iterator a = A.Begin(), a1 = A.End(); a < a1; ++a )
2448  *r++ = *a * x;
2449  return R;
2450 }
2451 
2456 template <typename T> inline
2458 {
2459  A *= x;
2460  return std::move( A );
2461 }
2462 
2470 template <typename T> inline
2472 {
2473  return A * x;
2474 }
2475 
2483 template <typename T> inline
2485 {
2486  A *= x;
2487  return std::move( A );
2488 }
2489 
2490 // ----------------------------------------------------------------------------
2491 
2496 template <typename T> inline
2498 {
2499  GenericVector<T> R( A.Length() );
2500  typename GenericVector<T>::iterator r = R.Begin();
2501  for ( typename GenericVector<T>::const_iterator a = A.Begin(), a1 = A.End(); a < a1; ++a )
2502  *r++ = *a / x;
2503  return R;
2504 }
2505 
2511 template <typename T> inline
2513 {
2514  A /= x;
2515  return std::move( A );
2516 }
2517 
2525 template <typename T> inline
2527 {
2528  GenericVector<T> R( A.Length() );
2529  typename GenericVector<T>::iterator r = R.Begin();
2530  for ( typename GenericVector<T>::const_iterator a = A.Begin(), a1 = A.End(); a < a1; ++a )
2531  *r++ = x / *a;
2532  return R;
2533 }
2534 
2543 template <typename T> inline
2545 {
2546  for ( typename GenericVector<T>::iterator a = A.Begin(), a1 = A.End(); a < a1; ++a )
2547  *a = x / *a;
2548  return std::move( A );
2549 }
2550 
2556 template <typename T> inline
2558 {
2559  if ( A.Length() > B.Length() )
2560  throw Error( "Invalid vector division." );
2561  GenericVector<T> R( A.Length() );
2562  typename GenericVector<T>::iterator r = R.Begin();
2563  for ( typename GenericVector<T>::const_iterator a = A.Begin(), a1 = A.End(), b = B.Begin(); a < a1; ++a, ++b )
2564  *r++ = *a / *b;
2565  return R;
2566 }
2567 
2573 template <typename T> inline
2575 {
2576  return A /= B;
2577 }
2578 
2579 // ----------------------------------------------------------------------------
2580 
2585 template <typename T> inline
2587 {
2588  GenericVector<T> R( A.Length() );
2589  typename GenericVector<T>::iterator r = R.Begin();
2590  for ( typename GenericVector<T>::const_iterator a = A.Begin(), a1 = A.End(); a < a1; ++a )
2591  *r++ = pcl::Pow( *a, x );
2592  return R;
2593 }
2594 
2600 template <typename T> inline
2602 {
2603  A ^= x;
2604  return std::move( A );
2605 }
2606 
2614 template <typename T> inline
2616 {
2617  GenericVector<T> R( A.Length() );
2618  typename GenericVector<T>::iterator r = R.Begin();
2619  for ( typename GenericVector<T>::const_iterator a = A.Begin(), a1 = A.End(); a < a1; ++a )
2620  *r++ = pcl::Pow( x, *a );
2621  return R;
2622 }
2623 
2632 template <typename T> inline
2634 {
2635  for ( typename GenericVector<T>::iterator a = A.Begin(), a1 = A.End(); a < a1; ++a )
2636  *a = pcl::Pow( x, *a );
2637  return std::move( A );
2638 }
2639 
2640 // ----------------------------------------------------------------------------
2641 
2642 #ifndef __PCL_NO_VECTOR_INSTANTIATE
2643 
2656 
2665 typedef I8Vector CharVector;
2666 
2675 
2684 typedef UI8Vector ByteVector;
2685 
2694 
2703 
2712 
2721 typedef I32Vector IVector;
2722 
2731 
2740 typedef UI32Vector UIVector;
2741 
2750 
2759 
2768 
2777 typedef F32Vector FVector;
2778 
2787 
2796 typedef F64Vector DVector;
2797 
2806 typedef DVector Vector;
2807 
2816 
2825 
2826 #ifndef _MSC_VER
2827 
2840 
2852 typedef F80Vector LDVector;
2853 
2854 #endif // !_MSC_VER
2855 
2856 #endif // !__PCL_NO_VECTOR_INSTANTIATE
2857 
2858 // ----------------------------------------------------------------------------
2859 
2860 } // pcl
2861 
2862 #endif // __PCL_Vector_h
2863 
2864 // ----------------------------------------------------------------------------
2865 // EOF pcl/Vector.h - Released 2019-11-07T10:59:34Z
const_iterator Begin() const
Definition: Vector.h:1631
double L1Norm(const T *i, const T *j)
Definition: Math.h:1960
8-bit signed integer vector.
double Mean(const T *i, const T *j)
Definition: Math.h:2351
16-bit signed integer vector.
GenericVector(const GenericVector &x)
Definition: Vector.h:230
uint64 Hash64(const void *data, size_type size, uint64 seed=0)
Definition: Math.h:3551
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2)
Definition: Complex.h:539
iterator At(int i)
Definition: Vector.h:1593
const_iterator begin() const
Definition: Vector.h:1775
void SetSqrt()
Definition: Vector.h:638
GenericImage< P > operator^(const GenericImage< P > &image, T scalar)
Definition: Image.h:16199
32-bit signed integer vector.
BI LinearSearchLast(BI i, BI j, const T &v)
Definition: Search.h:129
constexpr T ArcTan(T x)
Definition: Math.h:487
Complex< T1 > operator+(const Complex< T1 > &c1, const Complex< T2 > &c2)
Definition: Complex.h:455
void SetUnit()
Definition: Vector.h:751
32-bit floating point complex vector.
32-bit floating point real vector.
double StableSum() const
Definition: Vector.h:1040
double StableAvgDev(const T *i, const T *j, double center)
Definition: Math.h:2770
void Swap(GenericPoint< T > &p1, GenericPoint< T > &p2)
Definition: Point.h:1402
void Transfer(GenericVector &x)
Definition: Vector.h:326
bool IsAliasOf(const GenericVector &x) const
Definition: Vector.h:1473
int IndexOfLastSmallestComponent() const
Definition: Vector.h:894
static GenericVector FromSpherical(double slon, double clon, double slat, double clat)
Definition: Vector.h:1861
double BendMidvariance(double center, double beta=0.2) const
Definition: Vector.h:1342
double Median(T *i, T *j)
Definition: Math.h:2514
int Compare(FI1 i1, FI1 j1, FI2 i2, FI2 j2)
Definition: Utility.h:639
friend void Swap(GenericVector &x1, GenericVector &x2)
Definition: Vector.h:358
double StableSumOfSquares() const
Definition: Vector.h:1080
PCL root namespace.
Definition: AbstractImage.h:76
double Norm(const T *i, const T *j, double p)
Definition: Math.h:1945
double BiweightMidvariance(double center, double sigma, int k=9) const
Definition: Vector.h:1290
32-bit unsigned integer vector.
double Qn(T *x, T *xn)
Definition: Math.h:3186
iterator end()
Definition: Vector.h:1783
uint64 Hash64(uint64 seed=0) const
Definition: Vector.h:1434
64-bit integer vector.
GenericVector ReverseSorted() const
Definition: Vector.h:790
int IndexOfLastLargestComponent() const
Definition: Vector.h:912
FI LinearSearch(FI i, FI j, const T &v)
Definition: Search.h:91
64-bit floating point complex vector.
64-bit floating point real vector.
double Sn() const
Definition: Vector.h:1392
void ToSpherical2Pi(T1 &lon, T2 &lat) const
Definition: Vector.h:1839
void Transfer(GenericVector &&x)
Definition: Vector.h:345
int Length() const
Definition: Vector.h:1502
GenericVector Unit() const
Definition: Vector.h:738
Complex< T > Sqrt(const Complex< T > &c)
Definition: Complex.h:665
80-bit extended precision floating point real vector.
FI MaxItem(FI i, FI j)
Definition: Utility.h:479
double BiweightMidvariance(const T *x, const T *xn, double center, double sigma, int k=9)
Definition: Math.h:3343
double BiweightMidvariance(int k=9) const
Definition: Vector.h:1313
GenericVector Abs() const
Definition: Vector.h:660
void ToSpherical(T1 &lon, T2 &lat) const
Definition: Vector.h:1819
void Sort(BI i, BI j)
Definition: Sort.h:534
GenericVector(const T1 &x, const T1 &y, const T1 &z)
Definition: Vector.h:202
void ReverseSort()
Definition: Vector.h:780
iterator ComponentPtr(int i)
Definition: Vector.h:1758
80-bit extended precision floating point real vector.
double Sum(const T *i, const T *j)
Definition: Math.h:2215
bool Equal(FI1 i1, FI2 i2, FI2 j2)
Definition: Utility.h:592
double StableAvgDev(double center) const
Definition: Vector.h:1195
double MAD() const
Definition: Vector.h:1261
GenericVector(GenericVector &&x)
Definition: Vector.h:238
const_iterator end() const
Definition: Vector.h:1791
Generic vector of arbitrary length.
Definition: Vector.h:106
double StableMean(const T *i, const T *j)
Definition: Math.h:2370
iterator begin()
Definition: Vector.h:1767
GenericVector(const component &x, int len)
Definition: Vector.h:158
double BendMidvariance(double beta=0.2) const
Definition: Vector.h:1366
double Variance() const
Definition: Vector.h:1110
size_t size_type
Definition: Defs.h:543
double Variance(const T *i, const T *j, double center)
Definition: Math.h:2395
GenericVector Sqrt() const
Definition: Vector.h:623
component OrderStatistic(int k) const
Definition: Vector.h:1020
iterator DataPtr()
Definition: Vector.h:1743
double Norm(double p) const
Definition: Vector.h:702
GenericVector(const T1 *a, int len)
Definition: Vector.h:176
8-bit unsigned integer vector.
int IndexOfLargestComponent() const
Definition: Vector.h:881
RI Select(RI i, RI j, distance_type k)
Definition: Selection.h:165
T Abs(const Complex< T > &c)
Definition: Complex.h:420
double StableSum(const T *i, const T *j)
Definition: Math.h:2234
double StableModulus() const
Definition: Vector.h:1060
unsigned long long uint64
Definition: Defs.h:616
double MAD(const T *i, const T *j, double center)
Definition: Math.h:2865
static GenericVector FromSpherical(const T1 &lon, const T2 &lat)
Definition: Vector.h:1880
GenericVector Sorted(BP p) const
Definition: Vector.h:815
8-bit signed integer vector.
64-bit floating point real vector.
double Mean() const
Definition: Vector.h:1089
double StableSumOfSquares(const T *i, const T *j)
Definition: Math.h:2325
double AvgDev() const
Definition: Vector.h:1212
Complex< T1 > operator-(const Complex< T1 > &c1, const Complex< T2 > &c2)
Definition: Complex.h:495
GenericVector Sorted() const
Definition: Vector.h:770
void Assign(const GenericVector &x)
Definition: Vector.h:296
double Qn() const
Definition: Vector.h:1418
double SumOfSquares() const
Definition: Vector.h:1069
32-bit unsigned integer vector.
uint64 Hash(uint64 seed=0) const
Definition: Vector.h:1456
uint32 Hash32(const void *data, size_type size, uint32 seed=0)
Definition: Math.h:3699
64-bit unsigned integer components.
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2)
Definition: Array.h:2086
void Sort(BP p)
Definition: Vector.h:804
component MaxComponent() const
Definition: Vector.h:974
double StableMean() const
Definition: Vector.h:1100
int FindFirst(const component &x) const
Definition: Vector.h:837
double Modulus() const
Definition: Vector.h:1049
A simple exception with an associated error message.
Definition: Exception.h:213
uint32 Hash32(uint32 seed=0) const
Definition: Vector.h:1447
double L2Norm(const T *i, const T *j)
Definition: Math.h:1974
bool IsUnique() const
Definition: Vector.h:1464
64-bit floating point real vector.
16-bit unsigned integer vector.
const sample * * const_iterator
Definition: Vector.h:128
virtual ~GenericVector()
Definition: Vector.h:248
int Find(const component &x) const
Definition: Vector.h:826
int IndexOfSmallestComponent() const
Definition: Vector.h:869
GenericVector Sqr() const
Definition: Vector.h:586
double BendMidvariance(const T *x, const T *xn, double center, double beta=0.2)
Definition: Math.h:3402
const_iterator At(int i) const
Definition: Vector.h:1603
int FindLast(const component &x) const
Definition: Vector.h:846
Root base class of all PCL containers of objects.
Definition: Container.h:77
8-bit unsigned integer vector.
double Sn(T *x, T *xn)
Definition: Math.h:2939
FI MinItem(FI i, FI j)
Definition: Utility.h:441
double MAD(double center) const
Definition: Vector.h:1246
void SinCos(T x, T &sx, T &cx)
Definition: Math.h:938
bool SameLength(const GenericVector &x) const
Definition: Vector.h:1581
double Norm() const
Definition: Vector.h:729
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2)
Definition: Array.h:2075
Complex< T1 > operator/(const Complex< T1 > &c1, const Complex< T2 > &c2)
Definition: Complex.h:583
double AvgDev(double center) const
Definition: Vector.h:1175
int IndexOfLastSmallestNonzeroComponent() const
Definition: Vector.h:948
double Modulus(const T *i, const T *j)
Definition: Math.h:2259
32-bit signed integer vector.
GenericVector(std::initializer_list< T1 > c)
Definition: Vector.h:193
double StdDev() const
Definition: Vector.h:1121
double L2Norm() const
Definition: Vector.h:720
GenericVector(int len)
Definition: Vector.h:147
iterator End()
Definition: Vector.h:1677
bool IsEmpty() const
Definition: Vector.h:1539
double SumOfSquares(const T *i, const T *j)
Definition: Math.h:2303
iterator Begin()
Definition: Vector.h:1618
constexpr long double TwoPi()
Definition: Math.h:431
double L1Norm() const
Definition: Vector.h:711
const_iterator ConstBegin() const
Definition: Vector.h:1639
const_iterator End() const
Definition: Vector.h:1691
32-bit floating point real vector.
double StableModulus(const T *i, const T *j)
Definition: Math.h:2278
double Median() const
Definition: Vector.h:1156
bool Contains(const component &x) const
Definition: Vector.h:855
unsigned int uint32
Definition: Defs.h:600
double Median()
Definition: Vector.h:1138
GenericVector(const T1 &x, const T1 &y, const T1 &z, const T1 &t)
Definition: Vector.h:216
bool IsValid() const
Definition: Vector.h:1530
Thread-safe reference counter for copy-on-write data structures.
int IndexOfSmallestNonzeroComponent() const
Definition: Vector.h:929
Complex< T1 > Pow(const Complex< T1 > &c, T2 x)
Definition: Complex.h:738
double Sum() const
Definition: Vector.h:1029
double StdDev(const T *i, const T *j, double center)
Definition: Math.h:2453
component OrderStatistic(int k)
Definition: Vector.h:997
component MinComponent() const
Definition: Vector.h:963
double AvgDev(const T *i, const T *j, double center)
Definition: Math.h:2739
void EnsureUnique()
Definition: Vector.h:1485
const_iterator ConstEnd() const
Definition: Vector.h:1699
size_type Size() const
Definition: Vector.h:1511
double StableAvgDev() const
Definition: Vector.h:1230