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
| .globl main | |
| .text | |
| main: | |
| addi $a0, $a0, -3 # a0 = -3 | |
| addi $a1, $a1, 4 # a1 = 4 | |
| addi $a2, $a2, 5 # a2 = 5 | |
| addi $a3, $a3, 8 # a3 = 8 | |
| jal f # f(a0, a1, a2, a3) |
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
| .globl main | |
| .data | |
| N: .word 5 | |
| .text | |
| main: | |
| lw $a0, N($zero) # a0 = N[0] | |
| move $v0, $zero # v0 = 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
| from numpy import random | |
| EPOCHS = 40_000 | |
| RANDOM_ADJUSTMENTS = 32 | |
| STEP_SIZE = 0.0001 | |
| VERBOSE = True | |
| def cost_function(outputs, expected_values): | |
| total_cost = 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
| fn build_max_heap(array: &mut [usize], heap_size: usize) { | |
| (1..=array.len() / 2).rev().for_each(|index| {println!("{}", index);max_heapify(array, index, heap_size); | |
| println!("{:?}", array)}); | |
| } | |
| fn get_left_child_index(index: usize) -> usize { | |
| 2 * index | |
| } | |
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
| .globl main | |
| .text | |
| main: | |
| addi $a0, $a0, -3 # a0 = -3 | |
| addi $a1, $a1, 4 # a1 = 4 | |
| addi $a2, $a2, 5 # a2 = 5 | |
| addi $a3, $a3, 8 # a3 = 8 | |
| jal f # f(a0, a1, a2, a3) |
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
| .globl main | |
| .data | |
| N: .word 3 | |
| M: .word 0, 1, 2, 3, 4, 5, 6, 7, 8 | |
| .text | |
| main: | |
| la $a0, M # a0 = M pointer |
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
| .globl main | |
| .data | |
| L: .word 3 | |
| A: .half 0x002A, 0xA5FF, 0x5BE1 | |
| .text | |
| main: | |
| # prepare arguments for the parity function | |
| lw $a1, L |
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
| .globl main | |
| .data | |
| W: .asciiz "+6-4+3-2" | |
| .text | |
| main: | |
| la $a0, W # a0 = W_address | |
| jal calc |
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 sys | |
| HEADER_LINES = 7 | |
| PADDING_MAP = { | |
| "CodiceLRT": 0, | |
| "Part Name": 0, | |
| "CodiceFornitore": 0, | |
| "Descrizione": 0, | |
| "Valore": 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
| from functools import partial | |
| import jax.numpy as jnp | |
| import jax | |
| # STEP_SIZE = 0.0010 | |
| STEP_SIZES = jnp.array([1., 0.5, 0.1, 0.05, 0.01, 0.005, 0.001]) | |
| k = STEP_SIZES.shape[0] | |
| STEP_SIZES = STEP_SIZES.reshape((1, k, 1)) |