📄 matvecop.cpp
字号:
/* Context : Matrix and Vector Operation Author : Frank Hoeppner, see also AUTHORS file Description : implementation of function module matvecop History : matvecop.nw: 980626 fh: first version, adapted from old tuple.cpp 990203 fh: introduced .check- refinements to choose strict/relaxed checks matvecop.check-relax.nw: 990203 fh: first version of relaxed checks Comment : This file was generated automatically. DO NOT EDIT. Copyright : Copyright (C) 1999-2000 Frank Hoeppner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#ifndef matvecop_SOURCE#define matvecop_SOURCE/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif/* necessary includes */#include "matvecop.hpp"/* private typedefs *//* private functions *//* data *//* implementation */template <class M1,class M2,class CMP>compare_type matrix_compare<M1,M2,CMP>::operator() ( const M1& A, const M2& B ) const { int r; // row counter int c; // col counter int rs(min(A.rows(),B.rows())); // no of rows int cs(min(A.cols(),B.cols())); // no of cols compare_type result; for (r=0;r<rs;++r) { for (c=0;c<cs;++c) { result=m_cmp_op(A(r,c),B(r,c)); if (result!=cmp_equal) return result; } } // in case of different no. of cols: comparison not defined! if (A.cols()!=B.cols()) return cmp_none; // same number of cols; equal elements so far; return (A.rows()<B.rows()) ? cmp_less : ((A.rows()==B.rows()) ? cmp_equal : cmp_greater ); }/* template instantiation */#endif /* matvecop_SOURCE */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -