發表文章

目前顯示的是 11月, 2020的文章

Untiy In-APP Purchasing please enter the key in a valid format 解決方法

圖片
需開啟的Unity Services先開啟Analytics 至Google Play Console的營利設定的授權複制要添加到應用程式二進位檔中的 Base64 編碼 RSA 公開金鑰 到In-App Purchasing的打開,import IAP並在Options貼上Base64 編碼 RSA 公開金鑰 若出現 please enter the key in a valid format的錯誤 按右上角的Go to Dashboard會進入Unity的關於此專案的儀表板在Settings中的Analytics Settings→Google License Key→放上從 Google Play Console複製的 Base64 編碼 RSA 公開金鑰

String^ to string 與 string to String^

String^ to string //Convert std::string to System::String^,os is std::string String^ str = gcnew String(os.c_str()); string to String^ 第一種方式 //In here source is System::String^ const char* chars = (const char*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(source)).ToPointer(); string dest = chars; 第二種方式:若出現'^' 不能在類型'std::array'上使用這個間接取值之類的錯誤時,可以寫成函式來轉換 //In here source is System::String^ void MarshalString(System::String^ s, std::string& os) { using namespace System::Runtime::InteropServices; const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(s)).ToPointer(); os = chars; Marshal::FreeHGlobal(System::IntPtr((void*)chars)); }

Eigen SparseMatrix 元素放入方式比較

 在第一種直接對行列放入 SparseMatrix mat(rows,cols); // default is column major mat.reserve(VectorXi::Constant(cols,6)); for each i,j such that v_ij != 0 mat.insert(i,j) = v_ij; // alternative: mat.coeffRef(i,j) += v_ij; mat.makeCompressed(); // optional  第二種 放入vector中在一起放入 typedef Eigen::Triplet T; std::vector tripletList; tripletList.reserve(estimation_of_entries); for(...) { // ... tripletList.push_back(T(i,j,v_ij)); } SparseMatrixType mat(rows,cols); mat.setFromTriplets(tripletList.begin(), tripletList.end()); // mat is ready to go! 經實際使用在跑大約10萬個SparseMatrix時,第一種大約要5-10分鐘,第二種的話1分鐘內 兩者都是使用CPU運行,但比較後,若不是要一個個修的話,建議使用第二種方式。

Eigen model of Sparse matrix 稀疏矩陣模型 官網教學翻譯

處理和解決稀疏問題涉及以下各個模塊: 模組 需載入的標頭檔 英文內容 中文內容 SparseCore #include <Eigen/SparseCore> SparseMatrix and SparseVector classes, matrix assembly, basic sparse linear algebra (including sparse triangular solvers) 用於矩陣組合,基本稀疏線性代數(包括稀疏三角求解器) SparseCholesky include<Eigen/SparseCholesky> Direct sparse LLT and LDLT Cholesky factorization to solve sparse self-adjoint positive definite problems 可解決稀疏自伴正定問題 SparseLU #include<> Sparse LU factorization to solve general square sparse systems 分解解決一般的方形稀疏系統 SparseQR #include<Eigen/SparseLU> Sparse QR factorization for solving sparse linear least-squares problems 分解解決稀疏線性最小二乘問題 IterativeLinearSolvers #include<igen/IterativeLinearSolvers> Iterative solvers to solve large general linear square problems (including self-adjoint positive definite problems) 迭代求解器,用於求解大型一般線性平方問題(包括...