亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? matrix.cpp

?? 攝影測(cè)量專業(yè)。實(shí)現(xiàn)單像后方交會(huì)以及立體像對(duì)的前方交會(huì)。以文件形式讀取控制點(diǎn)和像點(diǎn)坐標(biāo)。
?? CPP
?? 第 1 頁 / 共 5 頁
字號(hào):

/**
\file     Matrix.h
\brief    The Zenautics Matrix Class
\author   Glenn D. MacGougan (GDM)
\date     2008-09-22
\version  0.06 Beta

\b Version \b Information \n
This is the open source version (BSD license). The Professional Version
is avaiable via http://www.zenautics.com. The Professional Version
is highly optimized using SIMD and includes optimization for multi-core
processors.

\b License \b Information \n
Copyright (c) 2008, Glenn D. MacGougan, Zenautics Technologies Inc. \n

Redistribution and use in source and binary forms, with or without
modification, of the specified files is permitted provided the following 
conditions are met: \n

- Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer. \n
- Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution. \n
- The name(s) of the contributor(s) may not be used to endorse or promote 
  products derived from this software without specific prior written 
  permission. \n

THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGE.

\b NOTES: \n
This code was developed using rigourous unit testing for every function 
and operation. Despite any rigorous development process, bugs are
inevitable. Please report bugs and suggested fixes to glenn @ zenautics.com.\n

\b Preprocessor Defines \n
The implementation of exception handling and the use of namespace is
not standardized among older compilers, the following deines may be 
necessary. \n
#define _MATRIX_NO_NAMESPACE // removes namespace support. \n
#define _MATRIX_NO_EXCEPTION // removes exception handling support. \n
*/

#include <stdlib.h>
#include <string.h>

#include "Matrix.h"
#include "cmatrix.h"

// deal with msvc empty projects
#ifndef WIN32
  #ifdef _WIN32
    #define WIN32
  #endif
#endif

#ifndef WIN32
#define _CRT_SECURE_NO_DEPRECATE
#endif


#ifndef DEG2RAD
#define DEG2RAD   (0.017453292519943295769236907684886)  //!< PI/180.0
#endif

#ifndef RAD2DEG
#define RAD2DEG   (57.295779513082320876798154814105)    //!< 180.0/PI
#endif

namespace Zenautics
{
  /// A static double  value used for bad referencing. i.e. give me element 10 of 1x9 vector.
  static double staticglobal_BadDouble = 0.0;

  // A boolean used to ensure initialization of the mtx engine.
  bool Matrix::m_IsMTXInitialized = false;


#ifndef _MATRIX_NO_EXCEPTION

  MatrixException::MatrixException( const char* msg )
  {
    unsigned msgLength = 0;
    if( msg == NULL )
    {
#ifndef _CRT_SECURE_NO_DEPRECATE
      strcpy_s( m_msg, 256, "Unknown Matrix Exception" );
#else
      strcpy( m_msg, "Unknown Matrix Exception" );
#endif
    }
    else
    {
      msgLength = (unsigned)strlen( msg );
      // note 255 here, not 256, 
      // just in case msgLength is 255 and we add '\0' to the end of m_msg.
#ifndef _CRT_SECURE_NO_DEPRECATE
      if( msgLength < 255 )
      {
        strncpy_s( m_msg, 256, msg, msgLength );
        m_msg[msgLength] = '\0';
      }
      else
      {
        strncpy_s( m_msg, 256, msg, 255 );
        m_msg[255] = '\0';
      }
#else
      if( msgLength < 255 )
      {
        strncpy( m_msg, msg, msgLength );
        m_msg[msgLength] = '\0';
      }
      else
      {
        strncpy( m_msg, msg, 255 );
        m_msg[255] = '\0';
      }
#endif
    }
    m_ExceptionString = m_msg;
  }

  MatrixException::MatrixException(const MatrixException& matrix_exception)
  {
    // This will copy only the matrix exception string.
    m_ExceptionString = matrix_exception.m_ExceptionString;
  }

  std::string MatrixException::GetExceptionMessage()
  {
    return m_ExceptionString;
  }

  MatrixException::operator const char*()
  {
    return m_ExceptionString.c_str();
  }
#endif


  // default constructor
  Matrix::Matrix()
    :m_MatrixElement(m_Matrix)
  {
    if( !m_IsMTXInitialized )
    {
      if( !MTX_Initialize_MTXEngine() )
      {
        m_IsMTXInitialized = false;
        MatrixError( "Matrix", "Failed to initialize the MTX Engine." );
      }
      else
      {
        m_IsMTXInitialized = true;
      }
    }

    MTX_Init( &m_Matrix );
  }


