qpoint.h

来自「算断裂的」· C头文件 代码 · 共 61 行

H
61
字号
// ------------------------------------------------------------------// qpoint.h//// This file contains the class Point which holds a point in R^2 or R^3.// ------------------------------------------------------------------// Author: Stephen A. Vavasis// Copyright (c) 1999 by Cornell University.  All rights reserved.// // See the accompanying file 'Copyright' for authorship information,// the terms of the license governing this software, and disclaimers// concerning this software.// ------------------------------------------------------------------// This file is part of the QMG software.  // Version 2.0 of QMG, release date September 3, 1999.// ------------------------------------------------------------------#ifndef QPOINT_H#define QPOINT_H#include "qnamesp.h"class QMG::Point {private:  Real coords_[MAXDIM];  static int di_;public:  const Real& operator[](int i) const {#ifdef RANGECHECK    if (i < 0 || i >= di_) {      throw_error("Range error in point 1");    }#endif    return coords_[i];  }  Real& operator[](int i)  {#ifdef RANGECHECK    if (i < 0 || i >= di_) {      throw_error("Range error in point 2");    }#endif    return coords_[i];  }  Point() { }  void normalize();  Real l2norm() const;  static Point cross_product(const Point& a, const Point& b);  static Point subtract(const Point& a, const Point& b);  static void InitStaticData(int di) {di_ = di;}  static Real l1dist(const Point& a, const Point& b);  static Real inner_product(const Point& a, const Point& b);  static Real l2dist(const Point& a, const Point& b, int dim = di_);  static void init_static_data(int di) {di_ = di;}  static int embedded_dim() {return di_;}};extern QMG::ostream& operator<<(QMG::ostream& os, const QMG::Point& pt);#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?