This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Function to compute the average of an array of vectors | |
| const averageVector = (vectors) => { | |
| // Just a cheeky safety function to check for vectors | |
| if (vectors.length === 0) { | |
| return []; | |
| } | |
| // start with the sum vector with 0's | |
| let sumVector = new Array(vectors[0].length).fill(0); | |
| // Iterate over all vectors | |
| for(let vector of vectors) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Function to compute the geometric median of an array of points | |
| const geometricMedian = (points) => { | |
| // Initial guess is the first point | |
| let guess = points[0]; | |
| // Tolerance for convergence | |
| const tolerance = 1e-5; | |
| // Iterate until convergence or maximum iterations | |
| for(let i = 0; i < 1000; i++) { | |
| // Initialize accumulators for weighted sum of points | |
| let numerators = new Array(guess.length).fill(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { getAuth, signInWithEmailAndPassword } from "firebase/auth"; | |
| const auth = getAuth(); | |
| const email = "theexgenesis@gmail.com@gmail.com"; | |
| const password = "BROPASSWORDBRO"; | |
| signInWithEmailAndPassword(auth, email, password) | |
| .then((userCredential) => { | |
| // Authentication successful | |
| }) |