forked from M-Labs/artiq-zynq
Compare commits
10 Commits
78d6b7ddcf
...
20f65b6ddc
Author | SHA1 | Date | |
---|---|---|---|
20f65b6ddc | |||
3fdb7e80a8 | |||
bd1de933fb | |||
e8d77fca3e | |||
85e8a3fc44 | |||
04078b3d89 | |||
d508c5c6f8 | |||
bae41253e4 | |||
20181e9915 | |||
a835149619 |
21
flake.lock
generated
21
flake.lock
generated
@ -11,11 +11,11 @@
|
|||||||
"src-pythonparser": "src-pythonparser"
|
"src-pythonparser": "src-pythonparser"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722417433,
|
"lastModified": 1724411572,
|
||||||
"narHash": "sha256-QEbcVdL1sUQEbMCvCUvPM8DKqwOth3gJpdiLTf4hPN8=",
|
"narHash": "sha256-33vj/pJ9iaVvaFP8uuBKMSQPN20mRlCbeBkTCNc9WB4=",
|
||||||
"ref": "refs/heads/master",
|
"ref": "refs/heads/master",
|
||||||
"rev": "0623480c82c28d57e14dc4f363374758a52284d3",
|
"rev": "352cf907ee67f7db5478fe23217cd5fcb7334617",
|
||||||
"revCount": 8952,
|
"revCount": 8996,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/m-labs/artiq.git"
|
"url": "https://github.com/m-labs/artiq.git"
|
||||||
},
|
},
|
||||||
@ -102,11 +102,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721924956,
|
"lastModified": 1723362943,
|
||||||
"narHash": "sha256-Sb1jlyRO+N8jBXEX9Pg9Z1Qb8Bw9QyOgLDNMEpmjZ2M=",
|
"narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5ad6a14c6bf098e98800b091668718c336effc95",
|
"rev": "a58bc8ad779655e790115244571758e8de055e3d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -131,15 +131,16 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722046723,
|
"lastModified": 1719454714,
|
||||||
"narHash": "sha256-G7/gHz8ORRvHd1/RIURrdcswKRPe9K0FsIYR4v5jSWo=",
|
"narHash": "sha256-MojqG0lyUINkEk0b3kM2drsU5vyaF8DFZe/FAlZVOGs=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "56baac5e6b2743d4730e664ea64f6d8a2aad0fbb",
|
"rev": "d1c527659cf076ecc4b96a91c702d080b213801e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
|
"ref": "snapshot/2024-08-01",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
@ -1,60 +1,32 @@
|
|||||||
{
|
{
|
||||||
"target": "kasli_soc",
|
"target": "kasli_soc",
|
||||||
"variant": "master",
|
"variant": "master",
|
||||||
"hw_rev": "v1.0",
|
"hw_rev": "v1.1",
|
||||||
"base": "master",
|
"base": "master",
|
||||||
"peripherals": [
|
"peripherals": [
|
||||||
{
|
{
|
||||||
"type": "grabber",
|
"type": "fastino",
|
||||||
"ports": [0]
|
"ports": [0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dio",
|
"type": "dio",
|
||||||
"ports": [1],
|
"ports": [1],
|
||||||
"bank_direction_low": "input",
|
"bank_direction_low": "output",
|
||||||
"bank_direction_high": "output"
|
"bank_direction_high": "input"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dio",
|
"type": "dio",
|
||||||
"ports": [2],
|
"ports": [2],
|
||||||
"bank_direction_low": "output",
|
"bank_direction_low": "output",
|
||||||
"bank_direction_high": "output"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "urukul",
|
|
||||||
"dds": "ad9910",
|
|
||||||
"ports": [3, 4],
|
|
||||||
"clk_sel": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "zotino",
|
|
||||||
"ports": [5]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "sampler",
|
|
||||||
"ports": [6, 7]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "mirny",
|
|
||||||
"ports": [8],
|
|
||||||
"clk_sel": 1,
|
|
||||||
"refclk": 125e6
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "fastino",
|
|
||||||
"ports": [9]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "dio",
|
|
||||||
"ports": [10],
|
|
||||||
"bank_direction_low": "input",
|
|
||||||
"bank_direction_high": "input"
|
"bank_direction_high": "input"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dio",
|
"type": "phaser",
|
||||||
"ports": [11],
|
"ports": [3]
|
||||||
"bank_direction_low": "output",
|
},
|
||||||
"bank_direction_high": "input"
|
{
|
||||||
|
"type": "phaser",
|
||||||
|
"ports": [4]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
2
src/Cargo.lock
generated
2
src/Cargo.lock
generated
@ -395,7 +395,7 @@ checksum = "c75de51135344a4f8ed3cfe2720dc27736f7711989703a0b43aadf3753c55577"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nalgebra"
|
name = "nalgebra"
|
||||||
version = "0.32.6"
|
version = "0.32.6"
|
||||||
source = "git+https://git.m-labs.hk/M-labs/nalgebra?rev=dd00f9b#dd00f9b46046e0b931d1b470166db02fd29591be"
|
source = "git+https://git.m-labs.hk/M-Labs/nalgebra.git?rev=dd00f9b#dd00f9b46046e0b931d1b470166db02fd29591be"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"approx",
|
"approx",
|
||||||
"num-complex",
|
"num-complex",
|
||||||
|
@ -34,7 +34,7 @@ io = { path = "../libio" }
|
|||||||
libboard_artiq = { path = "../libboard_artiq" }
|
libboard_artiq = { path = "../libboard_artiq" }
|
||||||
|
|
||||||
[dependencies.nalgebra]
|
[dependencies.nalgebra]
|
||||||
git = "https://git.m-labs.hk/M-labs/nalgebra.git"
|
git = "https://git.m-labs.hk/M-Labs/nalgebra.git"
|
||||||
rev = "dd00f9b"
|
rev = "dd00f9b"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["libm", "alloc"]
|
features = ["libm", "alloc"]
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
use core::mem;
|
use core::mem;
|
||||||
|
|
||||||
use core_io::Error as ReadError;
|
use core_io::Error as ReadError;
|
||||||
use cslice::CSlice;
|
use cslice::{AsCSlice, CSlice};
|
||||||
use dwarf::eh::{self, EHAction, EHContext};
|
use dwarf::eh::{self, EHAction, EHContext};
|
||||||
use io::{Cursor, ProtoRead};
|
use io::{Cursor, ProtoRead};
|
||||||
use libc::{c_int, c_void, uintptr_t};
|
use libc::{c_int, c_void, uintptr_t};
|
||||||
@ -222,8 +222,6 @@ pub unsafe fn artiq_personality(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe extern "C" fn raise(exception: *const Exception) -> ! {
|
pub unsafe extern "C" fn raise(exception: *const Exception) -> ! {
|
||||||
use cslice::AsCSlice;
|
|
||||||
|
|
||||||
let count = EXCEPTION_BUFFER.exception_count;
|
let count = EXCEPTION_BUFFER.exception_count;
|
||||||
let stack = &mut EXCEPTION_BUFFER.exception_stack;
|
let stack = &mut EXCEPTION_BUFFER.exception_stack;
|
||||||
let diff = exception as isize - EXCEPTION_BUFFER.exceptions.as_ptr() as isize;
|
let diff = exception as isize - EXCEPTION_BUFFER.exceptions.as_ptr() as isize;
|
||||||
@ -477,20 +475,30 @@ extern "C" fn stop_fn(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must be kept in sync with preallocate_runtime_exception_names() in artiq/language/embedding_map.py
|
// Must be kept in sync with preallocate_runtime_exception_names() in `artiq.compiler.embedding`
|
||||||
static EXCEPTION_ID_LOOKUP: [(&str, u32); 12] = [
|
static EXCEPTION_ID_LOOKUP: [(&str, u32); 22] = [
|
||||||
("RuntimeError", 0),
|
("RTIOUnderflow", 0),
|
||||||
("RTIOUnderflow", 1),
|
("RTIOOverflow", 1),
|
||||||
("RTIOOverflow", 2),
|
("RTIODestinationUnreachable", 2),
|
||||||
("RTIODestinationUnreachable", 3),
|
("DMAError", 3),
|
||||||
("DMAError", 4),
|
("I2CError", 4),
|
||||||
("I2CError", 5),
|
("CacheError", 5),
|
||||||
("CacheError", 6),
|
("SPIError", 6),
|
||||||
("SPIError", 7),
|
("SubkernelError", 7),
|
||||||
("ZeroDivisionError", 8),
|
("AssertionError", 8),
|
||||||
("IndexError", 9),
|
("AttributeError", 9),
|
||||||
("UnwrapNoneError", 10),
|
("IndexError", 10),
|
||||||
("SubkernelError", 11),
|
("IOError", 11),
|
||||||
|
("KeyError", 12),
|
||||||
|
("NotImplementedError", 13),
|
||||||
|
("OverflowError", 14),
|
||||||
|
("RuntimeError", 15),
|
||||||
|
("TimeoutError", 16),
|
||||||
|
("TypeError", 17),
|
||||||
|
("ValueError", 18),
|
||||||
|
("ZeroDivisionError", 19),
|
||||||
|
("LinAlgError", 20),
|
||||||
|
("UnwrapNoneError", 21),
|
||||||
];
|
];
|
||||||
|
|
||||||
pub fn get_exception_id(name: &str) -> u32 {
|
pub fn get_exception_id(name: &str) -> u32 {
|
||||||
@ -525,3 +533,29 @@ macro_rules! artiq_raise {
|
|||||||
}};
|
}};
|
||||||
($name:expr, $message:expr) => {{ artiq_raise!($name, $message, 0, 0, 0) }};
|
($name:expr, $message:expr) => {{ artiq_raise!($name, $message, 0, 0, 0) }};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Takes as input exception id from host
|
||||||
|
/// Generates a new exception with:
|
||||||
|
/// * `id` set to `exn_id`
|
||||||
|
/// * `message` set to corresponding exception name from `EXCEPTION_ID_LOOKUP`
|
||||||
|
///
|
||||||
|
/// The message is matched on host to ensure correct exception is being referred
|
||||||
|
/// This test checks the synchronization of exception ids for runtime errors
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn test_exception_id_sync(exn_id: u32) {
|
||||||
|
let message = EXCEPTION_ID_LOOKUP
|
||||||
|
.iter()
|
||||||
|
.find_map(|&(name, id)| if id == exn_id { Some(name) } else { None })
|
||||||
|
.unwrap_or("unallocated internal exception id");
|
||||||
|
|
||||||
|
let exn = Exception {
|
||||||
|
id: exn_id,
|
||||||
|
file: file!().as_c_slice(),
|
||||||
|
line: 0,
|
||||||
|
column: 0,
|
||||||
|
function: "test_exception_id_sync".as_c_slice(),
|
||||||
|
message: message.as_c_slice(),
|
||||||
|
param: [0, 0, 0],
|
||||||
|
};
|
||||||
|
unsafe { raise(&exn) };
|
||||||
|
}
|
||||||
|
@ -332,6 +332,13 @@ pub fn resolve(required: &[u8]) -> Option<u32> {
|
|||||||
api!(sp_linalg_schur = linalg::sp_linalg_schur),
|
api!(sp_linalg_schur = linalg::sp_linalg_schur),
|
||||||
api!(sp_linalg_hessenberg = linalg::sp_linalg_hessenberg),
|
api!(sp_linalg_hessenberg = linalg::sp_linalg_hessenberg),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* syscall for unit tests
|
||||||
|
* Used in `artiq.tests.coredevice.test_exceptions.ExceptionTest.test_raise_exceptions_kernel`
|
||||||
|
* This syscall checks that the exception IDs used in the Python `EmbeddingMap` (in `artiq.language.embedding`)
|
||||||
|
* match the `EXCEPTION_ID_LOOKUP` defined in the firmware (`libksupport::src::eh_artiq`)
|
||||||
|
*/
|
||||||
|
api!(test_exception_id_sync = eh_artiq::test_exception_id_sync)
|
||||||
];
|
];
|
||||||
api.iter()
|
api.iter()
|
||||||
.find(|&&(exported, _)| exported.as_bytes() == required)
|
.find(|&&(exported, _)| exported.as_bytes() == required)
|
||||||
|
@ -55,8 +55,8 @@ pub unsafe extern "C" fn np_linalg_cholesky(mat1: *mut InputMatrix, out: *mut In
|
|||||||
}
|
}
|
||||||
|
|
||||||
let outdim = out.get_dims();
|
let outdim = out.get_dims();
|
||||||
let out_slice = unsafe { slice::from_raw_parts_mut(out.data, outdim[0] * outdim[1]) };
|
let out_slice = slice::from_raw_parts_mut(out.data, outdim[0] * outdim[1]);
|
||||||
let data_slice1 = unsafe { slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]) };
|
let data_slice1 = slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]);
|
||||||
|
|
||||||
let matrix1 = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
let matrix1 = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
||||||
let result = matrix1.cholesky();
|
let result = matrix1.cholesky();
|
||||||
@ -93,9 +93,9 @@ pub unsafe extern "C" fn np_linalg_qr(mat1: *mut InputMatrix, out_q: *mut InputM
|
|||||||
let outq_dim = (*out_q).get_dims();
|
let outq_dim = (*out_q).get_dims();
|
||||||
let outr_dim = (*out_r).get_dims();
|
let outr_dim = (*out_r).get_dims();
|
||||||
|
|
||||||
let data_slice1 = unsafe { slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]) };
|
let data_slice1 = slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]);
|
||||||
let out_q_slice = unsafe { slice::from_raw_parts_mut(out_q.data, outq_dim[0] * outq_dim[1]) };
|
let out_q_slice = slice::from_raw_parts_mut(out_q.data, outq_dim[0] * outq_dim[1]);
|
||||||
let out_r_slice = unsafe { slice::from_raw_parts_mut(out_r.data, outr_dim[0] * outr_dim[1]) };
|
let out_r_slice = slice::from_raw_parts_mut(out_r.data, outr_dim[0] * outr_dim[1]);
|
||||||
|
|
||||||
// Refer to https://github.com/dimforge/nalgebra/issues/735
|
// Refer to https://github.com/dimforge/nalgebra/issues/735
|
||||||
let matrix1 = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
let matrix1 = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
||||||
@ -138,10 +138,10 @@ pub unsafe extern "C" fn np_linalg_svd(
|
|||||||
let outs_dim = (*outs).get_dims();
|
let outs_dim = (*outs).get_dims();
|
||||||
let outvh_dim = (*outvh).get_dims();
|
let outvh_dim = (*outvh).get_dims();
|
||||||
|
|
||||||
let data_slice1 = unsafe { slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]) };
|
let data_slice1 = slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]);
|
||||||
let out_u_slice = unsafe { slice::from_raw_parts_mut(outu.data, outu_dim[0] * outu_dim[1]) };
|
let out_u_slice = slice::from_raw_parts_mut(outu.data, outu_dim[0] * outu_dim[1]);
|
||||||
let out_s_slice = unsafe { slice::from_raw_parts_mut(outs.data, outs_dim[0]) };
|
let out_s_slice = slice::from_raw_parts_mut(outs.data, outs_dim[0]);
|
||||||
let out_vh_slice = unsafe { slice::from_raw_parts_mut(outvh.data, outvh_dim[0] * outvh_dim[1]) };
|
let out_vh_slice = slice::from_raw_parts_mut(outvh.data, outvh_dim[0] * outvh_dim[1]);
|
||||||
|
|
||||||
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
||||||
let result = matrix.svd(true, true);
|
let result = matrix.svd(true, true);
|
||||||
@ -180,8 +180,8 @@ pub unsafe extern "C" fn np_linalg_inv(mat1: *mut InputMatrix, out: *mut InputMa
|
|||||||
}
|
}
|
||||||
|
|
||||||
let outdim = out.get_dims();
|
let outdim = out.get_dims();
|
||||||
let out_slice = unsafe { slice::from_raw_parts_mut(out.data, outdim[0] * outdim[1]) };
|
let out_slice = slice::from_raw_parts_mut(out.data, outdim[0] * outdim[1]);
|
||||||
let data_slice1 = unsafe { slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]) };
|
let data_slice1 = slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]);
|
||||||
|
|
||||||
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
||||||
if !matrix.is_invertible() {
|
if !matrix.is_invertible() {
|
||||||
@ -210,8 +210,8 @@ pub unsafe extern "C" fn np_linalg_pinv(mat1: *mut InputMatrix, out: *mut InputM
|
|||||||
}
|
}
|
||||||
let dim1 = (*mat1).get_dims();
|
let dim1 = (*mat1).get_dims();
|
||||||
let outdim = out.get_dims();
|
let outdim = out.get_dims();
|
||||||
let out_slice = unsafe { slice::from_raw_parts_mut(out.data, outdim[0] * outdim[1]) };
|
let out_slice = slice::from_raw_parts_mut(out.data, outdim[0] * outdim[1]);
|
||||||
let data_slice1 = unsafe { slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]) };
|
let data_slice1 = slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]);
|
||||||
|
|
||||||
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
||||||
let svd = matrix.svd(true, true);
|
let svd = matrix.svd(true, true);
|
||||||
@ -247,11 +247,11 @@ pub unsafe extern "C" fn np_linalg_matrix_power(mat1: *mut InputMatrix, mat2: *m
|
|||||||
}
|
}
|
||||||
|
|
||||||
let dim1 = (*mat1).get_dims();
|
let dim1 = (*mat1).get_dims();
|
||||||
let power = unsafe { slice::from_raw_parts_mut(mat2.data, 1) };
|
let power = slice::from_raw_parts_mut(mat2.data, 1);
|
||||||
let power = power[0];
|
let power = power[0];
|
||||||
let outdim = out.get_dims();
|
let outdim = out.get_dims();
|
||||||
let out_slice = unsafe { slice::from_raw_parts_mut(out.data, outdim[0] * outdim[1]) };
|
let out_slice = slice::from_raw_parts_mut(out.data, outdim[0] * outdim[1]);
|
||||||
let data_slice1 = unsafe { slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]) };
|
let data_slice1 = slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]);
|
||||||
let mut abs_power = power;
|
let mut abs_power = power;
|
||||||
if abs_power < 0.0 {
|
if abs_power < 0.0 {
|
||||||
abs_power = abs_power * -1.0;
|
abs_power = abs_power * -1.0;
|
||||||
@ -295,8 +295,8 @@ pub unsafe extern "C" fn np_linalg_det(mat1: *mut InputMatrix, out: *mut InputMa
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
let dim1 = (*mat1).get_dims();
|
let dim1 = (*mat1).get_dims();
|
||||||
let out_slice = unsafe { slice::from_raw_parts_mut(out.data, 1) };
|
let out_slice = slice::from_raw_parts_mut(out.data, 1);
|
||||||
let data_slice1 = unsafe { slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]) };
|
let data_slice1 = slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]);
|
||||||
|
|
||||||
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
||||||
if !matrix.is_square() {
|
if !matrix.is_square() {
|
||||||
@ -334,9 +334,9 @@ pub unsafe extern "C" fn sp_linalg_lu(mat1: *mut InputMatrix, out_l: *mut InputM
|
|||||||
let outl_dim = (*out_l).get_dims();
|
let outl_dim = (*out_l).get_dims();
|
||||||
let outu_dim = (*out_u).get_dims();
|
let outu_dim = (*out_u).get_dims();
|
||||||
|
|
||||||
let data_slice1 = unsafe { slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]) };
|
let data_slice1 = slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]);
|
||||||
let out_l_slice = unsafe { slice::from_raw_parts_mut(out_l.data, outl_dim[0] * outl_dim[1]) };
|
let out_l_slice = slice::from_raw_parts_mut(out_l.data, outl_dim[0] * outl_dim[1]);
|
||||||
let out_u_slice = unsafe { slice::from_raw_parts_mut(out_u.data, outu_dim[0] * outu_dim[1]) };
|
let out_u_slice = slice::from_raw_parts_mut(out_u.data, outu_dim[0] * outu_dim[1]);
|
||||||
|
|
||||||
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
||||||
let (_, l, u) = matrix.lu().unpack();
|
let (_, l, u) = matrix.lu().unpack();
|
||||||
@ -379,9 +379,9 @@ pub unsafe extern "C" fn sp_linalg_schur(mat1: *mut InputMatrix, out_t: *mut Inp
|
|||||||
let out_t_dim = (*out_t).get_dims();
|
let out_t_dim = (*out_t).get_dims();
|
||||||
let out_z_dim = (*out_z).get_dims();
|
let out_z_dim = (*out_z).get_dims();
|
||||||
|
|
||||||
let data_slice1 = unsafe { slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]) };
|
let data_slice1 = slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]);
|
||||||
let out_t_slice = unsafe { slice::from_raw_parts_mut(out_t.data, out_t_dim[0] * out_t_dim[1]) };
|
let out_t_slice = slice::from_raw_parts_mut(out_t.data, out_t_dim[0] * out_t_dim[1]);
|
||||||
let out_z_slice = unsafe { slice::from_raw_parts_mut(out_z.data, out_z_dim[0] * out_z_dim[1]) };
|
let out_z_slice = slice::from_raw_parts_mut(out_z.data, out_z_dim[0] * out_z_dim[1]);
|
||||||
|
|
||||||
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
||||||
let (z, t) = matrix.schur().unpack();
|
let (z, t) = matrix.schur().unpack();
|
||||||
@ -428,9 +428,9 @@ pub unsafe extern "C" fn sp_linalg_hessenberg(
|
|||||||
let out_h_dim = (*out_h).get_dims();
|
let out_h_dim = (*out_h).get_dims();
|
||||||
let out_q_dim = (*out_q).get_dims();
|
let out_q_dim = (*out_q).get_dims();
|
||||||
|
|
||||||
let data_slice1 = unsafe { slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]) };
|
let data_slice1 = slice::from_raw_parts_mut(mat1.data, dim1[0] * dim1[1]);
|
||||||
let out_h_slice = unsafe { slice::from_raw_parts_mut(out_h.data, out_h_dim[0] * out_h_dim[1]) };
|
let out_h_slice = slice::from_raw_parts_mut(out_h.data, out_h_dim[0] * out_h_dim[1]);
|
||||||
let out_q_slice = unsafe { slice::from_raw_parts_mut(out_q.data, out_q_dim[0] * out_q_dim[1]) };
|
let out_q_slice = slice::from_raw_parts_mut(out_q.data, out_q_dim[0] * out_q_dim[1]);
|
||||||
|
|
||||||
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
let matrix = DMatrix::from_row_slice(dim1[0], dim1[1], data_slice1);
|
||||||
let (q, h) = matrix.hessenberg().unpack();
|
let (q, h) = matrix.hessenberg().unpack();
|
||||||
|
Loading…
Reference in New Issue
Block a user