📄 lapack.h
字号:
//Copyright (c) 2004-2005, Baris Sumengen
//All rights reserved.
//
// CIMPL Matrix Performance Library
//
//Redistribution and use in source and binary
//forms, with or without modification, are
//permitted provided that the following
//conditions are met:
//
// * No commercial use is allowed.
// This software can only be used
// for non-commercial purposes. This
// distribution is mainly intended for
// academic research and teaching.
// * Redistributions of source code must
// retain the above copyright notice, this
// list of conditions and the following
// disclaimer.
// * Redistributions of binary form must
// mention the above copyright notice, this
// list of conditions and the following
// disclaimer in a clearly visible part
// in associated product manual,
// readme, and web site of the redistributed
// software.
// * 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.
// * The name of Baris Sumengen may not be
// used to endorse or promote products
// derived from this software without
// specific prior written permission.
//
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
//HOLDERS AND 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.
#pragma once
#ifndef LAPACK_H
#define LAPACK_H
#include "cimpl.h"
using namespace CIMPL;
#include <math.h>
#include <string>
#include <limits>
using std::numeric_limits;
/// \brief Lapack Toolbox
namespace Lapack
{
//=========================================================
// Linear equations solver
//=========================================================
// Gesv
Matrix<float> Gesv(Matrix<float>& A, Matrix<float>& B);
Matrix<double> Gesv(Matrix<double>& A, Matrix<double>& B);
Matrix<ComplexFloat> Gesv(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& B);
Matrix<ComplexDouble> Gesv(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& B);
//Gesvx
//Posv
Matrix<float> Posv(Matrix<float>& A, Matrix<float>& B);
Matrix<double> Posv(Matrix<double>& A, Matrix<double>& B);
Matrix<ComplexFloat> Posv(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& B);
Matrix<ComplexDouble> Posv(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& B);
//Posvx
//Sysv
Matrix<float> Sysv(Matrix<float>& A, Matrix<float>& B);
Matrix<double> Sysv(Matrix<double>& A, Matrix<double>& B);
Matrix<ComplexFloat> Sysv(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& B);
Matrix<ComplexDouble> Sysv(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& B);
//Sysvx
//Hesv
Matrix<ComplexFloat> Hesv(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& B);
Matrix<ComplexDouble> Hesv(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& B);
//Hesvx
//=========================================================
// Linear Least Squares problems
//=========================================================
// Gels
Matrix<float> Gels(Matrix<float>& A, Matrix<float>& B);
Matrix<double> Gels(Matrix<double>& A, Matrix<double>& B);
Matrix<ComplexFloat> Gels(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& B);
Matrix<ComplexDouble> Gels(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& B);
// Gelsy
Matrix<float> Gelsy(Matrix<float>& A, Matrix<float>& B);
Matrix<double> Gelsy(Matrix<double>& A, Matrix<double>& B);
Matrix<ComplexFloat> Gelsy(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& B);
Matrix<ComplexDouble> Gelsy(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& B);
// Gelss
Matrix<float> Gelss(Matrix<float>& A, Matrix<float>& B);
Matrix<double> Gelss(Matrix<double>& A, Matrix<double>& B);
Matrix<ComplexFloat> Gelss(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& B);
Matrix<ComplexDouble> Gelss(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& B);
// Gelsd
Matrix<float> Gelsd(Matrix<float>& A, Matrix<float>& B);
Matrix<double> Gelsd(Matrix<double>& A, Matrix<double>& B);
Matrix<ComplexFloat> Gelsd(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& B);
Matrix<ComplexDouble> Gelsd(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& B);
//=========================================================
// Generalized Linear Least Squares problems
//=========================================================
// Gglse
Vector<float> Gglse(Matrix<float>& A, Matrix<float>& B, Vector<float>& c, Vector<float>& d);
Vector<double> Gglse(Matrix<double>& A, Matrix<double>& B, Vector<double>& c, Vector<double>& d);
Vector<ComplexFloat> Gglse(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& B, Vector<ComplexFloat>& c, Vector<ComplexFloat>& d);
Vector<ComplexDouble> Gglse(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& B, Vector<ComplexDouble>& c, Vector<ComplexDouble>& d);
// Ggglm
void Ggglm(Matrix<float>& A, Matrix<float>& B, Vector<float>& d, Vector<float>& x, Vector<float>& y);
void Ggglm(Matrix<double>& A, Matrix<double>& B, Vector<double>& d, Vector<double>& x, Vector<double>& y);
void Ggglm(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& B, Vector<ComplexFloat>& d, Vector<ComplexFloat>& x, Vector<ComplexFloat>& y);
void Ggglm(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& B, Vector<ComplexDouble>& d, Vector<ComplexDouble>& x, Vector<ComplexDouble>& y);
//=========================================================
// Symmetric eigenproblem
//=========================================================
// Syevd
Vector<float> Syevd(Matrix<float>& A);
Vector<float> Syevd(Matrix<float>& A, Matrix<float>& EV);
Vector<double> Syevd(Matrix<double>& A);
Vector<double> Syevd(Matrix<double>& A, Matrix<double>& EV);
// Heevd
Vector<float> Heevd(Matrix<ComplexFloat>& A);
Vector<float> Heevd(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& EV);
Vector<double> Heevd(Matrix<ComplexDouble>& A);
Vector<double> Heevd(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& EV);
// Syevr
Vector<float> Syevr(Matrix<float>& A);
Vector<float> Syevr(Matrix<float>& A, int il, int iu);
Vector<float> Syevr(Matrix<float>& A, Matrix<float>& EV);
Vector<float> Syevr(Matrix<float>& A, Matrix<float>& EV, int il, int iu);
Vector<double> Syevr(Matrix<double>& A);
Vector<double> Syevr(Matrix<double>& A, int il, int iu);
Vector<double> Syevr(Matrix<double>& A, Matrix<double>& EV);
Vector<double> Syevr(Matrix<double>& A, Matrix<double>& EV, int il, int iu);
// Heevr
Vector<float> Heevr(Matrix<ComplexFloat>& A);
Vector<float> Heevr(Matrix<ComplexFloat>& A, int il, int iu);
Vector<float> Heevr(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& EV);
Vector<float> Heevr(Matrix<ComplexFloat>& A, Matrix<ComplexFloat>& EV, int il, int iu);
Vector<double> Heevr(Matrix<ComplexDouble>& A);
Vector<double> Heevr(Matrix<ComplexDouble>& A, int il, int iu);
Vector<double> Heevr(Matrix<ComplexDouble>& A, Matrix<ComplexDouble>& EV);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -