Skip to content

Instantly share code, notes, and snippets.

View krshrimali's full-sized avatar
💻
Sup?

Kushashwa Ravi Shrimali krshrimali

💻
Sup?
View GitHub Profile
@krshrimali
krshrimali / floating_check_remainder.cpp
Created July 12, 2021 04:16
Check for floating inputs for remainder implementation
#include <iostream>
#include <cmath>
#include <vector>
int main() {
std::vector<std::vector<double>> samples { {-7.5, -3.}, {-7.7, 3.1}, {-5.5, 3.}, {3., -2.5}, {3., 2.}, {7.3, 2.2}, {7.5, -2.} };
std::cout << "Output format: a rem b is: std::remainder, output before PR, output after PR\n";
for(auto vec: samples) {
double a = vec[0], b = vec[1];
@krshrimali
krshrimali / integrals_check_remainder.cpp
Created July 12, 2021 04:14
Check for Integral Inputs for Remainder Implementation
#include <iostream>
#include <cmath>
#include <vector>
int main() {
std::vector<std::vector<int>> samples = { {-7, -3}, {-7, 3}, {-5, 3}, {3, -2}, {3, 2}, {7, 2}, {7, -2} };
std::cout << "Output format: a rem b is: std::remainder, a % b in C++, output of torch impl, output modified impl\n";
for(auto vec: samples) {
int a = vec[0], b = vec[1];
@krshrimali
krshrimali / Live-Stream-Discussion-OpenCV.txt
Created October 23, 2020 18:08
Contributing to OpenCV
1. Be comfortable with the library, learn how to use it and make some projects on it. For example, Django: make a website out of it, know what it does.
2. Be comfortable with "using" the library in C++ if it's written in that language. Python - C++ - try to use it in C++, OpenCV - C++.
3. Build the library from source. `pip3 install opencv-python, flask, django` - build everything from source.
```
every library has 1000s of source codes! header files, (source) c++ files, test codes..
```
while building - you'll have a lot of errors, try to solve it.
4. Look at the source code "the functions you know something about".
5. If you have any questions, reach out!
6. Be more comfortable with the conventions followed in that library.
@krshrimali
krshrimali / README.md
Created December 20, 2017 12:19 — forked from fasiha/README.md
How to visualize 2D arrays in Matplotlib/Python (like imagesc in Matlab)

Visualizing rectangular 2D arrays in Python and Matplotlib the way you do with Matlab’s imagesc

Say you have a very rectangular 2D array arr, whose columns and rows correspond to very specific sampling locations x and y. That is, the arr[i, j] entry corresponds to some measurement taken at x[j] and y[i].

Matlab’s imagesc shows you this quite meaningfully:

x = linspace(-100, -10, 10);
y = [-8 -3];
data = randn(numel(y), numel(x));