  // destructor
  Matrix::~Matrix()
  { 
    if( !MTX_Free( &m_Matrix ) )
    {
      MatrixError( "~Matrix", "Unable to free memory properly" );
    }
  }


  // vector style constructor
  Matrix::Matrix( const unsigned nrows )
    :m_MatrixElement(m_Matrix)
  { 
    if( !m_IsMTXInitialized )
    {
      if( !MTX_Initialize_MTXEngine() )
      {
        m_IsMTXInitialized = false;
        MatrixError( "Matrix", "Failed to initialize the MTX Engine." );
      }
      else
      {
        m_IsMTXInitialized = true;
      }
    }

    MTX_Init( &m_Matrix );
    if( !MTX_Calloc( &m_Matrix, nrows, 1, true ) )
    {
      char msg[128];
#ifndef _CRT_SECURE_NO_DEPRECATE
      sprintf_s( msg, 128, "Unable to allocate enough memory for Matrix as vector(%d)", nrows );
#else
      sprintf( msg, "Unable to allocate enough memory for Matrix as vector(%d)", nrows );
#endif
      MatrixError( "Matrix", msg );
    }
  }


  // matrix style constructor
  Matrix::Matrix( const unsigned nrows, const unsigned ncols, const bool isReal )
    :m_MatrixElement(m_Matrix)
  { 
    if( !m_IsMTXInitialized )
    {
      if( !MTX_Initialize_MTXEngine() )
      {
        m_IsMTXInitialized = false;
        MatrixError( "Matrix", "Failed to initialize the MTX Engine." );
      }
      else
      {
        m_IsMTXInitialized = true;
      }
    }

    MTX_Init( &m_Matrix );
    if( !MTX_Calloc( &m_Matrix, nrows, ncols, isReal ) )
    {
      char msg[128];
#ifndef _CRT_SECURE_NO_DEPRECATE
      if( isReal )
        sprintf_s( msg, 128, "Unable to allocate enough memory for Matrix(%d,%d)", nrows, ncols );
      else
        sprintf_s( msg, 128, "Unable to allocate enough memory for complex Matrix(%d,%d)", nrows, ncols );
#else
      if( isReal )
        sprintf( msg, "Unable to allocate enough memory for Matrix(%d,%d)", nrows, ncols );
      else
        sprintf( msg, "Unable to allocate enough memory for complex Matrix(%d,%d)", nrows, ncols );
#endif

      MatrixError( "Matrix", msg );
    }
  }


  // constructor reading data from file   
  Matrix::Matrix( const char* path, bool& itWorked )
    :m_MatrixElement(m_Matrix)
  {
    if( !m_IsMTXInitialized )
    {
      if( !MTX_Initialize_MTXEngine() )
      {
        m_IsMTXInitialized = false;
        MatrixError( "Matrix", "Failed to initialize the MTX Engine." );
      }
      else
      {
        m_IsMTXInitialized = true;
      }
    }

    MTX_Init( &m_Matrix );

    if( MTX_ReadFromFile( &m_Matrix, path ) )
      itWorked = true;
    else
      itWorked = false;  
  }

  // copy constructor
  Matrix::Matrix( const Matrix& mat )
    :m_MatrixElement(m_Matrix)
  {
    MTX_Init( &m_Matrix );
    if( !MTX_Copy( &(mat.m_Matrix), &m_Matrix ) )
    {
      MatrixError( "Matrix", "Copy constructor failed to copy input matrix." );
    }
  }

  // copy from a static matrix
  Matrix::Matrix(const double mat[], const unsigned nrows, const unsigned ncols )
    :m_MatrixElement(m_Matrix)
  {
    MTX_Init( &m_Matrix );
    if( mat == NULL )
    {
      MatrixError( "Matrix", "Input static double array(matrix) pointer is NULL" );
    }
    if( !MTX_SetFromStaticMatrix( &m_Matrix, mat, nrows, ncols ) )
    {
      MatrixError( "Matrix", "Failed to set the matrix from a static double array(matrix)" );
    }
  }

  // copy from a matrix string 
  Matrix::Matrix(const char* strMatrix)
    :m_MatrixElement(m_Matrix)
  {
    MTX_Init( &m_Matrix );
    if( !MTX_SetFromMatrixString( &m_Matrix, strMatrix ) )
    {
      MatrixError( "Matrix = \"string matrix\"", "Unable to set matrix from the string specified." );
    }    
  }


