Issue 1:
In [1]: import numpy as np

In [2]: np.append([], (unichr(0)))
Out[2]:
array([u''],
dtype='<U32')

In [3]: np.append([], (unichr(1)))
Out[3]:
array([u'\x01'],
dtype='<U32')

In [4]: np.unique(unichr(0))
Out[4]:
array([u''],
dtype='<U1')

In [5]: np.unique(unichr(1))
Out[5]:
array([u'\x01'],
dtype='<U1')

In [6]: np.array([unichr(0)])
Out[6]:
array([u''],
dtype='<U1')

In [7]: np.array([unichr(1)])
Out[7]:
array([u'\x01'],
dtype='<U1')

In [8]: np.array([unichr(0), unichr(1)])
Out[8]:
array([u'', u'\x01'],
dtype='<U1')

In [9]: [unichr(0)]
Out[9]: [u'\x00']

Issue 2:
Describe the issue:

On osx-arm64, running the following

import numpy as np

Sigma = np.full((5, 5), 0.7)
np.fill_diagonal(Sigma, 1)

rng = np.random.default_rng(12)

X = rng.multivariate_normal(np.zeros(5), Sigma, 1)
print(X)

prints

[[ 0.7989866 0.26512508 -0.43169361 -0.72572551 0.12306469]]

Running the same code on linux64 prints

[[ 0.36925409 0.06273453 -0.92231155 -0.1340844 0.65416457]]

This is equally an issue for scipy:

from scipy.stats import multivariate_normal

X = multivariate_normal(mean=np.zeros(5), cov=Sigma, seed=12).rvs(1)

print(X)

prints

[-0.04337636 -1.19324783 0.23303855 -0.47834447 -0.57976733]

on osx-arm64 and

[-0.29356888 -0.19370035 -0.7717682 0.30701745 -1.10967747]

on linux-64.

Output of conda list on osx-arm64:

# packages in environment at /Users/mlondschien/mambaforge/envs/numpy:
#
# Name Version Build Channel
bzip2 1.0.8 h3422bc3_4 conda-forge
ca-certificates 2022.12.7 h4653dfc_0 conda-forge
libblas 3.9.0 16_osxarm64_openblas conda-forge
libcblas 3.9.0 16_osxarm64_openblas conda-forge
libcxx 14.0.6 h2692d47_0 conda-forge
libffi 3.4.2 h3422bc3_5 conda-forge
libgfortran 5.0.0 11_3_0_hd922786_27 conda-forge
libgfortran5 11.3.0 hdaf2cc0_27 conda-forge
liblapack 3.9.0 16_osxarm64_openblas conda-forge
libopenblas 0.3.21 openmp_hc731615_3 conda-forge
libsqlite 3.40.0 h76d750c_0 conda-forge
libzlib 1.2.13 h03a7124_4 conda-forge
llvm-openmp 15.0.6 h7cfbb63_0 conda-forge
ncurses 6.3 h07bb92c_1 conda-forge
numpy 1.24.0 py311ha92fb03_0 conda-forge
openssl 3.0.7 h03a7124_1 conda-forge
pip 22.3.1 pyhd8ed1ab_0 conda-forge
python 3.11.0 h93c2e33_0_cpython conda-forge
python_abi 3.11 3_cp311 conda-forge
readline 8.1.2 h46ed386_0 conda-forge
scipy 1.9.3 py311h0bcca16_2 conda-forge
setuptools 65.6.3 pyhd8ed1ab_0 conda-forge
tk 8.6.12 he1e0b03_0 conda-forge
tzdata 2022g h191b570_0 conda-forge
wheel 0.38.4 pyhd8ed1ab_0 conda-forge
xz 5.2.6 h57fd34a_0 conda-forge

Output of conda list on linux-64:

