⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vector.h

📁 斯坦福Energy211/CME211课《c++编程——地球科学科学家和工程师》的课件
💻 H
字号:
// ENERGY211/CME211//// vector.h - header file for Project 3//#ifndef CLASS_VECTOR	// Make sure this isn't included#define CLASS_VECTOR	// more than once#include "matrix.h"// This derived class is used to implement a column vector.// We could simply use a Matrix object with one column, but// this is more convenient.  Again, DO NOT ADD, MODIFY OR// DELETE PUBLIC DECLARATIONS!class ColVector : public Matrix {public:	// To construct a vector from an array of doubles	ColVector( int rows = 0, double *data = NULL );	// Copy constructor	ColVector( const ColVector& v );	// Conversion constructor from Matrix object with	// one column	ColVector( const Matrix& A );	// This destructor will automatically call the	// destructor for the underlying Matrix object first	~ColVector();	inline int length() const { return m_rows; }		static double norm( const ColVector& v, int p = 2 );		// If we add two vectors, or perform any other similar	// operation, we are using the operator of the Matrix	// class, the result is a Matrix.  In order to assign	// the result to a ColVector object, we need this	// overload of the assignment operator	ColVector& operator=( const Matrix& v );		// The [] operator for a Matrix object returns a pointer	// to the ith row, which contains the ith element, but 	// for a column vector, we need the ith element itself.	// This redefines the [] operator accordingly.	double& operator[]( int i ) const;		ColVector operator[]( Range r ) const;} ;#endif

⌨️ 快捷键说明

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