?? leastsquares.h
字號(hào):
#pragma once
#include <fstream>
#include <string>
#include "OWLQN.h"
struct LeastSquaresObjective;
class LeastSquaresProblem {
DblVec Amat;
DblVec b;
size_t m, n;
void skipEmptyAndComment(std::ifstream& file, std::string& s) {
do {
std::getline(file, s);
} while (s.size() == 0 || s[0] == '%');
}
friend struct LeastSquaresObjective;
public:
LeastSquaresProblem(size_t m, size_t n) : Amat(m * n), b(m), m(m), n(n) { }
LeastSquaresProblem(const char* matfile, const char* bFile);
double A(size_t i, size_t j) const {
return Amat[i + m * j];
}
double& A(size_t i, size_t j) {
return Amat[i + m * j];
}
size_t NumFeats() const { return n; }
size_t NumInstances() const { return m; }
};
struct LeastSquaresObjective : public DifferentiableFunction {
const LeastSquaresProblem& problem;
LeastSquaresObjective(const LeastSquaresProblem& p) : problem(p) { }
double Eval(const DblVec& input, DblVec& gradient) const;
};
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -