Etc - soup1997/Study-Alone GitHub Wiki

VScode Markdown Editor

[M1] 무료 마크다운 편집기 VS code 세팅

VScode 마크다운 이미지 넣기

vscode 마크다운 이미지 쉽게 넣기

Python 이름 순으로 정렬

import os
import natsort

a = os.listdir('data')
print(natsort.natsorted(os.listdir('data')))

# a = os.listdir('data') print(sorted(a)) 이렇게 할 경우 1 다음에 2가 아닌 10, 11이 먼저 오는 문제 발생함

Ceres solver Jacobian Matrix

#include <iostream>

#include <ceres/tiny_solver_autodiff_function.h>

struct Functor {
  template<typename T>
  bool operator()(const T* const parameters, T* residuals) const {
    const T& x = parameters[0];
    const T& y = parameters[1];
    const T& z = parameters[2];
    residuals[0] = x + T(2)*y + T(4)*z;
    residuals[1] = y * z;
    return true;
  }
};

using namespace std;

int main() {
  //Tiny...<Functor, numOfOutput, numOfInput, Scalar>
  using AutoDiffFunction = ceres::TinySolverAutoDiffFunction<Functor, 2, 3, float>;

  Functor my_functor;
  AutoDiffFunction func(my_functor);
  Eigen::Vector3f input(1, 2, 3);
  Eigen::Vector2f output;
  Eigen::Matrix<float, 2, 3> jacobian_matrix;

  func(input.data(), output.data(), jacobian_matrix.data());
  cout << "\nf(x, y, z) = [x+2y+4z, yz]" << endl << endl;
  cout << "input:\n" << input << endl << endl;
  cout << "output:\n" << output << endl << endl;
  cout << "jacobian:\n";
  cout << jacobian_matrix << endl;

  return 0;
}
⚠️ **GitHub.com Fallback** ⚠️