# packages in environment at /home/mlondschien/miniforge3/envs/numpy:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
bzip2 1.0.8 h7f98852_4 conda-forge
ca-certificates 2022.12.7 ha878542_0 conda-forge
ld_impl_linux-64 2.39 hcc3a1bd_1 conda-forge
libblas 3.9.0 16_linux64_openblas conda-forge
libcblas 3.9.0 16_linux64_openblas conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc-ng 12.2.0 h65d4601_19 conda-forge
libgfortran-ng 12.2.0 h69a702a_19 conda-forge
libgfortran5 12.2.0 h337968e_19 conda-forge
libgomp 12.2.0 h65d4601_19 conda-forge
liblapack 3.9.0 16_linux64_openblas conda-forge
libnsl 2.0.0 h7f98852_0 conda-forge
libopenblas 0.3.21 pthreads_h78a6416_3 conda-forge
libsqlite 3.40.0 h753d276_0 conda-forge
libstdcxx-ng 12.2.0 h46fd767_19 conda-forge
libuuid 2.32.1 h7f98852_1000 conda-forge
libzlib 1.2.13 h166bdaf_4 conda-forge
ncurses 6.3 h27087fc_1 conda-forge
numpy 1.24.0 pypi_0 pypi
openssl 3.0.7 h0b41bf4_1 conda-forge
pip 22.3.1 pyhd8ed1ab_0 conda-forge
python 3.11.0 ha86cf86_0_cpython conda-forge
python_abi 3.11 3_cp311 conda-forge
readline 8.1.2 h0f457ee_0 conda-forge
scipy 1.9.3 pypi_0 pypi
setuptools 65.6.3 pyhd8ed1ab_0 conda-forge
tk 8.6.12 h27826a3_0 conda-forge
tzdata 2022g h191b570_0 conda-forge
wheel 0.38.4 pyhd8ed1ab_0 conda-forge
xz 5.2.6 h166bdaf_0 conda-forge

Reproduce the code example:

import numpy as np

Sigma = np.full((5, 5), 0.7)
np.fill_diagonal(Sigma, 1)

rng = np.random.default_rng(12)

X = rng.multivariate_normal(np.zeros(5), Sigma, 1)
print(X)

from scipy.stats import multivariate_normal

X = multivariate_normal(mean=np.zeros(5), cov=Sigma, seed=12).rvs(1)

print(X)

Error message:

No response

Runtime information:

On osx-arm64:

Python 3.11.0 | packaged by conda-forge | (main, Oct 25 2022, 06:21:25) [Clang 14.0.4 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, numpy; print(numpy.__version__); print(sys.version)
1.24.0
3.11.0 | packaged by conda-forge | (main, Oct 25 2022, 06:21:25) [Clang 14.0.4 ]
>>> print(numpy.show_runtime())
[{'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
'found': ['ASIMDHP', 'ASIMDDP'],
'not_found': ['ASIMDFHM']}},
{'architecture': 'VORTEX',
'filepath': '/Users/mlondschien/mambaforge/envs/numpy/lib/libopenblas.0.dylib',
'internal_api': 'openblas',
'num_threads': 10,
'prefix': 'libopenblas',
'threading_layer': 'openmp',
'user_api': 'blas',
'version': '0.3.21'},
{'filepath': '/Users/mlondschien/mambaforge/envs/numpy/lib/libomp.dylib',
'internal_api': 'openmp',
'num_threads': 10,
'prefix': 'libomp',
'user_api': 'openmp',
'version': None}]
None

(I needed to install threadpoolctl for the second result. This did not change the original issue.)

On linux-64:

Python 3.11.0 | packaged by conda-forge | (main, Oct 25 2022, 06:24:40) [GCC 10.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, numpy
>>> print(numpy.__version__); print(sys.version)
1.24.0
3.11.0 | packaged by conda-forge | (main, Oct 25 2022, 06:24:40) [GCC 10.4.0]
>> print(numpy.show_runtime())
[{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_KNL',
'AVX512_KNM',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}},
{'architecture': 'Haswell',
'filepath': '/home/mlondschien/miniforge3/envs/numpy/lib/libopenblasp-r0.3.21.so',
'internal_api': 'openblas',
'num_threads': 8,
'prefix': 'libopenblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.21'}]
None

(Also after installing threadpoolctl)

Context for the issue:

Reproducibility is extremely important for scientific research.