  // assignment operator (constructor)
  Matrix& Matrix::operator= (const Matrix& mat)
  {
    // trap assignment to self
    if( this == &mat )
      return *this;

    if( !MTX_Copy( &mat.m_Matrix, &m_Matrix ) )
    {
      MatrixError( "operator=", "Failed to copy input matrix" );
    }

    return *this;
  }


  Matrix& Matrix::operator= (const double value)
  {
    if( !MTX_Malloc( &m_Matrix, 1, 1, true ) )
    {
      MatrixError( "operator=double", "Unable to redimension to 1x1." );
    }

    if( !MTX_SetValue( &m_Matrix, 0, 0, value ) )
    {
      MatrixError( "operator=double", "Unable to set double value." );
    }

    return *this;
  }

  Matrix& Matrix::operator= (const std::complex<double> value)
  {
    if( !MTX_Malloc( &m_Matrix, 1, 1, false ) )
    {
      MatrixError( "operator=std::complex<double>", "Unable to redimension to 1x1." );
    }

    if( !MTX_SetComplexValue( &m_Matrix, 0, 0, value.real(), value.imag() ) )
    {
      MatrixError( "operator=std::complex<double>", "Unable to set the value." );
    }

    return *this;
  }

  Matrix& Matrix::operator=(const char* strMatrix)
  {
    if( !MTX_SetFromMatrixString( &m_Matrix, strMatrix ) )
    {
      MatrixError( "operator=string", "Unable to set matrix from the string specified." );
    }
    return *this;
  }

  bool Matrix::Clear()
  {
    if( MTX_Free( &m_Matrix ) )
    {
      return true;
    }
    else
    {
      MTX_ERROR_MSG( "MTX_FREE returned false." );
      return false;    
    }
  }

  void Matrix::MatrixError( const char* error )
  {
    Clear();
    StaticMatrixError( error );
  }

  void Matrix::MatrixError( const char* function, const char* error )
  {
    Clear();
    StaticMatrixError( function, error );
  }


  // static
  void Matrix::StaticMatrixError( const char* error )
  {
    StaticMatrixError( "", error );
  }

  // static
  void Matrix::StaticMatrixError( const char* function, const char* error )
  {
    char msg[256];
#ifndef _CRT_SECURE_NO_DEPRECATE
    if( strstr(function,"operator") != NULL )
      sprintf_s( msg, 256, "\nMatrix::%s, Error:\n%s\n", function, error );   
    else
      sprintf_s( msg, 256, "\nMatrix::%s(), Error:\n%s\n", function, error );
#else
    if( strstr(function,"operator") != NULL )
      sprintf( msg, "\nMatrix::%s, Error:\n%s\n", function, error );   
    else
      sprintf( msg, "\nMatrix::%s(), Error:\n%s\n", function, error );
#endif

#ifndef _MATRIX_NO_EXCEPTION

    throw MatrixException(msg);
    return;

#else

    printf( "%s\r\n", msg );   

    // no choice but to call exit!
    exit(1);

#endif    
  }


  bool Matrix::isEmpty() const
  {
    if( MTX_isNull( &m_Matrix ) )
    {
      return true;
    }
    else
    {
      return false;
    }
  }

  bool Matrix::isConformal(const Matrix& mat) const
  {
    if( MTX_isConformalForMultiplication( &m_Matrix, &mat.m_Matrix ) )
    {
      return true;
    }
    else
    {
      MTX_ERROR_MSG( "MTX_isConformalForMultiplication returned false." );
      return false;
    }
  }

  bool Matrix::isSameSize(const Matrix& mat) const
  {
    if( MTX_isSameSize( &m_Matrix, &mat.m_Matrix ) )
    {
      return true;
    }
    else 
    {
      MTX_ERROR_MSG( "MTX_isSameSize returned false." );
      return false;
    }
  }

  bool Matrix::isSquare() const
  {
    if( MTX_isSquare( &m_Matrix ) )
    {
      return true;
    }
    else 
    {
      MTX_ERROR_MSG( "MTX_isSquare returned false." );
      return false;
    }
  }

  unsigned  Matrix::GetNrCols() const
  {
    return m_Matrix.ncols;
  }

  unsigned  Matrix::ncols() const
  {
    return m_Matrix.ncols;
  }

  unsigned Matrix::GetNrElems() const
  {
    return m_Matrix.ncols*m_Matrix.nrows;
  }

  unsigned Matrix::nelems() const
  {
    return m_Matrix.ncols*m_Matrix.nrows;
  }

