Skip to content

Instantly share code, notes, and snippets.

View NiallHornFX's full-sized avatar

Niall Horn NiallHornFX

View GitHub Profile
#!/bin/bash
# Info: Set's up Env Vars for Android Studio and Java for AS 2024.2
# Note: Android Studio/jre is now jbr (Java Runtime -> JetBrains Runtime)
# Note: Android SDK Tools is now deprecated, replaced with command-line tools package
# however obsolete package has been installed and var left as backup
export JAVA_HOME="C:/Program Files/Android/Android Studio/jbr/"
export ANDROID_HOME=C:/Users/[User]/AppData/Local/Android/Sdk/
@NiallHornFX
NiallHornFX / PoissonSolve-SOR_01.m
Created October 4, 2022 23:44
Poisson Solve Gauss-Seidel and SOR (MATLAB) 01
% Same as 00, but we explictlly calcuclate the RHS from the R,G Components.
clear all;
format long;
% Square unit domain
N = 64;
dx = 1 / (N-1);
img_path = "C:\Users\Niall\Pictures\rock.png";
img_form = "png";
@NiallHornFX
NiallHornFX / PoissonSolve-SOR_00.m
Created October 3, 2022 04:43
Poisson Solve Gauss-Seidel and SOR (MATLAB) 00
clear all;
format long;
% Square unit domain
N = 64;
dx = 1 / (N-1);
% Use 64^2 Image as RHS (Divergence) (Not really (fx/dx + fy/dx))
im = imread("C:\Users\Niall\Pictures\rock.png", "png");
im = im(:, :, 1);
// Scalar Trilinear Interoplation Lambda using SSE.
auto trilerp_v = [&](int i0, int j0, int k0, float z, float y, float x) -> auto
{
vec4 aa(this->getdata(i0, j0, k0), this->getdata(i0, j0 + 1, k0), this->getdata(i0 + 1, j0, k0), this->getdata(i0 + 1, j0 + 1, k0));
vec4 bb(this->getdata(i0, j0, k0 + 1), this->getdata(i0, j0 + 1, k0 + 1), this->getdata(i0 + 1, j0, k0 + 1), this->getdata(i0 + 1, j0 + 1, k0 + 1));
vec4 coeff_z(z); vec4 ccoeff_z(1.0f - z);
__m128 L_a = _mm_fmadd_ps(ccoeff_z.sa, aa.sa, _mm_mul_ps(coeff_z.sa, bb.sa));
__m128 cc = _mm_shuffle_ps(L_a, L_a, _MM_SHUFFLE(1, 0, 1, 0)); // (z0,z1,|z0,z1)
// SSE Cross Product Test Implementations Test -
temp_vec3<float> a(1.0f, 2.0f, 3.0f); temp_vec3<float> b(4.0f, 5.0f, 6.0f);
for (std::size_t j = 0; j < 5; ++j)
{
std::cout << "\nITER = " << j << "\n";
// Version A) \\
auto start = std::chrono::system_clock::now();