Cytnx-dev / Cytnx

Project Cytnx, A Cross-section of Python & C++,Tensor network library
Apache License 2.0
35 stars 14 forks source link

Segmentation fault when using Svd_truncate #479

Closed josephinius closed 1 month ago

josephinius commented 2 months ago

I use cytnx version 0.9.7.

I got "Segmentation fault (core dumped)" when trying to run this code:

import cytnx as cy
import numpy as np
matrix = np.array([[1, 2], [3, 4], [5, 6]])
tensor = cy.from_numpy(matrix)
unitensor = cy.UniTensor(tensor, rowrank=1) 
keepdim = 1
err_cutoff = 0
svd_truncate_result = cy.linalg.Svd_truncate(unitensor, keepdim, err_cutoff, is_UvT=True)
manuschneider commented 2 months ago

This seems to be a problem with Svd_truncate for int type tensors. The above code seems to work fine when matrix = np.array([[1, 2], [3, 4], [5, 6]]) is replaced by matrix = np.array([[1., 2.], [3., 4.], [5., 6.]]).