  unsigned Matrix::GetNrRows() const
  {
    return m_Matrix.nrows;
  }

  unsigned Matrix::nrows() const
  {
    return m_Matrix.nrows;
  }

  unsigned Matrix::GetLength() const
  {
    if( m_Matrix.nrows > m_Matrix.ncols )
      return m_Matrix.nrows;
    else
      return m_Matrix.ncols;
  }

  double Matrix::real(const unsigned row, const unsigned col)
  {
    if( IndexCheck(row,col) )
    {
      if( m_Matrix.isReal )
      {
        return m_Matrix.data[col][row];
      }
      else
      {
        return m_Matrix.cplx[col][row].re;
      }
    }
    else
    {
      return 0.0;
    }
  }

  double Matrix::real(const unsigned index)
  {
    unsigned row = 0;
    unsigned col = 0;

    if( IndexCheck(index) )
    {
      if( m_Matrix.ncols == 1 )
      {
        row = index;
      }
      else if( m_Matrix.nrows == 1 )
      {
        col = index;
      }
      else
      {
        // access the matrix as a singular column array
        col = index / m_Matrix.nrows;
        row = index - col*m_Matrix.nrows;
      }
      if( m_Matrix.isReal )
      {
        return m_Matrix.data[col][row];
      }
      else
      {
        return m_Matrix.cplx[col][row].re;
      }
    }
    else
    {
      return 0.0;
    }
  }

  double Matrix::imag(const unsigned row, const unsigned col)
  {
    if( IndexCheck(row,col) )
    {
      if( m_Matrix.isReal )
      {
        return 0.0;
      }
      else
      {
        return m_Matrix.cplx[col][row].im;
      }
    }
    else
    {
      return 0.0;
    }
  }

