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

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

?? matrix.cpp

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

/**
\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
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一二三四在线| 日韩欧美123| 色88888久久久久久影院按摩 | 在线中文字幕一区| 成人黄色免费短视频| 懂色av一区二区三区蜜臀| 精品无人区卡一卡二卡三乱码免费卡| 偷拍一区二区三区| 五月天网站亚洲| 日韩vs国产vs欧美| 日本欧美一区二区三区| 美国精品在线观看| 国产一区二区在线观看免费| 国产一区二区三区av电影 | 99re视频精品| 91黄色激情网站| 欧美精品视频www在线观看| 欧美福利视频一区| 日韩一卡二卡三卡四卡| 精品少妇一区二区三区在线播放| 精品国产网站在线观看| 国产日产欧美一区二区视频| 亚洲欧洲在线观看av| 亚洲青青青在线视频| 亚洲综合自拍偷拍| 青草av.久久免费一区| 久久国产精品99精品国产| 国产精品亚洲午夜一区二区三区| 69久久夜色精品国产69蝌蚪网| 欧美顶级少妇做爰| 久久精品亚洲精品国产欧美 | 亚洲精品国产第一综合99久久| 亚洲影院免费观看| 久久草av在线| 成人av在线一区二区三区| 在线观看视频91| 欧美tickling挠脚心丨vk| 国产女主播视频一区二区| 一区二区三区视频在线看| 青草国产精品久久久久久| 成人白浆超碰人人人人| 欧美三级资源在线| 久久九九久久九九| 亚洲一区二区三区四区在线观看| 毛片av一区二区三区| 成人精品小蝌蚪| 欧美理论在线播放| 亚洲国产成人在线| 婷婷久久综合九色综合绿巨人 | 欧美日韩高清不卡| 精品电影一区二区| 亚洲精品国产a| 久久精品久久99精品久久| 99久久久免费精品国产一区二区| 欧美日韩国产精品自在自线| 久久人人97超碰com| 尤物视频一区二区| 国产成人在线电影| 欧美日韩电影一区| 国产精品国产馆在线真实露脸| 一本大道av一区二区在线播放| 欧美日韩国产片| 国产女同互慰高潮91漫画| 日韩av中文字幕一区二区三区| 大美女一区二区三区| 欧美一区二区三区四区久久| 亚洲精品精品亚洲| 高清av一区二区| 日韩精品一区二区三区在线| 亚洲一级二级三级在线免费观看| 春色校园综合激情亚洲| 91精品国产黑色紧身裤美女| 自拍视频在线观看一区二区| 精品无码三级在线观看视频| 欧美久久久久久久久久| 亚洲免费在线看| 成人激情校园春色| 久久综合给合久久狠狠狠97色69| 亚洲国产视频网站| 91年精品国产| 国产精品无人区| 久久99在线观看| 欧美一区二区三区在| 亚洲3atv精品一区二区三区| 91丨porny丨中文| 国产精品久久久久影视| 国产专区欧美精品| 亚洲精品一区二区三区在线观看 | 色综合色综合色综合色综合色综合 | 欧美午夜片在线看| 国产精品久久看| 国产成人日日夜夜| 久久久久高清精品| 国产一区二区三区在线观看免费| 亚洲一二三区在线观看| 99久久精品免费看国产| 中文字幕一区二区三区在线播放 | 韩国av一区二区三区| 欧美一二三在线| 日本视频免费一区| 日韩欧美国产高清| 国模无码大尺度一区二区三区| 精品福利视频一区二区三区| 麻豆精品一区二区av白丝在线| 欧美大片日本大片免费观看| 精品无人区卡一卡二卡三乱码免费卡| 精品久久人人做人人爽| 国产一区不卡在线| 国产无人区一区二区三区| 粉嫩av亚洲一区二区图片| 国产精品久久久久影院亚瑟| 91小视频在线观看| 亚洲午夜成aⅴ人片| 在线播放视频一区| 久久精品久久精品| 中文字幕乱码久久午夜不卡 | 欧美日韩国产bt| 日韩二区在线观看| 精品久久久久久无| 国产成人亚洲综合a∨婷婷| 日韩美女久久久| 欧美在线观看视频一区二区三区| 亚洲午夜精品久久久久久久久| 欧美一区二区视频在线观看2022 | 91精品国产综合久久久久久久久久| 91成人在线精品| 五月婷婷欧美视频| 精品第一国产综合精品aⅴ| 国产v日产∨综合v精品视频| 国产精品久99| 欧美日韩国产首页| 国产精品自拍毛片| 亚洲视频小说图片| 欧美精品亚洲二区| 国产高清不卡一区| 亚洲高清免费在线| 久久久精品国产99久久精品芒果 | 日韩欧美国产一区二区在线播放| 国产精品99久久久久久似苏梦涵 | 青青草91视频| 欧美国产日韩精品免费观看| 欧美中文字幕亚洲一区二区va在线 | 中文字幕av免费专区久久| 日本精品一区二区三区四区的功能| 亚洲成a人v欧美综合天堂| 精品国产乱码久久久久久久| av激情综合网| 日韩不卡一二三区| 中文字幕一区二区三区四区| 在线视频一区二区三区| 久久精品国产澳门| 中文字幕综合网| 精品欧美乱码久久久久久| 色天天综合色天天久久| 久久99精品久久只有精品| 亚洲视频一区二区在线| 亚洲精品在线免费观看视频| 91国产免费看| 粉嫩久久99精品久久久久久夜| 亚洲国产日韩精品| 国产精品天天摸av网| 欧美一区三区二区| www.av亚洲| 国内外成人在线| 亚洲地区一二三色| 中文字幕不卡三区| 精品少妇一区二区三区免费观看| 欧美在线高清视频| 国产电影一区在线| 秋霞电影网一区二区| 一区二区三区电影在线播| 久久久久九九视频| 日韩欧美一级精品久久| 在线视频国产一区| 成人精品国产一区二区4080| 精品在线播放午夜| 午夜精品久久久久久久久久久| 亚洲欧洲精品一区二区精品久久久| 精品伦理精品一区| 欧美一二三区在线| 欧美色综合天天久久综合精品| 成人午夜视频福利| 国产精品69毛片高清亚洲| 久久精品国产**网站演员| 午夜视频久久久久久| 成人福利在线看| 国产一区二区成人久久免费影院| 日韩高清不卡一区二区三区| 夜夜精品浪潮av一区二区三区| 亚洲免费在线播放| 亚洲桃色在线一区| 中文字幕一区二区在线观看| 中文字幕欧美区| 日本一区二区三区在线不卡| 久久久精品国产免费观看同学| 久久久亚洲高清| 国产欧美日韩综合| 中文字幕免费观看一区| 中文字幕巨乱亚洲| 亚洲欧洲国产专区|