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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mtl.h

?? Matrix_Template_Library.rar c++矩陣模塊庫函數
?? H
?? 第 1 頁 / 共 5 頁
字號:
/* this is generic */template <class Matrix, class VecX, class VecZ>inline voidmult_generic__(const Matrix& A, const VecX& xx, VecZ& zz) MTL_THROW_ASSERTION{  MTL_ASSERT(A.nrows() <= zz.size(), "mtl::mult()");  MTL_ASSERT(A.ncols() <= xx.size(), "mtl::mult()");  typedef typename matrix_traits<Matrix>::value_type T;  typename Matrix::const_iterator i;  typename Matrix::OneD::const_iterator j, jend;  typename VecX::const_iterator x = xx.begin();  typename VecZ::iterator z = zz.begin();  for (i = A.begin(); i != A.end(); ++i) {    j = (*i).begin(); jend = (*i).end();    for (; j != jend; ++j)      z[j.row()] += *j * x[j.column()];  }}template <class Matrix, class VecX, class VecZ>inline voidmult_shape__(const Matrix& A, const VecX& x, VecZ& z,             banded_tag) MTL_THROW_ASSERTION{  mult_generic__(A, x, z);}/* this is fast */template <class Matrix, class VecX, class VecZ>inline voidrect_mult(const Matrix& A, const VecX& xx, VecZ& zz,           row_tag, dense_tag) MTL_THROW_ASSERTION{  MTL_ASSERT(A.nrows() <= zz.size(), "mtl::mult()");  MTL_ASSERT(A.ncols() <= xx.size(), "mtl::mult()");  typedef typename matrix_traits<Matrix>::value_type T;  typename Matrix::const_iterator i, iend;  typename Matrix::OneD::const_iterator j, jend;  typename VecX::const_iterator x = xx.begin();  typename VecZ::iterator z = zz.begin();  i = A.begin();  iend = A.end();  for (; i != iend; ++i) {    j = (*i).begin(); jend = (*i).end();    T tmp = z[j.row()];    for (; j != jend; ++j)      tmp += *j * x[j.column()];    z[j.row()] = tmp;  }}/*  This is slow */template <class Matrix, class VecX, class VecZ>inline voidrect_mult(const Matrix& A, const VecX& xx, VecZ& zz,          column_tag, dense_tag) MTL_THROW_ASSERTION{  MTL_ASSERT(A.nrows() <= zz.size(), "mtl::mult()");  MTL_ASSERT(A.ncols() <= xx.size(), "mtl::mult()");  typedef typename matrix_traits<Matrix>::value_type T;  typedef typename matrix_traits<Matrix>::size_type Int;  typename VecX::const_iterator x = xx.begin();  typename VecZ::iterator z = zz.begin();  typename Matrix::const_iterator i, iend;  typename Matrix::OneD::const_iterator j, jend;  i = A.begin();  iend = A.end();  for (; i != iend; ++i) {    j = (*i).begin(); jend = (*i).end();    for (; j != jend; ++j)      z[j.row()] += *j * x[j.column()];  }}// x is sparse// A is column orientedtemplate <class Matrix, class VecX, class VecY>void rect_mult(const Matrix& A, const VecX& x, VecY& y, 	  column_tag, sparse_tag) {  typename VecX::const_iterator xi = x.begin();  for (; xi != x.end(); ++xi) {    mtl::add(mtl::scaled(A[xi.index()], *xi), y);  }}  // x is sparse// A is row orientedtemplate <class Matrix, class VecX, class VecY>void rect_mult(const Matrix& A, const VecX& x, VecY& y, 	  row_tag, sparse_tag){  typename Matrix::const_iterator Ai;  for (Ai = A.begin(); Ai != A.end(); ++Ai) {    y[Ai.index()] = mtl::dot(*Ai, x); // this is a sparse dot  }}template <class Matrix, class VecX, class VecZ>inline voidmult_shape__(const Matrix& A, const VecX& x, VecZ z,             rectangle_tag) MTL_THROW_ASSERTION{  typedef typename matrix_traits<Matrix>::orientation Orien;  typedef typename linalg_traits<VecX>::sparsity SparseX;  rect_mult(A, x, z, Orien(), SparseX());}template <class Matrix, class VecX, class VecZ>inline voidmult_shape__(const Matrix& A, const VecX& x, VecZ& z,              triangle_tag){  mult_shape__(A, x, z, rectangle_tag());  if (A.is_unit()) {    /* actually, this still isn't quite right,       should do       add_n(x, z, z, MTL_MIN(A.nrows(), A.ncols()));       instead       */    if (z.size() <= x.size())      mtl::add(z, x, z);    else      mtl::add(x, z, z);        }}template <class Matrix, class VecX, class VecZ>inline voidmult_symm__(const Matrix& A, const VecX& x, VecZ& z, row_tag){  typedef typename matrix_traits<Matrix>::value_type T;  typename Matrix::const_iterator i;  typename Matrix::OneD::const_iterator j, jend;  for (i = A.begin(); i != A.end(); ++i) {    T tmp = z[i.index()];    j = (*i).begin();    jend = (*i).end();    if (A.is_upper()) {      tmp += *j * x[j.column()];      ++j;    } else      --jend;    for (; j != jend; ++j) {      /* normal side */      tmp += *j * x[j.column()];      /* symmetric side */      z[j.column()] += *j * x[j.row()];    }    if (A.is_lower())      tmp += *j * x[j.column()];    z[i.index()] = tmp;  }}template <class Matrix, class VecX, class VecZ>inline voidmult_symm__(const Matrix& A, const VecX& x, VecZ& z, column_tag){  typedef typename matrix_traits<Matrix>::value_type T;  typename Matrix::const_iterator i;  typename Matrix::OneD::const_iterator j, jend;  for (i = A.begin(); i != A.end(); ++i) {    T tmp = T(0);    j = (*i).begin();    jend = (*i).end();    if (A.is_lower()) {      z[j.column()] += *j * x[j.column()];      ++j;    } else      --jend;    for (; j != jend; ++j) {      /* normal side */      z[j.row()] += *j * x[j.column()];      /* symmetric side */      tmp += *j * x[j.row()];    }    if (A.is_upper())      tmp += *j * x[j.row()];          z[i.index()] += tmp;  }}template <class Matrix, class VecX, class VecZ>inline voidmult_shape__(const Matrix& A, const VecX& x, VecZ& z,              symmetric_tag){  typedef typename matrix_traits<Matrix>::orientation Orien;  mult_symm__(A, x, z, Orien());}//: Multiplication:  <tt>z <- A x + y</tt>//!category: algorithms//!component: function //!definition: mtl.h//!precond:  <TT>A.nrows() <= y.size()</TT>//!precond:  <TT>A.nrows() <= z.size()</TT>//!precond:  <TT>A.ncols() <= x.size()</TT>//!precond:  no aliasing in the arguments//!example: symm_sparse_vec_prod.cc//!typereqs: <tt>Matrix::value_type</tt>, <tt>VecX::value_type</tt>, <tt>VecY::value_type</tt>, and <tt>VecZ::value_type</tt> must be the same type//!typereqs: the multiplication operator must be defined for <tt>Matrix::value_type</tt>//!typereqs: the addition operator must be defined for <tt>Matrix::value_type</tt>template <class Matrix, class VecX, class VecY, class VecZ>inline voidmult(const Matrix& A, const VecX& x, const VecY& y, MTL_OUT(VecZ) z_)  MTL_THROW_ASSERTION{  VecZ& z = const_cast<VecZ&>(z_);  mtl::copy(y, z);  typedef typename matrix_traits<Matrix>::shape Shape;  mult_shape__(A, x, z, Shape());}//: Matrix Vector Multiplication:  <tt>y <- A x</tt>//// Multiplies matrix A times vector x and stores the result in vector y.// <p>// Note: ignore the <tt>oned_tag</tt> parameter and the underscores in// the name of this function.////!category: algorithms//!component: function//!definition: mtl.h//!example: general_matvec_mult.cc, banded_matvec_mult.cc, symm_matvec_mult.cc//!precond:  <TT>A.nrows() <= y.size()</TT>//!precond:  <TT>A.ncols() <= x.size()</TT>//!precond:  x and y not same vector//!example: symm_matvec_mult.cc//!typereqs: <tt>Matrix::value_type</tt>, <tt>VecX::value_type</tt>, and <tt>VecY::value_type</tt> must be the same type//!typereqs: the multiplication operator must be defined for <tt>Matrix::value_type</tt>//!typereqs: the addition operator must be defined for <tt>Matrix::value_type</tt>template <class Matrix, class VecX, class VecY>inline voidmult_dim__(const Matrix& A, const VecX& x, VecY& y, oned_tag) MTL_THROW_ASSERTION{  mtl::mult(A, x, mtl::scaled(y, 0), y);#if 0  typedef typename matrix_traits<Matrix>::shape Shape;  mult_shape__(A, x, y, Shape());#endif}template <class Matrix, class VecX, class VecY>inline voidmult_add(const Matrix& A, const VecX& x, MTL_OUT(VecY) y_) MTL_THROW_ASSERTION{  VecY& y = const_cast<VecY&>(y_);  typedef typename matrix_traits<Matrix>::shape Shape;  mult_shape__(A, x, y, Shape());}//: simple 3 loop version of matmat mult//!noindex:template <class MatA, class MatB, class MatC, class Orien>inline voidsimple_mult(const MatA& A, const MatB& B, MatC& C, dense_tag, Orien){  typedef typename matrix_traits<MatA>::size_type Int;  typename MatA::const_iterator A_k;  typename MatA::OneD::const_iterator A_ki;  A_k = A.begin();  while (not_at(A_k, A.end())) {    for (Int j = 0; j < B.ncols(); ++j) {      A_ki = (*A_k).begin();      while (not_at(A_ki, (*A_k).end())) {        Int k = A_ki.column();        Int i = A_ki.row();        C(i,j) += *A_ki * B(k,j);        ++A_ki;      }    }    ++A_k;  }}/* Assumes A and B are also row oriented */template <class MatrixA, class MatrixB, class MatrixC>inline voidsimple_mult(const MatrixA& A, const MatrixB& B, MatrixC& C,             sparse_tag, row_tag){  typedef typename matrix_traits<MatrixA>::value_type T;  typedef typename matrix_traits<MatrixA>::size_type Int;  T scal;  Int len = 0;  Int jj, k;  Int nzmax = C.capacity();  Int M = A.nrows();  Int N = B.ncols();  dense1D<Int> ic(M + 1, 0);  dense1D<Int> jc(nzmax);  dense1D<T> c(nzmax);    typedef typename dense1D<Int>::iterator di_iter;  typedef typename dense1D<T>::iterator dt_iter;    compressed1D<T> tmp1(N), tmp2(N), tmp3(N);  tmp1.reserve(N);  tmp2.reserve(N);    typedef typename compressed1D<T>::iterator tmpiter;    typename MatrixA::const_iterator Ai;  typename MatrixA::Row::const_iterator Aij;    for (Ai = A.begin(); Ai != A.end(); ++Ai) {    copy(C[Ai.index()], tmp1);    for (Aij = (*Ai).begin(); Aij != (*Ai).end(); ++Aij) {      scal = *Aij;      jj = Aij.column();      // add B[jj] and tmp1 into tmp2      add(mtl::scaled(B[jj], scal), tmp1, tmp2);      tmp1.clear();      // swap tmp1 and tmp2      tmp3 = tmp1; tmp1 = tmp2; tmp2 = tmp3;    }    // copy tmp1 into C[ii]    k = len;    if (k + tmp1.nnz() > nzmax) {      std::cerr << "Not enough work space, increase capacity of C" << std::endl;      return;    }    for (tmpiter t = tmp1.begin(); t != tmp1.end(); ++t, ++k) {      c[k] = *t;      jc[k] = t.index();    }        len += tmp1.nnz();    ic[Ai.index() + 1] = len;  }  typedef typename matrix<T, rectangle<>,     compressed<Int, external>,     row_major>::type  SpMat;  SpMat CC(M, N, len, c.data(), ic.data(), jc.data());  copy(CC, C);}/* Assumes A and B are also column oriented */template <class MatrixA, class MatrixB, class MatrixC>inline voidsimple_mult(const MatrixA& A, const MatrixB& B, MatrixC& C,             sparse_tag, column_tag){  typedef typename matrix_traits<MatrixA>::value_type T;  typedef typename matrix_traits<MatrixA>::size_type Int;  T scal;  Int len = 0;  Int kk, k;  Int nzmax = C.capacity();  Int M = A.nrows();  Int N = B.ncols();  dense1D<Int> ic(N + 1, 0);  dense1D<Int> jc(nzmax);  dense1D<T> c(nzmax);    typedef typename dense1D<Int>::iterator di_iter;  typedef typename dense1D<T>::iterator dt_iter;    compressed1D<T> tmp1(M), tmp2(M), tmp3(M);  tmp1.reserve(M);  tmp2.reserve(M);    typedef typename compressed1D<T>::iterator tmpiter;    typename MatrixB::const_iterator Bj;  typename MatrixB::Column::const_iterator Bjk;    for (Bj = B.begin(); Bj != B.end(); ++Bj) {    copy(C[Bj.index()], tmp1);    for (Bjk = (*Bj).begin(); Bjk != (*Bj).end(); ++Bjk) {      scal = *Bjk;      kk = Bjk.row();      // add A[kk] and tmp1 into tmp2      add(mtl::scaled(A[kk], scal), tmp1, tmp2);      tmp1.clear();      // swap tmp1 and tmp2      tmp3 = tmp1; tmp1 = tmp2; tmp2 = tmp3;    }    // copy tmp1 into C[ii]    k = len;    if (k + tmp1.nnz() > nzmax) {      std::cerr << "Not enough work space, increase capacity of C" << std::endl;      return;    }    for (tmpiter t = tmp1.begin(); t != tmp1.end(); ++t, ++k) {      c[k] = *t;      jc[k] = t.index();    }        len += tmp1.nnz();    ic[Bj.index() + 1] = len;  }    typedef typename matrix<T, rectangle<>,                  compressed<Int, external>,                  column_major>::type  SpMat;  SpMat CC(M, N, len, c.data(), ic.data(), jc.data());  copy(CC, C);}//: Symmetric version, row-major//!noindex:template <class MatA, class MatB, class MatC>inline voidsymm_simple_mult(const MatA& A, const MatB& B, MatC& C, row_tag){  typedef typename matrix_traits<MatA>::size_type Int;  typename MatA::const_iterator A_k;  typename MatA::OneD::const_iterator A_ki, A_kiend;  A_k = A.begin();  while (not_at(A_k, A.end())) {    for (Int j = 0; j < B.ncols(); ++j) {      A_ki = (*A_k).begin();      A_kiend = (*A_k).end();      Int k = A_ki.column();      Int i = A_ki.row();      if (A.is_upper()) { /* handle the diagonal elements */        C(i,j) += *A_ki * B(k,j);        ++A_ki;      } else        --A_kiend;      while (not_at(A_ki, A_kiend)) {        k = A_ki.column();        i = A_ki.row();        C(i,j) += *A_ki * B(k,j);        C(k,j) += *A_ki * B(i,j);        ++A_ki;      }      k = A_ki.column();      i = A_ki.row();      if (A.is_lower())        C(i,j) += *A_ki * B(k,j);    }    ++A_k;  }}//: Symmetric version, column-major//!noindex:template <class MatA, class MatB, class MatC>inline voidsymm_simple_mult(const MatA& A, const MatB& B, MatC& C, column_tag){  typedef typename matrix_traits<MatA>::size_type Int;  typename MatA::const_iterator A_k;  typename MatA::OneD::const_iterator A_ki, A_kiend;  A_k = A.begin();  while (not_at(A_k, A.end())) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品久久久久久无| 国产一区美女在线| 奇米影视一区二区三区小说| 国产美女精品一区二区三区| 99精品桃花视频在线观看| 7777精品伊人久久久大香线蕉| 国产精品入口麻豆原神| 肉丝袜脚交视频一区二区| 成人aa视频在线观看| 精品三级av在线| 亚洲国产欧美在线| 成人99免费视频| 久久这里只有精品视频网| 午夜精品久久久久久久久| 99这里只有精品| 久久综合五月天婷婷伊人| 无码av免费一区二区三区试看| av中文字幕不卡| 国产区在线观看成人精品| 美女诱惑一区二区| 在线不卡一区二区| 亚洲最大色网站| 99久久伊人网影院| 中文字幕免费在线观看视频一区| 久久激情五月激情| 日韩一区二区中文字幕| 亚洲二区在线观看| 色成年激情久久综合| 综合婷婷亚洲小说| 91老司机福利 在线| 国产精品蜜臀在线观看| 国产夫妻精品视频| 亚洲国产精品99久久久久久久久| 韩日av一区二区| 日韩女优毛片在线| 精品一区二区久久| 欧美成人一区二区三区片免费| 香蕉久久夜色精品国产使用方法 | 7777精品伊人久久久大香线蕉的 | 欧美mv日韩mv国产网站| 日韩高清电影一区| 日韩精品最新网址| 久久99精品久久久久久国产越南 | 色呦呦国产精品| 亚洲人成影院在线观看| 一本大道久久a久久精二百| 亚洲欧美日韩国产综合| 一本大道综合伊人精品热热| 亚洲香肠在线观看| 欧美精品丝袜久久久中文字幕| 午夜精品久久久久影视| 精品久久一二三区| 国产成人自拍网| 亚洲欧洲在线观看av| 91成人免费网站| 日韩电影免费在线看| 欧美大黄免费观看| 丰满少妇在线播放bd日韩电影| 国产精品污污网站在线观看| 色综合久久久久久久| 亚欧色一区w666天堂| 2023国产精华国产精品| 成人av小说网| 亚洲国产欧美在线| 久久亚洲二区三区| 97超碰欧美中文字幕| 亚洲福利国产精品| 国产欧美日韩激情| 欧美综合一区二区| 精品一区二区三区影院在线午夜| 日本一区二区三区免费乱视频| 91黄色激情网站| 精品一区二区三区日韩| 中文字幕一区二区三区乱码在线| 欧美亚洲一区二区在线观看| 国产一区二区三区电影在线观看| 一区二区三区丝袜| 久久综合久色欧美综合狠狠| 色久综合一二码| 国产在线乱码一区二区三区| 中文字幕制服丝袜一区二区三区 | 亚洲国产精品综合小说图片区| 欧美α欧美αv大片| 99视频在线精品| 日本中文字幕一区二区有限公司| 欧美国产精品专区| 欧美一级二级三级乱码| 一本久道久久综合中文字幕| 久久成人精品无人区| 中文字幕佐山爱一区二区免费| 日韩女优电影在线观看| 欧美日韩一区二区三区高清| 国产91精品久久久久久久网曝门| 日韩电影在线一区| 亚洲精品免费看| 国产日韩精品久久久| 日韩视频一区二区三区| 在线看不卡av| 99久久久久免费精品国产| 久草精品在线观看| 天堂成人免费av电影一区| 亚洲免费观看在线视频| 国产午夜三级一区二区三| 日韩欧美在线观看一区二区三区| 在线影视一区二区三区| 91免费视频网| 99久久er热在这里只有精品66| 国内精品写真在线观看| 日本美女一区二区三区视频| 亚洲国产视频一区二区| 亚洲精品国产精品乱码不99| 国产精品私人影院| 国产精品第五页| 中文字幕不卡的av| 国产精品欧美综合在线| 欧美国产日韩一二三区| 国产丝袜美腿一区二区三区| 精品国产一区a| 亚洲精品在线免费观看视频| 亚洲精品一区二区在线观看| 精品少妇一区二区三区免费观看| 欧美裸体一区二区三区| 欧美日韩精品一区二区天天拍小说 | 日韩一级免费一区| 欧美成人三级电影在线| 欧美videossexotv100| 日韩精品一区二| 久久九九久久九九| 亚洲国产精华液网站w| 亚洲欧洲日产国产综合网| 亚洲欧洲精品成人久久奇米网| 中文字幕一区二区在线观看| 亚洲精品中文在线影院| 亚洲成人激情自拍| 奇米四色…亚洲| 国产一区二区三区不卡在线观看| 国产成人一级电影| 一本色道a无线码一区v| 欧美丝袜丝交足nylons| 欧美不卡在线视频| 中文字幕日韩欧美一区二区三区| 日韩久久一区二区| 天堂久久久久va久久久久| 久久成人18免费观看| 成人av集中营| 欧美日精品一区视频| 日韩午夜在线影院| 国产日韩在线不卡| 亚洲综合成人在线视频| 蜜桃一区二区三区在线观看| 成人av电影在线播放| 欧美高清视频不卡网| 欧美激情一区二区三区不卡| 一区二区欧美在线观看| 久久99国内精品| 色综合天天天天做夜夜夜夜做| 日韩一区二区麻豆国产| 国产精品丝袜一区| 日本不卡一区二区| www.日韩av| 日韩一区二区三区视频在线| 中文字幕不卡一区| 日韩av中文字幕一区二区| 福利一区福利二区| 9191国产精品| 中文字幕在线不卡一区二区三区| 蜜桃视频在线观看一区二区| 99国产欧美久久久精品| 精品国产凹凸成av人导航| 亚洲欧美乱综合| 国产精品一二三四区| 欧美日韩国产在线观看| 中文字幕亚洲电影| 极品尤物av久久免费看| 在线观看欧美日本| 国产精品网站在线观看| 久久国产尿小便嘘嘘| 日本韩国欧美国产| 国产精品久久久久久久久快鸭| 奇米精品一区二区三区在线观看一 | 欧美专区亚洲专区| 国产精品久久久久久户外露出| 奇米影视一区二区三区| 欧洲国内综合视频| 亚洲欧美日韩电影| 成人黄色777网| 久久久久久久久久久久电影 | 国产精品久久久久9999吃药| 久久精品国产77777蜜臀| 欧美日韩视频在线第一区| 亚洲日本中文字幕区| 国产精品亚洲一区二区三区妖精| 日韩一区二区在线看片| 亚洲bt欧美bt精品| 欧美婷婷六月丁香综合色| 亚洲制服丝袜av| 色婷婷精品久久二区二区蜜臂av| 国产精品久久久久久久久免费丝袜| 国产乱妇无码大片在线观看| 久久欧美一区二区|