  double Matrix::imag(const unsigned index)
  {
    unsigned row = 0;
    unsigned col = 0;

    if( IndexCheck(index) )
    {
      if( m_Matrix.ncols == 1 )
      {
        row = index;
      }
      else if( m_Matrix.nrows == 1 )
      {
        col = index;
      }
      else
      {
        // access the matrix as a singular column array
        col = index / m_Matrix.nrows;
        row = index - col*m_Matrix.nrows;
      }
      if( m_Matrix.isReal )

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美三级资源在线| 国产精品一区一区| 欧美丝袜丝交足nylons| 洋洋成人永久网站入口| 欧美在线观看视频一区二区| 亚洲不卡在线观看| 日韩欧美成人激情| 狠狠网亚洲精品| 欧美国产97人人爽人人喊| 成人综合在线网站| 欧美国产在线观看| 色先锋资源久久综合| 亚洲va国产天堂va久久en| 日韩欧美专区在线| 国产精品99久久久久| 国产精品的网站| 欧美日韩国产乱码电影| 久久99精品久久久| 日韩久久一区二区| 欧美精品一级二级| 国产91色综合久久免费分享| 一区二区三区日韩在线观看| 宅男在线国产精品| 风流少妇一区二区| 亚洲电影在线免费观看| 久久久亚洲高清| 色老汉av一区二区三区| 麻豆成人91精品二区三区| 国产精品午夜电影| 在线成人午夜影院| 国产·精品毛片| 丝袜美腿一区二区三区| 国产欧美精品一区aⅴ影院| 日本丶国产丶欧美色综合| 奇米色一区二区| 亚洲乱码中文字幕综合| 欧美成人aa大片| 欧美在线免费观看视频| 国产一区二区免费看| 亚洲妇女屁股眼交7| 国产精品久久看| 欧美电视剧免费观看| 91久久精品日日躁夜夜躁欧美| 麻豆国产欧美一区二区三区| 亚洲欧美日韩中文播放| 欧美精品一区二区精品网| 欧美三区在线观看| 色综合天天综合色综合av| 极品瑜伽女神91| 日韩中文字幕一区二区三区| 亚洲欧美视频在线观看视频| 国产女人水真多18毛片18精品视频| 欧美日韩视频在线一区二区| av一区二区三区黑人| 国产一区二区调教| 久久精品国产久精国产| 午夜亚洲国产au精品一区二区| 国产精品视频在线看| 精品成人一区二区三区四区| 欧美一区二区免费观在线| 在线观看精品一区| 91精品1区2区| 91老师国产黑色丝袜在线| 成人精品电影在线观看| 国产久卡久卡久卡久卡视频精品| 欧美bbbbb| 日本不卡的三区四区五区| 午夜精品爽啪视频| 亚洲国产精品精华液网站| 亚洲欧美成人一区二区三区| 国产精品免费观看视频| 日本一区二区三区国色天香 | 成人精品视频一区| 国产精品99久久久久久有的能看 | 麻豆成人综合网| 蜜桃视频在线一区| 日韩激情视频在线观看| 天天爽夜夜爽夜夜爽精品视频| 一区二区三区毛片| 一区av在线播放| 亚洲电影一级片| 日日夜夜精品视频天天综合网| 亚洲国产成人精品视频| 日本欧美肥老太交大片| 男人的天堂久久精品| 九九热在线视频观看这里只有精品| 美国av一区二区| 久久不见久久见中文字幕免费| 久久99最新地址| 国产精品99久| 99视频一区二区| 在线观看一区二区视频| 欧美日韩久久一区| 日韩美一区二区三区| 国产亚洲欧美日韩日本| 中文字幕国产一区| 一区二区三区.www| 偷窥少妇高潮呻吟av久久免费| 日韩成人精品在线| 国产在线精品一区在线观看麻豆| 国产激情91久久精品导航| 99re热这里只有精品视频| 精品视频1区2区| 91精品国产综合久久香蕉的特点| 精品国产一二三区| 国产精品美女一区二区| 亚洲国产精品自拍| 狠狠狠色丁香婷婷综合激情| 99久久久久久99| 欧美一区二区三区免费| 国产欧美精品一区二区色综合朱莉| 亚洲蜜臀av乱码久久精品蜜桃| 视频在线观看一区二区三区| 国产一区二区三区免费看| 91视视频在线直接观看在线看网页在线看| 欧美三级视频在线播放| 久久精品一区四区| 亚洲国产你懂的| 成人美女在线观看| 欧美日韩在线播放| 中文字幕免费观看一区| 午夜精品久久久久久| 成人激情免费网站| 91精品欧美久久久久久动漫| 欧美经典三级视频一区二区三区| 午夜视黄欧洲亚洲| 91丨porny丨国产| 国产日韩欧美一区二区三区乱码| 亚洲国产日韩在线一区模特| 福利一区二区在线观看| 日韩欧美一区二区在线视频| 亚洲私人影院在线观看| 黄网站免费久久| 欧美精品日韩综合在线| 亚洲欧美日韩在线| 丰满岳乱妇一区二区三区| 9191成人精品久久| 一区二区理论电影在线观看| 国产高清在线精品| 欧美精品一区二区三区蜜臀 | 精品国产乱码久久久久久久久 | 久久久精品综合| 日韩av电影免费观看高清完整版在线观看 | 国产麻豆成人传媒免费观看| 欧美日韩专区在线| 自拍偷拍国产精品| 国产成人鲁色资源国产91色综| 欧美一区国产二区| 五月天一区二区| 欧美自拍丝袜亚洲| 亚洲免费av在线| 91天堂素人约啪| 一区在线观看视频| 成人动漫av在线| 国产精品视频九色porn| 国产精品亚洲第一区在线暖暖韩国| 欧美成人精品福利| 七七婷婷婷婷精品国产| 欧美一区二区三区的| 久久精品噜噜噜成人av农村| 欧美一区二区三区人| 免费精品99久久国产综合精品| 在线不卡一区二区| 亚洲不卡av一区二区三区| 欧美三级三级三级爽爽爽| 午夜亚洲国产au精品一区二区| 欧美日韩国产影片| 偷拍一区二区三区| 91精品国产综合久久久久久久| 婷婷综合久久一区二区三区| 欧美日韩成人在线一区| 日日夜夜精品视频天天综合网| 欧美一区午夜视频在线观看| 日韩av在线发布| 久久青草国产手机看片福利盒子| 韩国一区二区在线观看| 久久精品男人的天堂| 成人白浆超碰人人人人| 亚洲蜜臀av乱码久久精品| 欧美日韩激情在线| 久久9热精品视频| 国产精品欧美久久久久一区二区| 成人国产精品免费网站| 一区二区三区四区在线免费观看 | 亚洲蜜臀av乱码久久精品| 欧美亚洲综合在线| 麻豆精品国产91久久久久久| 国产亚洲欧美日韩日本| 色综合久久久久网| 青青草成人在线观看| 国产亚洲精品超碰| 在线中文字幕一区二区| 日本亚洲最大的色成网站www| 久久久久久久久伊人| 92精品国产成人观看免费| 亚洲国产日韩av| 国产校园另类小说区| 在线看日韩精品电影| 久久精品国产免费看久久精品| 国产精品午夜免费|